Post by Admin on Dec 30, 2019 6:43:23 GMT
Put this example either in BBC BASIC FOR WINDOWS or BBCSDL
FNabutton(x,y,size,"color","message")
x,y- is the location on the screen you want to put the button
size- is the size of the button (width and height
"color" is the color you want to make the button border and the FILL color if you specify
"message" is the message that FNabutton returns to the user if you click it with your left mouse button
(you can change "message" to anything. Basically, I used "message" to name the button..
Kind of like object orientated programming? (maybe)
* please use HELP in BBC BASIC if you do not understand FN use. Or you can look closely at the program to
see what the command is interacting with..
FNabutton(x,y,size,"color","message")
x,y- is the location on the screen you want to put the button
size- is the size of the button (width and height
"color" is the color you want to make the button border and the FILL color if you specify
"message" is the message that FNabutton returns to the user if you click it with your left mouse button
(you can change "message" to anything. Basically, I used "message" to name the button..
Kind of like object orientated programming? (maybe)
* please use HELP in BBC BASIC if you do not understand FN use. Or you can look closely at the program to
see what the command is interacting with..
MODE 8
GCOL 15
PRINT" USE YOUR MOUSE TO CLICK ON THE BUTTON"
REM the next line sends a command to the button to fill it with the color 13
REM this should be done before the main part of your program so only the current names for buttons are being tested
r$=FNabutton(100,100,50,"13","fill")
REPEAT
r$=FNabutton(100,100,50,"13","message")
WAIT 10
IF r$="message" THEN PRINT "YOU clicked on the button with your mouse!!"
UNTIL FALSE
END
REM FNabutton added October 22 2017 (modified December 29, 2019)
DEFFNabutton(x,y,size%,c$,com$)
MOUSE mx,my,mb
LOCAL ret$
GCOL 5
RECTANGLE x,y,size%,size%
IF com$="fill" THEN
GCOL VAL(c$)
FILL x+5,y+5
ENDIF
IF mx>x AND mx<x+size% AND my>y AND my<y+size% THEN
GCOL 15: RECTANGLE x,y,size%,size%
IF mb=4 THEN ret$=com$
ENDIF
=ret$