Platforms to show: All Mac Windows Linux Cross-Platform

/MacControls/HUDPopupMenu


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: /MacControls/HUDPopupMenu

This example is the version from Sun, 26th Jul 2014.

Project "HUDPopupMenu.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PopupMenu1 Inherits PopupMenu
ControlInstance PopupMenu1 Inherits PopupMenu
EventHandler Sub Open() dim po as nspopUpButtonMBS = me.nspopUpButtonMBS po.BezelStyle = po.NSInlineBezelStyle po.ArrowPosition = po.NSPopUpArrowAtBottom // give item 3 a special font dim m as NSMenuMBS = po.menu dim it as NSMenuItemMBS = m.Item(2) dim font as NSFontMBS = NSFontMBS.fontWithName("Arial", 15.0) dim t as NSMutableAttributedStringMBS = NSMutableAttributedStringMBS.attributedStringWithString(it.title).mutableCopy dim Black as NSColorMBS = NSColorMBS.colorWithDeviceRGB(1.0, 0.0, 0.0) t.addAttribute(NSAttributedStringMBS.NSFontAttributeName, font, new NSRangeMBS(0, t.length)) t.addAttribute(NSAttributedStringMBS.NSForegroundColorAttributeName, Black, new NSRangeMBS(0, t.length)) it.attributedTitle = t End EventHandler
End Control
Sub Constructor() Super.Constructor dim styleMask as integer dim BackingStoreType as integer=2 styleMask = BitwiseOr(styleMask, NSWindowMBS.NSTitledWindowMask) // with title bar styleMask = BitwiseOr(styleMask, NSWindowMBS.NSClosableWindowMask) // with close button styleMask = BitwiseOr(styleMask, NSWindowMBS.NSMiniaturizableWindowMask) // with minimize button styleMask = BitwiseOr(styleMask, NSPanelMBS.NSHUDWindowMask) // make it HUD styleMask = BitwiseOr(styleMask, NSPanelMBS.NSUtilityWindowMask) // and make it a palette Self.NSWindowMBS.styleMask=styleMask Self.NSWindowMBS.backingType=BackingStoreType Self.NSWindowMBS.setContentBorderThickness( 4.0, NSWindowMBS.NSMinYEdge ) End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
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

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


The biggest plugin in space...