Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog countdown run command
#1
Hello,

I added a countdown to the dialog, how to achieve a countdown to 0, Execution button run  Smile



Macro Dialog countdown
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Static 0x54000000 0x0 108 52 12 13 ""
;4 Button 0x54032000 0x0 88 72 48 14 "run"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam
str s
int- t=5
sel message
,case WM_INITDIALOG

,SetTimer hDlg 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,t-1
,,s=t; s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;run
,mes "autorun ok"
ret 1
#2
something like this
 
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Static 0x54000000 0x0 108 52 12 13 ""
;4 Button 0x54032000 0x0 88 72 48 14 "run"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam
str s
int- t=5
sel message
,case WM_INITDIALOG

,SetTimer hDlg 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,if t>0
,,,t-1
,,else
,,,KillTimer hDlg 1
,,,SendMessage hDlg WM_COMMAND 4 0 
,,s=t; s.setwintext(id(3 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 ;;run
,mes "autorun ok"
ret 1
#3
Thanks, the reply is too fast. Wink

How to achieve, freeze countdown when moving or clicking on a window  Huh

Message box is achievable

Macro Macro3
Code:
Copy      Help
MES m.timeout=5; m.style="OCa"; m.default='C'
sel mes("text" "title" m)
,case 'O'
,mes 1
,case 'C'
,mes 0
#4
ok last one i'm off to sleep


Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Static 0x54000000 0x0 108 52 12 13 ""
;4 Button 0x54032000 0x0 88 72 48 14 "run"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

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


#sub DlgProc
function# hDlg message wParam lParam
str s
int- t=5
sel message
,case WM_INITDIALOG

,SetTimer hDlg 1 1000 0
,case WM_TIMER
,sel wParam
,,case 1
,,if t>1
,,,t-1
,,else
,,,KillTimer hDlg 1
,,,SendMessage hDlg WM_COMMAND 4 0 
,,s=t; s.setwintext(id(3 hDlg))
,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 IDOK
,case IDCANCEL
,case 4 ;;run
,mes "autorun ok"
ret 1
#5
Thanks, good dreams  Smile


Forum Jump:


Users browsing this thread: 3 Guest(s)