Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Menu Test
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/Menu Test
This example is the version from Sat, 1st Jun 2018.
Project "Menu Test.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub EnableMenuItems() FileUnchecked.enable // normally checked FileChecked.checked = true FileChecked.enable FileDot.enable FileDot.checked = true // with bullet via constructor dim n1 as new NSMenuItemMBS(fileDot) n1.onStateImage = NSImageMBS.imageNamed("NSMenuItemBullet") FileDiamond.enable FileDiamond.checked = true // with diamond via function dim n2 as NSMenuItemMBS = NSMenuItemMBS.MenuItem(FileDiamond) n2.onStateImage = NSImageMBS.imageNamed("NSMenuItemDiamond") FileIcon.enable FileIcon.checked = true // with icon as checkmark dim n3 as NSMenuItemMBS = NSMenuItemMBS.MenuItem(FileIcon) dim icon as NSImageMBS = NSWorkspaceMBS.iconForFileType("com.xojo.project.binary") icon.setSize(16,16) n3.onStateImage = icon FileCustomImage.enable FileCustomImage.checked = true // with custom image as checkmark dim p as new Picture(32,32) dim g as Graphics = p.Graphics g.ForeColor = &c0000FF g.FillOval 0, 0, p.Width, p.Height dim n4 as NSMenuItemMBS = NSMenuItemMBS.MenuItem(FileCustomImage) dim image as new NSImageMBS(p) image.setSize(16,16) n4.onStateImage = image End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem FileUnchecked = "Unchecked"
MenuItem FileChecked = "Checked"
MenuItem FileDiamond = "Diamond"
MenuItem FileDot = "Dot"
MenuItem FileIcon = "Icon"
MenuItem FileCustomImage = "Custom Image"
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

Feedback, Comments & Corrections

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

MBS Xojo Plugins