/*------------------------------------------------------------------------- /* Environmental Systems Research Institute /*------------------------------------------------------------------------- /* Program: MODAL.AML /* Purpose: AML program for making the specified tool thread modal by /* unfocusing all other threads. /* /*------------------------------------------------------------------------- /* Usage: modal /* Usage: modal /* /* Arguments: routine - routine to be run /* threadname - The name of the thread to be made modal /* /* Globals: /*------------------------------------------------------------------------- /* Calls: inform.menu /*------------------------------------------------------------------------- /* Notes: This aml must be run with the OPEN routine after the /* thread that is to be made modal is created. /* When the thread is to be deleted, run this tool with the /* CLOSE routine. See MSINFORM.AML for an example. /*------------------------------------------------------------------------- /* Input: /* Output: /*------------------------------------------------------------------------- /* History: Matt McGrath - 02/27/92 - Original coding /*========================================================================= /* &args routine threadname /* &severity &error &routine bailout /* &if [NULL %threadname%] &then &set routine = usage &call %routine% &return /*------------------ &routine USAGE /*------------------ &type Usage: modal &return &warning /*------------------- &routine OPEN /*------------------- /* /* Set a temporary variable to hold the names of any threads that /* were focused before this routine was called. /* When the modal menu is dismissed, the close routine is called, all /* threads are refocused, and the ones which were unfocused before /* this routine was called remain unfocused. /* /* Allow modal to be run multiple times, meaning the variable for the /* focuslist will have to be unique each time &set .modal%threadname%$focuslist &do i &list [SHOW &thread &list] &if [SHOW &thread &focus %i%] &then &set .modal%threadname%$focuslist = ~ [VALUE .modal%threadname%$focuslist] %i% &end /* &thread &focus &off &others &if [SHOW &thread &exists %threadname%] &then &thread &focus &on %threadname% &thread &focus &off &self /* /* When focus is turned back on in the close routine, control returns /* to this point, so recall the close routine &call close &return /*------------------- &routine CLOSE /*------------------- /* /* Close the modal menu and re-establish the thread environment that /* existed before the modal menu was called /* /* Focus any menus that were previously focused before the tool /* was called /* &if [VARIABLE .modal%threadname%$focuslist] &then &if not [NULL [VALUE .modal%threadname%$focuslist]] &then &do i &list [VALUE .modal%threadname%$focuslist] &if [SHOW &thread &exists %i%] &then &thread &focus &on %i% &end /* /* Delete the modal menu thread &if [SHOW &thread &exists %threadname%] &then &thread &delete %threadname% /* &dv .modal%threadname%$* /* &return /*------------------ &routine BAILOUT /*------------------ &severity &error &ignore &severity &warning &ignore &thread &focus &on &all &return &warning An error has occurred in routine: %routine% (MODAL.AML)