PopMenu PowerScript function
Description
Displays a menu at the specified location.
Controls
Menu objects
Syntax
1 |
<span>menuname</span>.<span>PopMenu</span> ( <span>xlocation</span>, <span>ylocation</span> ) |
Argument |
Description |
---|---|
menuname |
The fully qualified name of a menu on |
xlocation |
The distance in PowerBuilder units of |
ylocation |
The distance in PowerBuilder units of |
Return Values
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.)

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.<span>PopMenu</span>(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.<span>PopMenu</span>(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 |
Menu4 NewMenu |
1 |
NewMenu = CREATE Menu4 |
1 |
NewMenu.m_language.<span>PopMenu</span>(PointerX(), PointerY()) |
In an MDI application, the last line would include
the MDI frame as the object for the pointer functions:
1 |
NewMenu.m_language.<span>PopMenu</span>( & |
1 |
   w_frame.PointerX(), w_frame.PointerY()) |