$MACRO_FILE EXAMPLE;
{******************************************************************************
This file contains examples of how to call the Multi-Edit user interface
macros.
******************************************************************************}


$MACRO EXAMPLE;
{******************************************************************************
                                MULTI-EDIT MACRO

Name:	EXAMPLE

Description:  Example of how to use the macro TOP_MENU to create a top level
							menu.

******************************************************************************}
	Set_Global_Str('TX_1','/H=FIXEDMENU/M=SUB_EXAMPLE1');
	Set_Global_Str('XTX_1','Example-1');
	Set_Global_Str('TX_2','/H=FIXEDMENU/M=SUB_EXAMPLE2');
	Set_Global_Str('XTX_2','Example-2');
	Set_Global_Str('TX_3','/H=FIXEDMENU/S=2/M=EXAMPLE_EXIT');
	Set_Global_Str('XTX_3','Exit-menu');

	Run_Macro('USERIN^TOPMENU /GCLR=1/M=XTX_/G=TX_/#=3/X=1/Y=2/S=1/BC=1/L=TOP_MENU EXAMPLE');

	return_int := 100;
END_MACRO;


$MACRO EXAMPLE_EXIT;
{This is truly a do-nothing macro}
END_MACRO;

$MACRO SUB_EXAMPLE1;
{******************************************************************************
                                MULTI-EDIT MACRO

Name:	SUB_EXAMPLE1

Description:  Example of how to use the macro SUB_MENU to create a sub level
							menu.

******************************************************************************}
	Set_Global_Str('SX_1','/H=FIXEDMENU/M=BAR_EXAMPLE');
	Set_Global_Str('XSX_1','XMENU horizontal example');
	Set_Global_Str('SX_2','/H=FIXEDMENU/M=VER_EXAMPLE');
	Set_Global_Str('XSX_2','XMENU Vertical example');
	Set_Global_Str('SX_3','/H=VARMENU/M=VAR_EXAMPLE');
	Set_Global_Str('XSX_3','DVMENU example');

	Run_Macro('USERIN^SUBMENU /GCLR=1/G=SX_/M=XSX_/#=3/S=1/L=SUB_MENU EXAMPLE 1/X=' +
		Parse_Str('/X=',MParm_Str) + '/Y=' + Parse_Str('/Y=',MParm_Str));

END_MACRO;

$MACRO BAR_EXAMPLE;
	Def_Int( kill_count );
	Run_Macro('USERIN^XMENU /B=1/X='+ Parse_Str('/X=',MParm_Str) + '/Y=' +
		Parse_Str('/Y=',MParm_Str) + '/S=1' +
		'/M=Choice1(FIXEDMENU)Choice2(FIXEDMENU)Choice3(FIXEDMENU)');
		{If an item was selected then kill of all of the other menus and
		 then put up a message}
	If (Return_Int > 0) THEN
		kill_count := Parse_Int('/BC=', mparm_str);
		While Box_Count > Kill_Count do
			Kill_Box;
		END;
		Make_Message('XMENU HORIZONTAL: Item ' + str(Return_Int) + ' was selected.');
	END;
END_MACRO;

$MACRO VER_EXAMPLE;
	Def_Int( kill_count );
	Run_Macro('USERIN^XMENU /T=1/B=1/X='+ Parse_Str('/X=',MParm_Str) + '/Y=' +
		Parse_Str('/Y=',MParm_Str) + '/S=1' +
		'/M=Choice1(FIXEDMENU)Choice2(FIXEDMENU)Choice3(FIXEDMENU)');
		{Return_Int will now be < 1 if <ESC> was hit, or it will equal the
		 number of the menu item that was selected}
		{If an item was selected then kill of all of the other menus and
		 then put up a message}
	If (Return_Int > 0) THEN
		kill_count := Parse_Int('/BC=', mparm_str);
		While Box_Count > Kill_Count do
			Kill_Box;
		END;
		Make_Message('XMENU VERTICAL: Item ' + str(Return_Int) + ' was selected.');
	END;
END_MACRO;

$MACRO VAR_EXAMPLE;
	Set_Global_Str('EXAMPLE1','Choice1()Choice2()Choice3()');
	Run_Macro('USERIN^DVMENU /P=EXAMPLE/B=1/K=1/X=' + Parse_Str('/X=',MParm_Str)
		+ '/Y=' + Parse_Str('/Y=',MParm_Str) + '/T=/C=1/D=1/M=1/H=VARMENU/O=1/W=15'
						+ '/#=1/U=1/I=%');
	Set_Global_Str('EXAMPLE1','');
		{Return_Int will now be < 1 if <ESC> was hit, or it will equal the
		 number of the menu item that was selected}
END_MACRO;

