PopMenu
PowerScript function
Description
Displays a menu at the specified location.
Applies to
Menu objects
Syntax
1 |
menuname.PopMenu ( xlocation, ylocation ) |
Argument |
Description |
---|---|
menuname |
The fully qualified name of a menu on a menu bar you |
xlocation |
The distance in PowerBuilder units of the displayed |
ylocation |
The distance in PowerBuilder units of the displayed |
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, PopMenu returns null.
Usage
If the menu object is not associated with the window so that it was
opened when the window was opened, you must use CREATE to allocated memory
for the menu (see the last example).
If the Visible property of the menu is false, you must make the menu
visible before you can display it as a pop-up menu.
The coordinates you specify for PopMenu are relative to the active
window. In an MDI application, the coordinates are relative to the frame
window, which is the active window. To display a menu at the cursor
position, call PointerX and PointerY for the active window (the frame
window in an MDI application) to get the coordinates of the cursor. (See
the examples.)
Calling PopMenu in an object script
PopMenu must be called in an object script. It should not be
called in a global function.
Examples
These statements display the menu m_Emp.M_Procedures at location
100, 200 in the active window. M_Emp is the menu associated with the
window:
1 |
m_Emp.M_Procedures.PopMenu(100, 200) |
This statement displays the menu m_Appl.M_File at the cursor
position, where m_Appl is the menu associated with the window.
1 |
m_Appl.M_file.PopMenu(PointerX(), PointerY()) |
These statements display a pop-up menu at the cursor position.
Menu4 was created in the Menu painter and includes a menu called
m_language. Menu4 is not the menu for the active window. NewMenu is an
instance of Menu4 (datatype Menu4):
1 2 3 |
Menu4 NewMenu NewMenu = CREATE Menu4 NewMenu.m_language.PopMenu(PointerX(), PointerY()) |
In an MDI application, the last line would include the MDI frame as
the object for the pointer functions:
1 2 |
NewMenu.m_language.PopMenu( & w_frame.PointerX(), w_frame.PointerY()) |