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

/CocoaControls/HUDPopupMenu
Function: You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /CocoaControls/HUDPopupMenu
Project "HUDPopupMenu.rbp"
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

Feedback, Comments & Corrections




Links
MBS Xojo Chart Plugins