Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Cocoa/Popupmenu Icons for Cocoa
Function: You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /Cocoa/Popupmenu Icons for Cocoa
Project "Popupmenu Icons for Cocoa.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if TargetCocoa = false then MsgBox "This project needs Cocoa target." end if End EventHandler
End Class
Class Window1 Inherits Window
Control PopupMenu1 Inherits PopupMenu
ControlInstance PopupMenu1 Inherits PopupMenu
EventHandler Sub Open() dim p as NSPopUpButtonMBS = me.NSPopUpButtonMBS dim m1 as NSMenuItemMBS = p.itemAtIndex(0) m1.Image = MakeImage(&cFF0000) dim m2 as NSMenuItemMBS = p.itemAtIndex(1) m2.Image = MakeImage(&c00FF00) dim m3 as NSMenuItemMBS = p.itemAtIndex(2) m3.Image = MakeImage(&c0000FF) End EventHandler
End Control
Function MakeImage(c as color) As NSImageMBS dim pic as new Picture(16,16,32) pic.Graphics.ForeColor = c pic.Graphics.FillRect 0,0,16,16 dim m as new Picture(16,16,32) m.Graphics.ForeColor = &cFFFFFF m.Graphics.FillRect 0,0,16,16 m.Graphics.ForeColor = &c000000 m.Graphics.FillOval 0,0,16,16 dim n as new NSImageMBS(pic, m) Return n End Function
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

Feedback, Comments & Corrections

MBS FileMaker Plugins