wait with dialog

Creating complex macros, dialogs, solving complex tasks, programming.

wait with dialog

Postby jps01 on Mon Nov 06, 2017 12:01 am

Is it possible to use wait in conjunction with a dialog box? What I'd like to do is offer a dialog box to the user for some input, but if the users does not submit the input within 30 sec, close the box. Ideally it would be best to know nothing was submitted so default settings could be set automatically, but I can preset the defaults before offering the dialog so that's not really important.

at the moment there is this line of code which works fine, but waits until 'OK' or 'Cancel' is pressed to continue the script.

if(!ShowDialog(dd 0 &controls)) ret

Thanks for any help.
Posts: 26
Joined: Thu Jan 08, 2015 1:37 pm

Re: wait with dialog

Postby jps01 on Thu Nov 09, 2017 3:47 pm

I poked around and seems the only way to manage a timeout on a dialog box is to edit a system function which is not allowed. Any other ideas?
Posts: 26
Joined: Thu Jan 08, 2015 1:37 pm

Re: wait with dialog

Postby Gintaras on Fri Nov 10, 2017 8:35 pm

Function Dialog64     ?

str dd=
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;100 Static 0x54000000 0x0 8 100 208 13 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret

#sub DlgProc
function# hDlg message wParam lParam

int-- t_time

sel message
,t_time=10 ;;edit this if need
,SetTimer hDlg 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,if(t_time=0) clo hDlg
,,else SetDlgItemText hDlg 100 F"Will close after {t_time} s. Click here to stop the timer."
,case [WM_LBUTTONDOWN,WM_NCLBUTTONDOWN] ;;clicked a non-control part of the dialog
,KillTimer hDlg 1
,case WM_COMMAND goto messages2
sel wParam
,case IDOK
ret 1

Site Admin
Posts: 10386
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest