Dialog box with Time out. ? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Dialog box with Time out. ? (/showthread.php?tid=2885) |
Dialog box with Time out. ? - ahenry3068 - 07-26-2024 Can I do a Yes/No Dialog box with a time out (say pick the default value if the user doesn't choose within a specific interval) ? RE: Dialog box with Time out. ? - TerryRitchie - 07-26-2024 (07-26-2024, 12:44 AM)ahenry3068 Wrote: Can I do a Yes/No Dialog box with a time out (say pick the default value if the user doesn't choose within a specific interval) ?Sure. Pcopy your screen to another page, draw your dialog box and yes/no buttons, and then have code that checks for mouse input along with a timer. When the timer runs out Pcopy the other page back to your screen to remove the dialog box and choose the default value. RE: Dialog box with Time out. ? - TerryRitchie - 07-26-2024 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) RE: Dialog box with Time out. ? - Pete - 07-26-2024 I found one error in Terry's code... Code: (Select All) LOCATE 5, 28: PRINT "NO"; Code: (Select All) LOCATE 5, 28: PRINT "HELL YES"; Basically the IDE uses this pcopy method for all of the drop-down menus. Things that take very creative solutions are timers for INPUT and _MESSAGEBOX. These pause your program until a reply is made. The way around that is to make two programs. Program 1 calls the second _MESSAGEBOX program via a SHELL statement. When the timer in program 1 runs out, the message box is terminated by a SHELL to TASKKILL. You also need a small database to communicate, or a TCP/IP connection. _SCREENHIDE, Win32 AP minimization, etc. can be used to make it seem like only one program is running. Pete RE: Dialog box with Time out. ? - SpriggsySpriggs - 07-26-2024 You could do task dialogs, too. RE: Dialog box with Time out. ? - hsiangch_ong - 07-26-2024 it could probably be done with _messagebox. if the user didn't have to supply an answer, then _notifydialog is good enough. if not, on linux could use Zenity or probably Yad. Yad is more complicated for me. either one is an external separate program which will require using shell _hide. this is from man zenity. the last item has the most interest. Quote:General optionsalso the type of dialog. (choose yes or no) Quote:--questionone disadvantage is that Zenity might not be installed with linux distribution "by default." Yad is present in even fewer distributions such as endeavouros. |