Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/Toolbar/Toolbar add textfield


Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS MacControls Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacControls/Toolbar/Toolbar add textfield

This example is the version from Sat, 24th Mar 2023.

Project "Toolbar add textfield.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control TestButton Inherits PushButton
ControlInstance TestButton Inherits PushButton
EventHandler Sub Action() dim t as NSToolbarMBS = window1.NSToolbarMBS dim items() as NSToolbarItemMBS = t.items for each it as NSToolbarItemMBS in items MsgBox it.label next End EventHandler
End Control
Control Toolbar11 Inherits Toolbar1
ControlInstance Toolbar11 Inherits Toolbar1
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() dim t as NSToolbarMBS = window1.NSToolbarMBS dim items() as NSToolbarItemMBS = t.items for each it as NSToolbarItemMBS in items If it.label = "test" Then it.Autovalidates = false // don't automatically enable it again it.Enabled = Me.Value end if next End EventHandler
End Control
EventHandler Sub Open() dim t as NSToolbarMBS = window1.NSToolbarMBS dim items() as NSToolbarItemMBS = t.items for each it as NSToolbarItemMBS in items if it.label = "other" then myTextField = new NSTextFieldMBS(0, 0, 100, 20) searchItem = it it.view = myTextField it.maxSize = NSMakeSizeMBS(100, 20) it.minSize = NSMakeSizeMBS(50, 20) it.label = "" end if next End EventHandler
Property myTextField As NSTextFieldMBS
Property searchItem As NSToolbarItemMBS
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
Class Toolbar1 Inherits Toolbar
ToolbarItem ToolItem1
ToolbarItem ToolItem2
ToolbarItem ToolItem3
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacControls Plugin.


The biggest plugin in space...