Touchscreen menu system code help needed
RinksCustoms
Posts: 531
Hello all,
i come with an interesting bit of code. It's for a mfancy menu system i'm developing. It shouldbe fairly basic in opperation, and i've been pummeling my head into wall trying any way i can think of to get this now numeric (1,2,3,4) multi-level menu system to work. This is what i have so far, if your so enclined to assist I attached the scource.
For some reason i cannot figure out, the primary menu "buttons" appear, but when you make selection 1 off the primary menu, the selected submenu title bar and background display correctly, but all but the fourth menu "button" doesn't display. The menu system is setup so that pressing "1" will select the upper left button, pressing "2" will select the upper right "button",pressing "3" will select the lower left button, and pressing"4" will select the lower right button. I know the menu structure isn't fully complete, i'm wondering why the buttons on the submenu won't print to the debug correctly. Thanx in advance for any help pointing out my idiocracy,
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Definetly a E3 (Electronics Engineer Extrodinare!)
"I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
i come with an interesting bit of code. It's for a mfancy menu system i'm developing. It shouldbe fairly basic in opperation, and i've been pummeling my head into wall trying any way i can think of to get this now numeric (1,2,3,4) multi-level menu system to work. This is what i have so far, if your so enclined to assist I attached the scource.
For some reason i cannot figure out, the primary menu "buttons" appear, but when you make selection 1 off the primary menu, the selected submenu title bar and background display correctly, but all but the fourth menu "button" doesn't display. The menu system is setup so that pressing "1" will select the upper left button, pressing "2" will select the upper right "button",pressing "3" will select the lower left button, and pressing"4" will select the lower right button. I know the menu structure isn't fully complete, i'm wondering why the buttons on the submenu won't print to the debug correctly. Thanx in advance for any help pointing out my idiocracy,
Mike
' {$STAMP BS2} ' {$PBASIC 2.5} ' {$PORT COM1} x VAR Byte y VAR Byte xloc VAR Byte yloc VAR Byte menu VAR Nib sub_menu VAR Byte title VAR Byte temp VAR Word cnt VAR Word char VAR Byte x_mem VAR Word xa_mem VAR Word xb_mem VAR Word xc_mem VAR Word xd_mem VAR Word x =0 y =0 xloc =0 yloc =0 menu =0 sub_menu=0 title =0 temp =0 cnt =0 char =0 x_mem =0 xa_mem =0 xb_mem =0 xc_mem =0 xd_mem =0 '-------------------------------------------------------------------------------------------------------------------------------- DATA " LASC ","X-Over ","PWR OPT"," N/A ", " Input ","Output ","Frq Tap"," Trigg ", " Low "," Mid "," High "," Full ", " Bank1 "," Bank2 "," Bank3 "," Bank4 ", " Type "," 1-way "," 2-way "," 3-way ", "Ctr Frq","Quality"," Level "," ", " Alarm "," LVPD ","AutoI/O"," ", "Main Menu",0,"L.A.S.C. Menu",0,"X-over Menu",0,"Power Options",0,'----------------------title bars CRSRXY,0,4,CLRDN, '--------------------------------------------------------------------------fine adjust background " ____ 0 ____ ",CR, " - ___________ +",0, CLS,CRSRXY,7,1,"[noparse][[/noparse]]",CRSRXY,7,2,"[noparse][[/noparse]]",CRSRXY,0,3,"----------------",CRSRXY,7,4,"[noparse][[/noparse]]",CRSRXY,7,5,"[noparse][[/noparse]]" '------------------------------------------------------------------------------------------------------------------------------- wait_for_invoke: DEBUG CLS,"Press a key ",CR,"to bring up menu" DEBUGIN DEC1 temp PAUSE 50 IF (temp <>0) THEN temp=0 : GOTO invoke IF (temp=0) THEN GOTO wait_for_invoke invoke: xa_mem = $0 : xb_mem = $7 : xc_mem = $E : xd_mem = $15 '-------------------------------main menu buttons/background/title bar title = $C4 print_menu: '-----------------------------------------------------------------------------bring up menu system temp=0 FOR cnt = $F6 TO $143 '-----------------------------------------------print background READ cnt,char DEBUG char NEXT DEBUG HOME titlebar: '-----------------------------------------------print title bar x_mem =0 temp = 16 + title FOR cnt = title TO temp READ cnt,char IF (char=0)THEN EXIT DEBUG char x_mem = x_mem + 1 NEXT temp = 0 PAUSE 25 '-------------------------------------------------------------FILL remaining title bar temp = 16 - x_mem FOR x_mem = 1 TO temp STEP 2 DEBUG "_ " NEXT '---------------------------------------------------------------------print buttons temp=0 FOR cnt = 0 TO 3 LOOKUP xloc,[noparse][[/noparse]0,9,0,9],x LOOKUP yloc,[noparse][[/noparse]2,2,5,5],y DEBUG CRSRXY, x,y IF (x=0 AND y=2)THEN x_mem = xa_mem IF (x=9 AND y=2)THEN x_mem = xb_mem IF (x=0 AND y=5)THEN x_mem = xc_mem IF (x=9 AND y=5)THEN x_mem = xd_mem FOR temp = 1 TO 7 READ x_mem,char DEBUG char x_mem = x_mem + 1 NEXT xloc = xloc + 1 yloc = yloc + 1 NEXT '----------------------------------------------------------------------------get menu input wait_for_menu: sub_menu =0 IF (menu > 0) THEN GOTO wait_for_sub_menu DO UNTIL (menu <>0) DEBUGIN DEC1 menu IF (menu<>0)THEN GOTO decode_menu PAUSE 100 LOOP wait_for_sub_menu: sub_menu =0 DO UNTIL (sub_menu <>0) DEBUGIN sub_menu IF (sub_menu <> 0) THEN GOTO decode_menu PAUSE 100 LOOP decode_menu:'--------------------------------------------- decide which menu to print next IF (menu >0 AND sub_menu =0) THEN SELECT menu CASE 1 xa_mem = $1d xb_mem = $23 xc_mem = $2a xd_mem = $31 title = $ce PAUSE 25 GOTO print_menu CASE ELSE DEBUG CLS,"Menu not made" PAUSE 2000 GOTO wait_for_invoke ENDSELECT ELSEIF (menu > 0 AND sub_menu > 0) THEN SELECT sub_menu CASE 1 xa_mem =$38 xb_mem =$3f xc_mem =$45 xd_mem =$4c title =$ce PAUSE 25 GOTO print_menu CASE ELSE DEBUG CLS, "menu not made" PAUSE 2000 GOTO wait_for_invoke ENDSELECT ENDIF PAUSE 2000 DEBUG CLS END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Definetly a E3 (Electronics Engineer Extrodinare!)
"I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"