Sample program for creating and using the DRAWMENU command
|
04-10-2015, 07:10 PM
Post: #3
|
|||
|
|||
RE: Sample program for creating and using the DRAWMENU command
Here's a little test program that uses a loop:
//softmenu-DRAWMENU demo softmenu(mx, my, n); keyup(); keydown(); EXPORT softmen() BEGIN LOCAL menu, tmp, m, m1, mx, my; RECT(); DRAWMENU("1","2","3","4","5","Exit"); TEXTOUT_P("PRESS A MENU KEY...",0, 20); WAIT(2); keydown(); m:= MOUSE; m1:= m(1); my:= m1(2); mx:= m1(1); menu:= softmenu(mx, my, 6); WHILE menu < 6 DO IF menu > -1 THEN RECT_P(G0, 0, 40, 319, 219); DRAWMENU("1","2","3","4","5","Exit"); TEXTOUT_P("Pressed: "+menu, 0, 100); END; keyup(); mx:= keydown(); IF mx == -1 THEN my:= 0; ELSE my:= 240; END; menu:= softmenu(mx, my, 6); END; END; softmenu(x, y, n) BEGIN LOCAL m; m:= -1; IF y >= 220 THEN CASE IF 0 <= x <= 51 THEN m:= 1; END; IF 53 <= x <= 104 THEN m:= 2; END; IF 106 <= x <= 157 THEN m:= 3; END; IF 159 <= x <= 210 THEN m:= 4; END; IF 212 <= x <= 263 THEN m:= 5; END; IF 265 <= x <= 319 THEN m:= 6; END; DEFAULT m:=0; END; IF m > n THEN m:=0; END; END; RETURN m; END; keyup() BEGIN LOCAL m, m1; m:= MOUSE; m1:= m(1); WHILE SIZE(m1) > 0 DO m:= MOUSE; m1:= m(1); END; END; keydown() BEGIN LOCAL m, m1, mx, k; m:= MOUSE; m1:= m(1); WHILE SIZE(m1) == 0 DO m:= MOUSE; m1:= m(1); END; k:= m1(1); IF m1(2) < 220 THEN k:= -1; END; RETURN k; END; |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Sample program for creating and using the DRAWMENU command - kharpster - 04-09-2015, 05:00 PM
RE: Sample program for creating and using the DRAWMENU command - compsystems - 04-10-2015, 11:52 AM
RE: Sample program for creating and using the DRAWMENU command - John Colvin - 04-10-2015 07:10 PM
RE: Sample program for creating and using the DRAWMENU command - kharpster - 04-11-2015, 04:42 AM
RE: Sample program for creating and using the DRAWMENU command - Thomas_Sch - 04-11-2015, 09:25 AM
RE: Sample program for creating and using the DRAWMENU command - kharpster - 04-11-2015, 02:41 PM
RE: Sample program for creating and using the DRAWMENU command - Thomas_Sch - 04-11-2015, 03:07 PM
RE: Sample program for creating and using the DRAWMENU command - kharpster - 04-11-2015, 07:26 PM
|
User(s) browsing this thread: 1 Guest(s)