 |
PopupBeginDo |
Function (ROM Call 0x3F6) |
Executes a dynamically allocated popup using a menu-draw handle.
PopupBeginDo draws the popup menu associated with the handle
ExecHandle on the screen. ExecHandle must be returned from
PopupBegin and not directly from
PopupNew; 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 PopupBeginDo to
center the menu in this dimension. After the execution, the original contents of the screen
will be restored. PopupBeginDo returns the identification number (ID) of the selected menu item (see
DynMenuAdd), 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 "Dynamic Popup 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 200 // Compile for AMS 2.00 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);
HANDLE exec_handle = PopupBegin (handle, 0);
MenuCheck (exec_handle, 2, MC_CHECK);
MenuCheck (exec_handle, 5, MC_FLIP);
short result = PopupBeginDo (exec_handle, CENTER, CENTER, 0);
push_longint (result);
MenuEnd (exec_handle);
}
Uses: HeapLock, HeapUnlock, ROM Call 0x421
See also: PopupBegin, MenuEnd, PopupDo