Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RES 3700 Sim/ISL Help 1

Status
Not open for further replies.

NathanJ

Technical User
Oct 5, 2018
4
GB
Hi Guys,

I want to create a Sim file that when you press the PAY pops up and says would you like a BOX.

event inq : 1


window 6, 55
display 1, 2, "Would You Like To Add Any Takeaway Boxes To This Order"
display 4, 2, ""
display 5, 2, " Yes OR No "
display 6, 2, ""
touchscreen 20309

endon

endevent

-- I'm struggling get the correct end command i have attempted endon / endfor / endwith and endin
can anyone help please.

(I have attached what it looks like to help)

Thanks, Nathan
 
 https://files.engineering.com/getfile.aspx?folder=a485fb44-7368-46e8-9e65-e060c5011ade&file=TA_BOX.JPG
I would suggest something like this:

Code:
EVENT INQ : 1
[indent]VAR ANSWER : N1[/indent]
[indent]CALL GET_YES_NO(ANSWER, "Would you like to add any takeaway boxes to this order?")[/indent]
[indent]IF ANSWER = 1[/indent]
[indent][indent]//DO SOMETHING HERE WHEN THEY HIT YES[/indent][/indent]
[indent]ENDIF[/indent]
ENDEVENT
SUB GET_YES_NO( REF ANSWER, VAR MESSAGE : A78 )
	CLEARISLTS
		SETISLTSKEYX 2, 10, 4, 4, 2, @KEY_ENTER, 10059, "LEFT", 10, "YES"
		SETISLTSKEYX 2, 16, 4, 4, 2, @KEY_CLEAR, 10058, "LEFT", 10, "NO"
		SETISLTSKEYX 11, 12, 2, 6, 2, @KEY_CANCEL, 10392, "LEFT", 10, "CANCEL"
	DISPLAYISLTS
	
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEY_PRESS : KEY
	VAR DATA : A20
	INPUTKEY KEY_PRESS, DATA, MESSAGE
	
	IF KEY_PRESS = @KEY_ENTER
		ANSWER = 1
	ELSEIF KEY_PRESS = @KEY_CANCEL
		EXITCONTINUE
	ELSE
		ANSWER = 0
	ENDIF
	WINDOWCLOSE
ENDSUB
 
If you're interested, here are just some basic functions I have in a file I include in my more complicated ISL files:

Code:
VAR SQL_H       : N12 = 0
VAR SQL_CMD     : A2000
VAR NEXT_PAGE_KEY : KEY = KEY(1,2)
VAR PREV_PAGE_KEY : KEY = KEY(1,1)






//////////////////////////////////////////////////
///////////    FORMAT/LOG FUNCTIONS   ////////////
//////////////////////////////////////////////////


SUB LOG_MESSAGE( VAR FILE : A200, VAR MESSAGE : A5000 )
	VAR FN : N5
	FOPEN FN, FILE, APPEND
	FWRITELN FN, MESSAGE
	FCLOSE FN
ENDSUB

SUB PAD_LINE( REF OUT, VAR LINE : A40)
	VAR PADDING : A40 = "                                        "
	FORMAT OUT AS MID(PADDING,1,(32-LEN(LINE))/2.0), LINE 	
ENDSUB


//////////////////////////////////////////////////
///////////       INPUT FUNCTIONS     ////////////
//////////////////////////////////////////////////
SUB GET_YES_NO( REF ANSWER, VAR MESSAGE : A78 )
	CLEARISLTS
		SETISLTSKEYX 2, 10, 4, 4, 2, @KEY_ENTER, 10059, "LEFT", 10, "YES"
		SETISLTSKEYX 2, 16, 4, 4, 2, @KEY_CLEAR, 10058, "LEFT", 10, "NO"
		SETISLTSKEYX 11, 12, 2, 6, 2, @KEY_CANCEL, 10392, "LEFT", 10, "CANCEL"
	DISPLAYISLTS
	
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEY_PRESS : KEY
	VAR DATA : A20
	INPUTKEY KEY_PRESS, DATA, MESSAGE
	
	IF KEY_PRESS = @KEY_ENTER
		ANSWER = 1
	ELSEIF KEY_PRESS = @KEY_CANCEL
		EXITCONTINUE
	ELSE
		ANSWER = 0
	ENDIF
	WINDOWCLOSE
