Platforms to show: All Mac Windows Linux Cross-Platform
/MacExtras/MAAttachedWindow/MAAttachedWindow Test
Required plugins for this example: MBS MacBase Plugin, MBS MacExtras Plugin, MBS MacCocoa Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacExtras/MAAttachedWindow/MAAttachedWindow Test
This example is the version from Sun, 17th Mar 2012.
Project "MAAttachedWindow Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim w as NSWindowMBS = self.NSWindowMBS
if m<>Nil then
w.removeChildWindow m
m.hide
m = nil
end if
dim v as NSViewMBS = me.NSViewMBS
dim side as integer = MAAttachedWindowMBS.MAPositionAutomatic
dim distance as Double = 10.0
dim p as NSPointMBS = new NSPointMBS(me.left + me.Width/2, me.top + me.Height/2)
dim tv as new NSTextFieldMBS(10,10, 180, 50)
tv.StringValue = "Hello World"
tv.Editable = false
tv.textColor = NSColorMBS.whiteColor
tv.backgroundColor = NSColorMBS.blackColor
tv.Bordered = false
dim vv as new NSViewMBS(0,0,200,70)
vv.addSubview tv
m = MAAttachedWindowMBS.attachedWindow(vv, p, w, side, distance)
m.borderColor = NSColorMBS.whiteColor
m.backgroundColor = NSColorMBS.blackColor
m.viewMargin = 4
m.borderWidth = 3
m.cornerRadius = 8
m.drawsRoundCornerBesideArrow = true
m.arrowBaseWidth = 20
m.arrowHeight = 15
m.hasArrow = true
m.alphaValue = 0.9
w.addChildWindow m, NSWindowMBS.NSWindowAbove
m.show
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim w as NSWindowMBS = self.NSWindowMBS
if m<>Nil then
w.removeChildWindow m
dim a as NSWindowMBS = m.animator
if a = nil then
m.hide // hide normal
else
a.alphaValue = 0.0 // hide with CoreAnimation
end if
m = nil
end if
End EventHandler
End Control
Property m As MAAttachedWindowMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS MacExtras Plugin.