Version 10 (modified by 6 years ago) ( diff ) | ,
---|
FORM_DONE_ESCAPE
FORM_DONE_ESCAPE is a defined value for the nData variable in a form done event to indicate the form was exited by means of the ESCAPE key. The event must be specified in the appropriate FORM_INIT.
Example
This example shows prompting "Save Changes?" if a form is exited by ESCAPE or left arrow. If ENTER is pressed changes will be saved automatically.
EVENT(InputDone) { if(nData == FORM_DONE_ESCAPE || nData == FORM_DONE_LEFT_ARROW) { if(pForm->IsChanged() == true) { if(WaitPrompt(LANG(STR_SAVE_CHANGES), LANG(STR_YES), LANG(STR_NO)) == true) { IN_EVENT_WRITE_DATA; } } } return 1; }
This example shows preventing the application from being exited by using the left arrow. It also illustrates that the application may be prevented from exiting based on a status such as if a filling event is in process.
EVENT(MainScreenDone) { if(nData != FORM_DONE_ESCAPE) { ShowErrorMsg("SHIFT-ESCAPE to exit application"); return 0; } if(mode != modeIdle) { ShowErrorMsg("Cannot exit while running"); return 0; } return 1; }
See Also
Note:
See TracWiki
for help on using the wiki.