 |
PopupDo |
Function (ROM Call 0x47) |
Executes a popup menu.
PopupDo draws the popup menu associated with the handle Handle on the screen.
Handle must be returned from PopupNew and not
from PopupBegin; take care never to mix handles.
The top-left corner of the dialog will be the at the position (x, y);
the coordinates are absolute screen coordinates. x, y, or both may also
have a special value CENTER, which tells PopupDo to
center the menu in this dimension. After the execution, the original contents of the screen
will be restored. PopupDo returns the identification number (ID) of the selected menu item (see
PopupAddText), or 0 if the user pressed ESC.
StartID determines which option will be selected first when the menu is
executed. It seems that StartID works correctly only for menus without
submenus. Anyway, you can always pass 0 to StartID. It causes the function
to select the first item.
This routine may cause heap compression.
Here is an example of a scrolling popup menu with submenus
(called "Popup Menu Example"):
// A simple popup menu example
#define USE_TI89 // Compile for TI-89
#define USE_TI92PLUS // Compile for TI-92 Plus
#define USE_V200 // Compile for V200
#define RETURN_VALUE // Return a Value
#define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization
#define MIN_AMS 101 // Compile for AMS 1.01 or higher
#include <tigcclib.h> // Include All Header Files
// Main Function
void _main(void)
{
HANDLE handle = PopupNew ("EXAMPLE", 40);
PopupAddText (handle, -1, "Option 1", 1);
PopupAddText (handle, -1, "Option 2", 2);
PopupAddText (handle, 0, "Submenu 3", 3);
PopupAddText (handle, 0, "Submenu 4", 4);
PopupAddText (handle, -1, "Option 5", 5);
PopupAddText (handle, 3, "Suboption 3.1", 6);
PopupAddText (handle, 3, "Suboption 3.2", 7);
PopupAddText (handle, 3, "Suboption 3.3", 8);
PopupAddText (handle, 4, "Suboption 4.1", 9);
short result = PopupDo (handle, CENTER, CENTER, 0);
push_longint (result);
HeapFree (handle);
}
Uses: MenuPopup, HeapLock, HeapUnlock
Used by: cmd_popup, EV_defaultHandler, EV_quit
See also: PopupNew, MenuPopup