Documentation | InterfaceKit | PopUpMenu
SYNOPSIS
Perl
use HaikuR1::PopUpMenu; my $popup = HaikuR1::PopUpMenu->new( name => $name ) $popup->Go();
Python
from HaikuR1.InterfaceKit import PopUpMenu popup = PopUpMenu( name = name ) popup.Go()
DESCRIPTION
Exposes the BPopUpMenu
object.
For more information on PopUpMenu, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a PopUpMenu.
Perl
HaikuR1::PopUpMenu->new( name => $name, radioMode => $radioMode, labelFromMarked => $labelFromMarked, layout => $layout, );
Python
PopUpMenu( name = name, radioMode = radioMode, labelFromMarked = labelFromMarked, layout = layout, )
name
A string, the Menu name. (If this Menu is a submenu of another Menu, the name will be used as the initial label of the controlling MenuItem.)
radioMode
A boolean; if true, the most recently selected item will be marked (and only one item at a time may be marked); if false, items are not automatically marked or unmarked. Defaults to true; ignored if
labelFromMarked
is true.labelFromMarked
A boolean; if true, the parent MenuItem (if any) will change its label to match the marked item, and the marked item will appear over the parent item when the PopUpMenu is displayed; if false, the parent MenuItem will not change its label based on the marked item, and the PopUpMenu will appear in its usual position. This property is useful only when the PopUpMenu is controlled by a MenuItem within a MenuBar or a MenuField.
layout
Either
B_ITEMS_IN_ROW
orB_ITEMS_IN_COLUMN
; defaults toB_ITEMS_IN_COLUMN
.
AsyncAutoDestruct
SetAsyncAutoDestruct
Enables or disables auto-destruct for the PopUpMenu; of true, the associated Menu is deleted when the PopUpMenu closes. Defaults to false (which is usually what you want).
Perl
$popupmenu->AsyncAutoDestruct(); $popupmenu->SetAsyncAutoDestruct($state);
Python
popupmenu.AsyncAutoDestruct() popupmenu.SetAsyncAutoDestruct(state)
state
A boolean, the new state.
Go
Displays the PopUpMenu. Returns the MenuItem that was selected, or the empty value if no item was selected.
Perl
$popupmenu->Go( where => $screenPoint, deliversMessage => $deliversMessage, openAnyway => $openAnyway, clickToOpenRect => $clickToOpenRect, asynchronous => $asynchronous, );
Python
popupmenu.Go( where = screenPoint, deliversMessage = deliversMessage, openAnyway = openAnyway, clickToOpenRect = clickToOpenRect, asynchronous = asynchronous, )
screenPoint
A Point, the location on the screen where the PopUpMenu will be displayed.
deliversMessage
A boolean; if true, the PopUpMenu's MenuItems will post a message to the associated target; if false, it will not, and you must use the returned MenuItem to determine how to respond. Defaults to false.
openAnyway
A boolean; if true, the PopUpMenu will remain open even if the user is not holding a mouse button down. Defaults to false.
clickToOpenRect
An optional Rect; if present, releasing the mouse button while inside the given rectangle causes the menu to stay open; releasing the button while outside the rectangle causes the menu to close.
asynchronous
A boolean; if true, the method returns the empty value immediately; otherwise it waits until the user dismisses the menu and returns the appropriate value. (Setting
asynchronous
to true anddeliversMessage
to false means you will not know which item was selected - so don't do that.)
ScreenLocation
Returns the PopUpMenu's location on the screen, as a Point. Meant to be used from within hooks.
Perl
$popupmenu->ScreenLocation();
Python
popupmenu.ScreenLocation()
ARCHIVABLE INTERFACE
PopUpMenu
inherits the methods and hooks of Archivable.
HANDLER INTERFACE
PopUpMenu
inherits the methods and hooks of Handler.
VIEW INTERFACE
PopUpMenu
inherits the methods and hooks of View.
MENU INTERFACE
PopUpMenu
inherits the methods and hooks of Menu.
SCRIPTING SUITE
PopUpMenu inherits the following suites: