It might look like a lot to do, but its not. Once you learn it, it goes fast. You can create a full working Menu that
uses the Mouse and the Keyboard in just minutes instead of hours.
Below is the Code that this tutor generated.
Because of the wordwrapping, the screen code will display funny here, but when you copy it, it will straighten out in
the PBCC editor and not look so bad.
#INCLUDE "C:\PBCC40\WINAPI\WIN32API.INC"
SUB Putz(BYVAL Lside AS LONG, BYVAL Rside AS LONG, _
BYVAL Top AS LONG, BYVAL Bottom AS LONG, scr
AS STRING)
LOCAL lpReadRegion AS SMALL_RECT, sBuffer AS STRING
LOCAL x AS LONG,
Length AS LONG
Length = LEN(scr)
FOR x = 1 TO Length
sBuffer = sBuffer + MID$(scr, X&, 1)+ CHR$(32)
NEXT x
lpReadRegion.xLeft =
Lside - 1
lpReadRegion.xRight = Rside - 1
lpReadRegion.xTop = Top - 1
lpReadRegion.xBottom = Bottom - 1
WriteConsoleOutPut GetStdHandle(%STD_OUTPUT_HANDLE), BYVAL STRPTR(sBuffer),
_
BYVAL MAKDWD((Rside+1)-Lside, (Bottom+1)-Top), BYVAL 0&, lpReadRegion
scr
= ""
END SUB
SUB U_NameIt
LOCAL Scn AS STRING
Scn = "‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡€"
_
+ "‡ ‡€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
‡€" _
+ "‡ ‡€ € € € € € € € € €
€ € € € € € € € € € € € € € € €
€ € €‡‡‡‡‡‡‡‡‡‡‡‡‡‡€
€ € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € €‡ ‡€"
_
+ "‡ ‡€ € € € € € € € € € € €
€ € € € € € € € € € € € € € € €
€‡ ‡ M e n u ‡ ‡ ‡€ € € € € € €
€ € € € € € € € € € € € € € € €
€ € € € € € € €‡ ‡€" _
+ "‡ ‡€
€ € € € € € € € € € € € € € € €
€ € € € € € € € € € € €‡€€€€€€€€€€€€€€
€ € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € €‡ ‡€"
_
+ "‡ ‡€ € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € €
€ € € € € € € € € € € € €‡ ‡€"
_
+ "‡ ‡€ € x € x
x x ‡ ‡€" _
+ "‡
‡€ € Aq qFqiqrqsqtq x € Eq x Ž Ž Iq
x Mq x ‡ ‡€" _
+ "‡ ‡€
€ xxxxxxxxxxxxxx € xxxxxxxxxxxxxx Ž Ž xxxxxxxxxxxxxx
xxxxxxxxxxxxxx ‡ ‡€" _
+ "‡ ‡€ € €
€ € € € € € € Ž Ž
€ € € € € € € € ‡
‡€" _
+ "‡ ‡€ € x x
Ž Ž x x ‡ ‡€" _
+
"‡ ‡€ € Bq Sqeqcqoqnqdq x € Fq x Ž Ž
Jq x Ž Ž Nq x €‡ ‡€" _
+
"‡ ‡€ € xxxxxxxxxxxxxx € xxxxxxxxxxxxxx xxxxxxxxxxxxxx
xxxxxxxxxxxxxx € €‡ ‡€" _
+ "‡ ‡€ €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € €‡ ‡€" _
+ "‡ ‡€ € x
€ x x x €
€‡ ‡€" _
+ "‡ ‡€ € Cq Tqhqiqrqdq x €
Gq x Kq x Oq x € €‡
‡€" _
+ "‡ ‡€ € xxxxxxxxxxxxxx € xxxxxxxxxxxxxx
xxxxxxxxxxxxxx xxxxxxxxxxxxxx € €‡ ‡€" _
+
"‡ ‡€ € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € €‡ ‡€" _
+ "‡ ‡€ €
x € x x x
€ €‡ ‡€" _
+ "‡ ‡€ € Dq Eqtqcq.q x €
Hq x Lq x Pq x € €‡
‡€" _
+ "‡ ‡€ € xxxxxxxxxxxxxx € xxxxxxxxxxxxxx
€ € xxxxxxxxxxxxxx € € xxxxxxxxxxxxxx € €‡ ‡€"
_
+ "‡ ‡€ € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € €
€ € € € € € € € € € € €‡ ‡€" _
+
"‡ ‡€ € €
€ € € € € € € € € € € € €
€ € € € € € € €‡ ‡€" _
+ "‡ ‡€‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡‡
‡€" _
+ "‡€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€"
Putz 1, 79, 1, 25, Scn
END SUB
SUB GetKey (Keynumber&, char$, Rgt&,
Lft&, Row&, Col&)
char$ ="": Keynumber& = 0
Rgt&
= 0 : Lft& = 0
front:
char$ = WAITKEY$
IF ASC(char$, 4) <>
1 AND ASC(char$, 4) <> 2 THEN
Keynumber& = CVI(char$ + CHR$(0))
EXIT SUB
END IF
IF ASC(char$, 4) = 1 THEN Lft& = 1 : char$ = ""
IF ASC(char$, 4) = 2 THEN Rgt& = 2 : char$ = ""
IF Lft& = 0 AND Rgt& =
0 THEN GOTO front
Row& = MOUSEY : Col& = MOUSEX
END SUB
FUNCTION PBMAIN
MOUSE ON : MOUSE 7, DOUBLE, DOWN : SLEEP 10
CONSOLE SCREEN 25, 79
' Uncomment if you want to adjust window to Menu size
CURSOR OFF
' And the area you selected started at Row 1 and column 1
U_NameIt
DO
GetKey Keynumber&, char$, Rgt&, Lft&, Row&, Col&
IF char$ = "" THEN
IF row& = 8 AND col& > 6 AND col& < 20 THEN MLabel$
= "A First"
IF row& = 12 AND col& > 6 AND col& < 20 THEN MLabel$ = "B
Second"
IF row& = 16 AND col& > 6 AND col& < 20 THEN MLabel$ = "C Third"
IF row& = 20 AND col& > 6 AND col& < 20 THEN MLabel$ = "D Etc."
IF row&
= 8 AND col& > 24 AND col& < 38 THEN MLabel$ = "E"
IF row& = 12 AND col&
> 24 AND col& < 38 THEN MLabel$ = "F"
IF row& = 16 AND col& > 24 AND col&
< 38 THEN MLabel$ = "G"
IF row& = 20 AND col& > 24 AND col& < 38 THEN MLabel$
= "H"
IF row& = 8 AND col& > 42 AND col& < 56 THEN MLabel$ = "I"
IF row& = 12 AND col& > 42 AND col& < 56 THEN MLabel$ = "J"
IF row& = 16
AND col& > 42 AND col& < 56 THEN MLabel$ = "K"
IF row& = 20 AND col& >
42 AND col& < 56 THEN MLabel$ = "L"
IF row& = 8 AND col& > 60 AND col& <
74 THEN MLabel$ = "M"
IF row& = 12 AND col& > 60 AND col& < 74 THEN MLabel$
= "N"
IF row& = 16 AND col& > 60 AND col& < 74 THEN MLabel$ = "O"
IF row& = 20 AND col& > 60 AND col& < 74 THEN MLabel$ = "P"
ELSE
MLabel$ = UCASE$(char$)
END IF
SELECT CASE MLabel$
CASE "A First", "A"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "B Second", "B"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "C Third", "C"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "D Etc.", "D"
LOCATE 1, 30 : PRINT
"You clicked on "& MLabel$
CASE "E"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "F"
LOCATE 1, 30 : PRINT "You clicked on "&
MLabel$
CASE "G"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "H"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "I"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "J"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "K"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "L"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "M"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "N"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "O"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
CASE "P"
LOCATE 1, 30 : PRINT "You clicked on "& MLabel$
END SELECT
LOOP UNTIL Keynumber& =
27
END FUNCTION