MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Cocoa/Popupmenu Icons for Cocoa
Feedback.

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
This example is the version from Sun, 17th Mar 2012.
Notes: Last modified: Sun, 17th Mar 2012
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

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




Links
MBS Realbasic Plugins