ENDSUB

SUB GET_INPUT( REF ANSWER, VAR MESSAGE : A78, VAR TS_SCRN : N9 )
	VAR CENTER : N3 = (78-LEN(MESSAGE))/2
	WINDOW 3,78
	DISPLAY 2, CENTER, MESSAGE
	
	VAR KEYPRESS : KEY
	IF TS_SCRN > 0
		TOUCHSCREEN TS_SCRN
	ENDIF
	INPUTKEY KEYPRESS, TIPAMT, MESSAGE
	WINDOWCLOSE
ENDSUB

SUB SHOWPAGINATIONKEYS( VAR RESULTSPERPAGE : N4, VAR RESULTSIZE : N4, VAR CURRENTPAGE : N4, REF NAMES[], REF OBJNUMS[] )

	CLEARISLTS
	
	WHILE (CURRENTPAGE - 1) * RESULTSPERPAGE + 1 > RESULTSIZE AND CURRENTPAGE > 1
		CURRENTPAGE = CURRENTPAGE - 1
	ENDWHILE

	VAR NUMPAGES : N5 = 1
	WHILE NUMPAGES*RESULTSPERPAGE < RESULTSIZE
		NUMPAGES = NUMPAGES + 1
	ENDWHILE

	VAR KEYHEIGHT : N1 = 6
	VAR KEYWIDTH : N1 = 30 / (ResultsPerPage / 2)
	
	VAR FIRSTITEM : N5 = (CURRENTPAGE - 1) * RESULTSPERPAGE + 1
	
	VAR I : N5

	FOR I = FIRSTITEM TO FIRSTITEM + RESULTSPERPAGE / 2 - 1
		IF I > RESULTISIZE
			BREAK
		ENDIF
		SETISLTSKEYX 1, (I - FIRSTITEM) * KEYWIDTH + 1, 3, KEYWIDTH, 1, KEY(1, OBJNUMS[ I ]), 0, "C", 1, NAMES[I]
	ENDFOR

	FOR I = I TO FIRSTITEM + RESULTSPERPAGE
		IF I > RESULTSIZE
			BREAK
		ENDIF
		SETISLTSKEYX 4, (I - FIRSTITEM - RESULTSPERPAGE / 2) * KEYWIDTH + 1, 3, KEYWIDTH, 1, KEY(1, OBJNUMS[I]), 0, "C", 1, NAMES[I]
	ENDFOR

	IF CURRENTPAGE > 1
		SETISLTSKEYX 11, 1, 2, 2, 1, PREV_PAGE_KEY, 10388, "C", 10, ""
	ENDIF
	IF CURRENTPAGE < NUMPAGES
		SETISLTSKEYX 11, 3, 2, 2, 1, NEXT_PAGE_KEY, 10389, "C", 10, ""
	ENDIF
	
	SETISLTSKEYX 9, 27, 4, 4, 1, @KEY_CLEAR, 10058, "L", 10, "Done/Exit"
	
	DISPLAYISLTS

ENDSUB

