home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / EXAMPLE.SRC < prev    next >
Encoding:
Text File  |  1990-04-17  |  6.8 KB  |  179 lines

  1. $MACRO_FILE EXAMPLE;
  2. {******************************************************************************
  3. This file contains examples of how to call the Multi-Edit user interface
  4. macros.
  5. ******************************************************************************}
  6.  
  7.  
  8. $MACRO EXAMPLE;
  9. {******************************************************************************
  10.                                                                 MULTI-EDIT MACRO
  11.  
  12. Name:    EXAMPLE
  13.  
  14. Description:  Example of how to use the macro TOP_MENU to create a top level
  15.                             menu.
  16.  
  17. ******************************************************************************}
  18.     Set_Global_Str('TX_1','/H=FIXEDMENU/M=SUB_EXAMPLE1');
  19.     Set_Global_Str('XTX_1','Example-1');
  20.     Set_Global_Str('TX_2','/H=FIXEDMENU/M=SUB_EXAMPLE2');
  21.     Set_Global_Str('XTX_2','Example-2');
  22.     Set_Global_Str('TX_3','/H=FIXEDMENU/S=2/M=EXAMPLE_EXIT');
  23.     Set_Global_Str('XTX_3','Exit-menu');
  24.  
  25.     Run_Macro('USERIN^TOPMENU /GCLR=1/M=XTX_/G=TX_/#=3/X=1/Y=2/S=1/BC=1/L=TOP_MENU EXAMPLE');
  26.  
  27.     return_int := 100;
  28. END_MACRO;
  29.  
  30.  
  31. $MACRO EXAMPLE_EXIT;
  32. {This is truly a do-nothing macro}
  33. END_MACRO;
  34.  
  35. $MACRO SUB_EXAMPLE1;
  36. {******************************************************************************
  37.                                                                 MULTI-EDIT MACRO
  38.  
  39. Name:    SUB_EXAMPLE1
  40.  
  41. Description:  Example of how to use the macro SUB_MENU to create a sub level
  42.                             menu.
  43.  
  44. ******************************************************************************}
  45.     Set_Global_Str('SX_1','/H=FIXEDMENU/M=BAR_EXAMPLE');
  46.     Set_Global_Str('XSX_1','XMENU horizontal example');
  47.     Set_Global_Str('SX_2','/H=FIXEDMENU/M=VER_EXAMPLE');
  48.     Set_Global_Str('XSX_2','XMENU Vertical example');
  49.     Set_Global_Str('SX_3','/H=VARMENU/M=VAR_EXAMPLE');
  50.     Set_Global_Str('XSX_3','DVMENU example');
  51.  
  52.     Run_Macro('USERIN^SUBMENU /GCLR=1/G=SX_/M=XSX_/#=3/S=1/L=SUB_MENU EXAMPLE 1/X=' +
  53.         Parse_Str('/X=',MParm_Str) + '/Y=' + Parse_Str('/Y=',MParm_Str));
  54.  
  55. END_MACRO;
  56.  
  57. $MACRO BAR_EXAMPLE;
  58.     Def_Int( kill_count );
  59.     Run_Macro('USERIN^XMENU /B=1/X='+ Parse_Str('/X=',MParm_Str) + '/Y=' +
  60.         Parse_Str('/Y=',MParm_Str) + '/S=1' +
  61.         '/M=Choice1(FIXEDMENU)Choice2(FIXEDMENU)Choice3(FIXEDMENU)');
  62.         {If an item was selected then kill of all of the other menus and
  63.          then put up a message}
  64.     If (Return_Int > 0) THEN
  65.         kill_count := Parse_Int('/BC=', mparm_str);
  66.         While Box_Count > Kill_Count do
  67.             Kill_Box;
  68.         END;
  69.         Make_Message('XMENU HORIZONTAL: Item ' + str(Return_Int) + ' was selected.');
  70.     END;
  71. END_MACRO;
  72.  
  73. $MACRO VER_EXAMPLE;
  74.     Def_Int( kill_count );
  75.     Run_Macro('USERIN^XMENU /T=1/B=1/X='+ Parse_Str('/X=',MParm_Str) + '/Y=' +
  76.         Parse_Str('/Y=',MParm_Str) + '/S=1' +
  77.         '/M=Choice1(FIXEDMENU)Choice2(FIXEDMENU)Choice3(FIXEDMENU)');
  78.         {Return_Int will now be < 1 if <ESC> was pressed, or it will equal the
  79.          number of the menu item that was selected}
  80.         {If an item was selected then kill of all of the other menus and
  81.          then put up a message}
  82.     If (Return_Int > 0) THEN
  83.         kill_count := Parse_Int('/BC=', mparm_str);
  84.         While Box_Count > Kill_Count do
  85.             Kill_Box;
  86.         END;
  87.         Make_Message('XMENU VERTICAL: Item ' + str(Return_Int) + ' was selected.');
  88.     END;
  89. END_MACRO;
  90.  
  91. $MACRO VAR_EXAMPLE;
  92.     Set_Global_Str('EXAMPLE_1','Choice1');
  93.     Set_Global_Str('EXAMPLE_2','Choice2');
  94.     Set_Global_Str('EXAMPLE_3','Choice3');
  95.     Run_Macro('USERIN^DVMENU /P=EXAMPLE_/B=1/K=1/X=' + Parse_Str('/X=',MParm_Str)
  96.         + '/Y=' + Parse_Str('/Y=',MParm_Str) + '/T=/C=1/D=1/M=1/H=VARMENU/O=1/W=15'
  97.                         + '/#=3/U=1/I=%');
  98.     Set_Global_Str('EXAMPLE1','');
  99.         {Return_Int will now be < 1 if <ESC> was pressed, or it will equal the
  100.          number of the menu item that was selected}
  101. END_MACRO;
  102.  
  103. $MACRO SUB_EXAMPLE2;
  104. {******************************************************************************
  105.                                                                 MULTI-EDIT MACRO
  106.  
  107. Name:    SUB_EXAMPLE2
  108.  
  109. Description:  Example of how to use the macro SUB_MENU to create a sub level
  110.                             menu.
  111.  
  112. ******************************************************************************}
  113.     Set_Global_Str('SX_1','/H=FIXEDMENU/M=QUE_EXAMPLE');
  114.     Set_Global_Str('XSX_1','QUERY_BOX example');
  115.     Set_Global_Str('SX_2','/H=FIXEDMENU/M=USE_EXAMPLE');
  116.     Set_Global_Str('XSX_2','USER_STR example');
  117.     Set_Global_Str('SX_3','/H=VARMENU/M=DAT_EXAMPLE');
  118.     Set_Global_Str('XSX_3','DATA_IN example');
  119.  
  120.     Run_Macro('USERIN^SUBMENU /GCLR=1/G=SX_/M=XSX_/#=3/S=1/L=SUB_MENU EXAMPLE 2/X=' +
  121.         Parse_Str('/X=',MParm_Str) + '/Y=' + Parse_Str('/Y=',MParm_Str));
  122.  
  123. END_MACRO;
  124.  
  125. $MACRO QUE_EXAMPLE;
  126.     Def_Int( kill_count );
  127.  
  128.     Return_Str := 'EXAMPLE';
  129. {Notice we are enabling the history list here with /HISTORY=}
  130.     Run_Macro('USERIN^QUERYBOX /HISTORY=QUE_PASA/H=PROMPTS/C=' + Parse_Str('/X=',MParm_Str) +
  131.     '/L=' + Parse_Str('/Y=',MParm_Str) +
  132.     '/W=10/P=Enter whatever turns you on:/T=QUERYBOX EXAMPLE');
  133.  
  134.         {If the input was accepted then kill of all of the other menus and
  135.          then put up a message}
  136.     If (Return_Int > 0) THEN
  137.         kill_count := Parse_Int('/BC=', mparm_str);
  138.         While Box_Count > Kill_Count do
  139.             Kill_Box;
  140.         END;
  141.         Make_Message('The QUERYBOX was accepted');
  142.     END;
  143. END_MACRO;
  144.  
  145. $MACRO USE_EXAMPLE;
  146.  
  147.     Return_Str := 'EXAMPLE 1';
  148. {Here again, the history list is enabled, and we have chosen to use the same
  149. history name so that we can "share" with the QUERYBOX example.}
  150.     Run_Macro('USERIN^USERSTR /HISTORY=QUE_PASA/H=PROMPTS/X=' + Parse_Str('/X=',MParm_Str) +
  151.     '/BL=USERSTR EXAMPLE/Y=' + Parse_Str('/Y=',MParm_Str) +
  152.     '/B=1/NK=1/L=20/W=10/P=      After you enter something here:  /T=USERSTR EXAMPLE');
  153.     Return_Str := 'EXAMPLE 2';
  154.     Run_Macro('USERIN^USERSTR /H=PROMPTS/X=' + Str(Parse_Int('/X=',MParm_Str) + 1) +
  155.     '/Y=' + Str(Parse_Int('/Y=',MParm_Str) + 1) +
  156.     '/L=20/W=10/P=Notice the next prompt uses the same box:/T=USERSTR EXAMPLE');
  157. END_MACRO;
  158.  
  159. $MACRO DAT_EXAMPLE;
  160.     Set_Global_Str('ISTR_1','STRING');
  161.     Set_Global_Str('IPARM_1','/T=Example of a string input field:  /C=1/L=1/W=10/H=DATABOX');
  162.     Set_Global_Int('IINT_2',100);
  163.     Set_Global_Str('IPARM_2','/T=Example of an integer input field:/C=1/L=2/W=3/H=DATABOX/TP=1' );
  164.     Set_Global_Str('ISTR_3','123.456');
  165.     Set_Global_Str('IPARM_3','/T=Example of a real input field:    /C=1/L=3/W=7/H=DATABOX/TP=2');
  166.     Set_Global_Str('ISTR_4','Choice1(DATABOX)Choice2(DATABOX)Choice3(DATABOX)');
  167.     Set_Global_Int('IINT_4',2);
  168.     Set_Global_Str('IPARM_4','/T=Example of a menu field:          /TP=3/C=1/L=4/W=8/H=DATABOX');
  169.     Set_Global_Int('IINT_5',$3F);
  170.     Set_Global_Str('IPARM_5','/T=Example of a hex input field:     /C=1/L=5/W=4/H=DATABOX/TP=4' );
  171.     Set_Global_Str('ISTR_6','/F=Off/T=On');
  172.     Set_Global_Int('IINT_6',1);
  173.     Set_Global_Str('IPARM_6','/T=Example of a toggling field:      /TP=5/C=1/L=6/W=4/H=DATABOX');
  174.     Set_Global_Str('ISTR_7','Press <ENTER> to accept');
  175.     Set_Global_Str('IPARM_7','/T=Example of an accept:             /TP=6/C=1/L=7/W=21/H=DATABOX');
  176.     Run_Macro( 'USERIN^Data_In /#=7/S=1/A=2/X=10/Y=12/T=DATA_IN EXAMPLE' );
  177.         {If Return_Int > 0 then the Accept field was selected}
  178. END_MACRO;
  179.