Platforms to show: All Mac Windows Linux Cross-Platform
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/Cocoa Controls
This example is the version from Mon, 24th Jan 2016.
Project "Cocoa Controls.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control NSButtonControlMBS1 Inherits NSButtonControlMBS
ControlInstance NSButtonControlMBS1 Inherits NSButtonControlMBS
EventHandler Sub Action()
log CurrentMethodName
End EventHandler
EventHandler Sub Close()
log CurrentMethodName
End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean
log CurrentMethodName
End EventHandler
EventHandler Sub KeyUp(Key As String)
log CurrentMethodName
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
End EventHandler
End Control
Control NSPopUpButtonControlMBS1 Inherits NSPopUpButtonControlMBS
ControlInstance NSPopUpButtonControlMBS1 Inherits NSPopUpButtonControlMBS
EventHandler Sub Action()
dim p as NSPopUpButtonMBS = me.View
dim m as NSMenuItemMBS = p.selectedItem
if m<>nil then
log CurrentMethodName+": "+m.title
else
log CurrentMethodName+": no selection"
end if
End EventHandler
EventHandler Sub Close()
log CurrentMethodName
End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean
log CurrentMethodName
End EventHandler
EventHandler Sub KeyUp(Key As String)
log CurrentMethodName
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
dim p as NSPopUpButtonMBS = me.View
p.addItemWithTitle "Hello"
p.addItemWithTitle "World"
End EventHandler
End Control
Control NSSearchFieldControlMBS1 Inherits NSSearchFieldControlMBS
ControlInstance NSSearchFieldControlMBS1 Inherits NSSearchFieldControlMBS
EventHandler Sub Action()
log CurrentMethodName
End EventHandler
EventHandler Sub Close()
log CurrentMethodName
End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean
log CurrentMethodName
End EventHandler
EventHandler Sub KeyUp(Key As String)
log CurrentMethodName
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
End EventHandler
End Control
Control NSTextFieldControlMBS1 Inherits NSTextFieldControlMBS
ControlInstance NSTextFieldControlMBS1 Inherits NSTextFieldControlMBS
EventHandler Sub Action()
log CurrentMethodName
End EventHandler
EventHandler Sub Close()
log CurrentMethodName
End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean
log CurrentMethodName
End EventHandler
EventHandler Sub KeyUp(Key As String)
log CurrentMethodName
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
End EventHandler
End Control
Control NSTextViewControlMBS1 Inherits NSTextViewControlMBS
ControlInstance NSTextViewControlMBS1 Inherits NSTextViewControlMBS
EventHandler Sub Close()
log CurrentMethodName
End EventHandler
EventHandler Sub Open()
log CurrentMethodName
dim t as NSTextViewMBS = me.View
t.isRichText = true
t.isEditable = true
t.GrammarCheckingEnabled = true
t.isSelectable = true
End EventHandler
EventHandler Function shouldChangeTextInRange(affectedCharRange as NSRangeMBS, replacementString as string) As boolean
log CurrentMethodName
Return true
End EventHandler
EventHandler Sub textDidBeginEditing()
log CurrentMethodName
End EventHandler
EventHandler Sub textDidChange()
log CurrentMethodName
End EventHandler
EventHandler Sub textDidEndEditing()
log CurrentMethodName
End EventHandler
EventHandler Function textShouldBeginEditing() As boolean
log CurrentMethodName
End EventHandler
EventHandler Function textShouldEndEditing() As boolean
log CurrentMethodName
End EventHandler
EventHandler Sub textViewDidChangeSelection()
log CurrentMethodName
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Sub log(s as string)
Listbox1.InsertRow 0,s
End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacControls Plugin.