SUB SHOWISLKEYBOARD( VAR KEYBOARD_WIDTH : N2, VAR KEYBOARD_HEIGHT : N2)

	CLEARISLTS

	VAR X : N2 = (30 - (10 * KEYBOARD_WIDTH)) / 2
	VAR Y : N2 = 12 - (KEYBOARD_HEIGHT * 3) + 1

	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 0),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,81),0,"C",10,"Q"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 1),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,87),0,"C",10,"W"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 2),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,69),0,"C",10,"E"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 3),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,82),0,"C",10,"R"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 4),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,84),0,"C",10,"T"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 5),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,89),0,"C",10,"Y"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 6),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,85),0,"C",10,"U"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 7),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,73),0,"C",10,"I"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 8),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,79),0,"C",10,"O"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 9),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,80),0,"C",10,"P"

	X = (30 - (10 * KEYBOARD_WIDTH)) / 2 + 1
	Y = 12 - (KEYBOARD_HEIGHT * 2) + 1

	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 0),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,65),0,"C",10,"A"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 1),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,83),0,"C",10,"S"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 2),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,68),0,"C",10,"D"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 3),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,70),0,"C",10,"F"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 4),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,71),0,"C",10,"G"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 5),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,72),0,"C",10,"H"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 6),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,74),0,"C",10,"J"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 7),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,75),0,"C",10,"K"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 8),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,76),0,"C",10,"L"

	X = (30 - (10 * KEYBOARD_WIDTH)) / 2 + 2
	Y = 12 - (KEYBOARD_HEIGHT * 1) + 1

	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 0),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,90),0,"C",10,"Z"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 1),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,88),0,"C",10,"X"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 2),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,67),0,"C",10,"C"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 3),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,86),0,"C",10,"V"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 4),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,66),0,"C",10,"B"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 5),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,78),0,"C",10,"N"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 6),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,77),0,"C",10,"M"
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 8),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,91),10072,"C",10,""
	SETISLTSKEYX Y,X + (KEYBOARD_WIDTH * 7),KEYBOARD_HEIGHT,KEYBOARD_WIDTH,1,KEY(1,92),0,"C",39,"|__|"
	SETISLTSKEYX 9,27,4, 4, 1, @Key_Clear, 10058, "L", 10, "Done/Exit"
	
	DISPLAYISLTS

ENDSUB


/////////////////////////////////////////////////
///////////        SQL FUNCTIONS      ///////////
/////////////////////////////////////////////////


SUB LOADSQL
	CALL LOADDLL
	CALL OPENSQL
ENDSUB

SUB LOADDLL
	IF SQL_H = 0
		DLLLOAD SQL_H, "MDSSysUtilsProxy.dll"
	ENDIF
ENDSUB

SUB OPENSQL
	IF SQL_H = 0
		RETURN
	ENDIF
	VAR CON_STATUS : N9
	DLLCALL_CDECL SQL_H, sqlIsConnectionOpen( REF CON_STATUS )
	IF CON_STATUS = 0
		DLLCALL_CDECL SQL_H, sqlInitConnection("micros", "ODBC;UID=custom;PWD=custom", "")
	ENDIF
ENDSUB

SUB SQL_QUERY( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( SQL_CMD )
	
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
	
	DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB SQL_EXEC( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlExecuteQuery( SQL_CMD )
	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		ERRORMESSAGE "SQL ERROR: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_RECORDSET( REF SQL_CMD )
	DLLCALL_CDECL SQL_H, sqlGetRecordSet( sql_cmd )

	SQL_CMD = ""
	DLLCALL_CDECL SQL_H, sqlGetLastErrorString( REF SQL_CMD )
	IF SQL_CMD <> ""
		EXITWITHERROR "SQL Error: ", SQL_CMD
	ENDIF
ENDSUB

SUB SQL_NEXTRECORD( REF SQL_CMD )
		DLLCALL_CDECL SQL_H, sqlGetNext( REF SQL_CMD )
ENDSUB

SUB CLOSESQL
   IF SQL_H <> 0
         DLLCALL_CDECL SQL_H, sqlCloseConnection()
	 DLLFREE SQL_H
   ENDIF
   SQL_H = 0
ENDSUB
 
Hi Moregelen,

Thanks for your help on this i shall be spending some time trying to get this code working on Friday.

Thanks, Nath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top