Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
timeout for dialogs like in mes and input boxes
#1
Hi,
I thought this might have been answered before but couldn't find it.....(sorry if I missed it). Anyway, is there an easy way to add the timeout ability (countdown timer) on a user-created dialog box similar to the example below (for MES)?

MES m
m.style="YNCn"
m.x=100
m.y=1
m.timeout=15
m.default='C'
int i=mes("message" "title" m)

Thanks so much,
Stuart
#2
Function Dialog58
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54000800 0x0 10 112 34 10 "tim"
;4 Static 0x54000000 0x0 10 122 94 10 "Click to stop the countdown."
;END DIALOG
;DIALOG EDITOR: "" 0x2030000 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,SetTimer hDlg 1 1000 0
,
,case WM_TIMER
,int t=GetDlgItemInt(hDlg 3 0 0)
,t-1; if(t<=0) clo hDlg; ret
,SetDlgItemInt(hDlg 3 t 0)
,
,case WM_SETCURSOR
,if(lParam>>16=WM_LBUTTONDOWN) KillTimer hDlg 1
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Macro
Code:
Copy      Help
str controls = "3"
str e3tim
e3tim=5 ;;time
if(!ShowDialog("Dialog58" &Dialog58 &controls)) ret
#3
HI,

Can you post a simple dialog box with with just the countdown timer that runs a function when the countdown gets to 0.
#4
This function does it. Runs function clo. Replace the clo hDlg with your function call. Maybe remove case WM_SETCURSOR and next line.
#5
It runs clo hDlg repeatedly after countdown, how to do it once and show message "time Expired" in dialog?

Also need separate function to manually add more time to countdown..


thanks for your quick help with this so far!!
#6
Macro Macro300
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x54000000 0x0 8 108 48 10 ""
;4 Static 0x54000000 0x0 8 120 106 10 ""
;5 Button 0x54032000 0x0 120 96 96 14 "Set timer again"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "" "" "" ""

int timerSeconds=5
if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,sub.SetTimer hDlg timerSeconds
,
,case WM_TIMER
,timerSeconds-1
,if timerSeconds>0
,,SetDlgItemText hDlg 3 F"{timerSeconds}"
,else
,,sub.SetTimer hDlg 0
,,clo hDlg ;;or replace this code with your code
,
,case WM_SETCURSOR
,if(lParam>>16=WM_LBUTTONDOWN) KillTimer hDlg 1 ;;remove this if don't need to stop timer on click
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;Set timer again
,timerSeconds=10
,sub.SetTimer hDlg timerSeconds
,
,case IDOK
,case IDCANCEL
ret 1


#sub SetTimer
function hDlg seconds

;If seconds>0, sets timer. Else stops timer.

if seconds>0
,SetTimer hDlg 1 1000 0
,SetDlgItemText hDlg 3 F"{seconds}"
,SetDlgItemText hDlg 4 "Click to stop the countdown."
else
,KillTimer hDlg 1
,SetDlgItemText hDlg 3 ""
,SetDlgItemText hDlg 4 "Time expired."
#7
I have a suggestion to add a countdown parameter to the messagebox, dialog etc control function, which is sometimes useful.

Many process automation software message boxes have countdown parameters

Below is the code without the countdown parameter, which is a bit of a hassle.

Macro Macro7
Code:
Copy      Help
str s="hello world"
MES m
m.style="O";;style is ok button only see qm help for more info
m.timeout=5;;close after 5 seconds
m.default='O';;ok button is default
mes(s "TV" m)
#8
QM2:
MES m.timeout=5; mes("text" "" m)

QM3:
AuDialog.ShowEx("text", secondsTimeout: 5);
#9
It seems that QM3 is easier to understand.  Smile

In which month is it released? Tongue
#10
Unknown.
#11
I suggest that the main development direction of QM3 is robotic process automation, which is very promising. QM has many years of development experience. Idea

So far, I still think that QM2 is the most powerful process automation software, it is easier to use than the RPA software of other companies in the world, for example, uipath, winautomation, etc.  Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)