$MACRO SUB_EXAMPLE2;
{******************************************************************************
                                MULTI-EDIT MACRO

Name:	SUB_EXAMPLE2

Description:  Example of how to use the macro SUB_MENU to create a sub level
							menu.

******************************************************************************}
	Set_Global_Str('SX_1','/H=FIXEDMENU/M=QUE_EXAMPLE');
	Set_Global_Str('XSX_1','QUERY_BOX example');
	Set_Global_Str('SX_2','/H=FIXEDMENU/M=USE_EXAMPLE');
	Set_Global_Str('XSX_2','USER_STR example');
	Set_Global_Str('SX_3','/H=VARMENU/M=DAT_EXAMPLE');
	Set_Global_Str('XSX_3','DATA_IN example');

	Run_Macro('USERIN^SUBMENU /GCLR=1/G=SX_/M=XSX_/#=3/S=1/L=SUB_MENU EXAMPLE 2/X=' +
		Parse_Str('/X=',MParm_Str) + '/Y=' + Parse_Str('/Y=',MParm_Str));

END_MACRO;

$MACRO QUE_EXAMPLE;
	Def_Int( kill_count );

	Return_Str := 'EXAMPLE';
{Notice we are enabling the history list here with /HISTORY=}
	Run_Macro('USERIN^QUERYBOX /HISTORY=QUE_PASA/H=PROMPTS/C=' + Parse_Str('/X=',MParm_Str) +
	'/L=' + Parse_Str('/Y=',MParm_Str) +
	'/W=10/P=Enter whatever turns you on:/T=QUERYBOX EXAMPLE');

		{If the input was accepted then kill of all of the other menus and
		 then put up a message}
	If (Return_Int > 0) THEN
		kill_count := Parse_Int('/BC=', mparm_str);
		While Box_Count > Kill_Count do
			Kill_Box;
		END;
		Make_Message('The QUERYBOX was accepted');
	END;
END_MACRO;

$MACRO USE_EXAMPLE;

	Return_Str := 'EXAMPLE 1';
{Here again, the history list is enabled, and we have chosen to use the same
history name so that we can "share" with the QUERYBOX example.}
	Run_Macro('USERIN^USERSTR /HISTORY=QUE_PASA/H=PROMPTS/X=' + Parse_Str('/X=',MParm_Str) +
	'/BL=USERSTR EXAMPLE/Y=' + Parse_Str('/Y=',MParm_Str) +
	'/B=1/NK=1/L=20/W=10/P=      After you enter something here:  /T=USERSTR EXAMPLE');
	Return_Str := 'EXAMPLE 2';
	Run_Macro('USERIN^USERSTR /H=PROMPTS/X=' + Str(Parse_Int('/X=',MParm_Str) + 1) +
	'/Y=' + Str(Parse_Int('/Y=',MParm_Str) + 1) +
	'/L=20/W=10/P=Notice the next prompt uses the same box:/T=USERSTR EXAMPLE');
END_MACRO;

$MACRO DAT_EXAMPLE;
	Set_Global_Str('ISTR_1','STRING');
	Set_Global_Str('IPARM_1','/T=Example of a string input field:  /C=1/L=1/W=10/H=DATABOX');
	Set_Global_Int('IINT_2',100);
	Set_Global_Str('IPARM_2','/T=Example of an integer input field:/C=1/L=2/W=3/H=DATABOX/TP=1' );
	Set_Global_Str('ISTR_3','123.456');
	Set_Global_Str('IPARM_3','/T=Example of a real input field:    /C=1/L=3/W=7/H=DATABOX/TP=2');
	Set_Global_Str('ISTR_4','Choice1(DATABOX)Choice2(DATABOX)Choice3(DATABOX)');
	Set_Global_Int('IINT_4',2);
	Set_Global_Str('IPARM_4','/T=Example of a menu field:          /TP=3/C=1/L=4/W=8/H=DATABOX');
	Set_Global_Int('IINT_5',$3F);
	Set_Global_Str('IPARM_5','/T=Example of a hex input field:     /C=1/L=5/W=4/H=DATABOX/TP=4' );
	Set_Global_Str('ISTR_6','/F=Off/T=On');
	Set_Global_Int('IINT_6',1);
	Set_Global_Str('IPARM_6','/T=Example of a toggling field:      /TP=5/C=1/L=6/W=4/H=DATABOX');
	Set_Global_Str('ISTR_7','Hit <ENTER> to accept');
	Set_Global_Str('IPARM_7','/T=Example of an accept:             /TP=6/C=1/L=7/W=21/H=DATABOX');
	Set_Global_Str( 'IHELP1', '/L=8/C=12/H=อออ|24|25 to select, <Esc> to exit.อออ' );
	Set_Global_Str( 'IHELP2', '' );
	Run_Macro( 'USERIN^Data_In /#=7/S=1/A=2/X=10/Y=12/T=DATA_IN EXAMPLE' );
		{If Return_Int > 0 then the Accept field was selected}
END_MACRO;