| Dialog | Function (ROM Call 0x30)

dialogs.h

short Dialog (DIALOG *DialogPtr, short x, short y, char *RequestBuffer, short *PopupBuffer);

Shows and activates a dialog box given a pointer to a dialog structure.

Dialog works exactly like DialogDo, except instead of the handle, a pointer to the dialog structure is given as the parameter. DialogDo internally calls HeapDeref, then passes the returned pointer to the Dialog function. This function is mainly used internally in TIOS. Its advantage compared to DialogDo is the fact that the complete dialog structure may be given as a static pre-filled array of bytes, and you can give a pointer to such a structure to the Dialog function. It will save a lot of memory, because you do not need to call DialogNew and a lot of functions like DialogAddText etc.
If DialogPtr points to a dynamically created dialog box (i.e a dialog created with DialogNew or DialogAdd), the heap block that stores the dialog box must be locked because this routine may cause heap compression.
Dialog may return:

- `KEY_ENTER` if the user pressed ENTER to close the dialog box.
- `KEY_ESC` if the user pressed ESC to close the dialog box.
- `-1` if there is not enough memory to open the menu for the dialog box.

Uses: HeapGetLock, HeapLock, HeapUnlock, ER_catch, ER_success, ER_throwVar, ERD_dialog, EV_captureEvents, EV_eventLoop, EV_paintWindows, EV_restorePainting, EV_suspendPainting, DrawStrWidth, DrawStrWidthP, FontCharWidth, FontGetSys, FontSetSys, alphaLockOff, alphaLockOn, GKeyIn, restoreAlphaLock, OSWriteLinkBlock, memset, MenuEnd, MenuOn, MenuPopup, MenuUpdate, ST_eraseHelp, strlen, CU_restore, CU_stop, OSSetSR, OSTimerRestart, XR_stringPtr, TE_close, TE_focus, TE_open, TE_openFixed, TE_select, TE_shrinkWrap, TE_unfocus, clear_error_context, sf_width, RectWinToScr, WinActivate, WinAttr, WinCharXY, WinClose, WinFill, WinFont, WinOpen, WinRect, WinStrXY, _du16u16, ROM Call 0x41C, ROM Call 0x41D, ROM Call 0x41E, ROM Call 0x471, ROM Call 0x4D7, ROM Call 0x5C6
Used by: DialogDo, cmd_clrtable, EV_defaultHandler, handleRclKey, MO_modeDialog, HomeExecute, LIO_Receive, TE_handleEvent, GT_DE_Init_Conds, GT_Format, GZ_SetFactors, SP_Define, ROM Call 0x45E, ROM Call 0x5F1

See also: DialogDo