Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog box with Time out. ?
#3
Here is something I whipped up real quick to give you an idea of how to accomplish this.

Code: (Select All)
Inputbox = _NEWIMAGE(300, 100, 32)
_DEST Inputbox
CLS , _RGB32(255, 255, 255)
LINE (5, 5)-(294, 94), _RGB32(127, 127, 127), BF
' YES button
LINE (50, 55)-(100, 85), _RGB32(192, 192, 192), BF
LINE (52, 57)-(98, 83), _RGB32(64, 64, 64), BF
' NO button
LINE (200, 55)-(250, 85), _RGB32(192, 192, 192), BF
LINE (202, 57)-(248, 83), _RGB32(64, 64, 64), BF
' text
COLOR _RGB32(255, 255, 255), _RGB32(127, 127, 127)
LOCATE 2, 11: PRINT "Pete For President?";
COLOR _RGB32(255, 255, 255), _RGB32(64, 64, 64)
LOCATE 5, 9: PRINT "YES";
LOCATE 5, 28: PRINT "NO";

SCREEN _NEWIMAGE(640, 480, 32)
CLS
FOR i = 10 TO 640 STEP 20 '      awesome background
    FOR j = 10 TO 480 STEP 20
        CIRCLE (i, j), 10
NEXT j, i
SLEEP 2
PCOPY 0, 1 '                     save current screen
Frames = 0
Answer$ = ""
DO '                                 display inputbox and get input
    _LIMIT 10
    WHILE _MOUSEINPUT: WEND
    _PUTIMAGE (170, 100), Inputbox ' restore inputbox image
    x = _MOUSEX: y = _MOUSEY
    IF x >= 220 AND x <= 270 AND y >= 155 AND y <= 185 THEN ' mouse over YES button
        LINE (220, 155)-(270, 185), _RGB32(0, 0, 0), B
        IF _MOUSEBUTTON(1) THEN Answer$ = "YES"
    END IF
    IF x >= 370 AND x <= 420 AND y >= 155 AND y <= 185 THEN ' mouse over NO button
        LINE (370, 155)-(420, 185), _RGB32(0, 0, 0), B
        IF _MOUSEBUTTON(1) THEN Answer$ = "NO"
    END IF
    Frames = Frames + 1
    _DISPLAY
LOOP UNTIL Answer$ <> "" OR Frames = 50 ' 5 second timer
_AUTODISPLAY
PCOPY 1, 0 '                              restore screen
IF Frames = 50 THEN Answer$ = "YES"
SLEEP 2
CLS
PRINT
PRINT " The chosen button was "; Answer$
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
Dialog box with Time out. ? - by ahenry3068 - 07-26-2024, 12:44 AM
RE: Dialog box with Time out. ? - by TerryRitchie - 07-26-2024, 05:14 AM
RE: Dialog box with Time out. ? - by TerryRitchie - 07-26-2024, 06:00 AM
RE: Dialog box with Time out. ? - by Pete - 07-26-2024, 07:16 AM
RE: Dialog box with Time out. ? - by hsiangch_ong - 07-26-2024, 04:24 PM



Users browsing this thread: 1 Guest(s)