Example: /MacCocoa/Popupmenu Icons for Cocoa

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Popupmenu Icons for Cocoa


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: /MacCocoa/Popupmenu Icons for Cocoa

This example is the version from Sun, 17th Mar 2012.

Project "Popupmenu Icons for Cocoa.xojo_binary_project"
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 MacCocoa Plugin.


💬 Ask a question or report a problem