Platforms to show: All Mac Windows Linux Cross-Platform
/MacControls/NSButtonControl tests/NSButtonControl2
Required plugins for this example: MBS MacBase Plugin, MBS MacControls 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: /MacControls/NSButtonControl tests/NSButtonControl2
This example is the version from Tue, 9th Dec 2013.
Project "NSButtonControl2.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open()
#if TargetCocoa then
dim c as new NSButtonControlContainer
c.EmbedWithin(self, 322, 177, c.Width, c.Height)
// we need to route the action event to our window
dim w as NSButtonControlMBS = c.NSButtonControlMBS1
AddHandler w.Action, WeakAddressOf clicked
#endif
End EventHandler
Sub Clicked(o as object)
#if TargetCocoa then
dim n as NSButtonControlMBS = NSButtonControlMBS(o)
MsgBox "Clicked"
#endif
End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class NSButtonControlContainer Inherits ContainerControl
Control NSButtonControlMBS1 Inherits NSButtonControlMBS
ControlInstance NSButtonControlMBS1 Inherits NSButtonControlMBS
End Control
End Class
End Project
See also:
The items on this page are in the following plugins: MBS MacControls Plugin.