Posts: 45
Threads: 15
Joined: Jul 2006
Hello how would i get this counter to stop and close the toolbar when it gets to 300?
;/count
function# hWnd message wParam lParam
sel message
,case WM_CREATE
,CreateControl 0 "Static" 0 0 0 0 150 20 hWnd 2
,SetTimer(hWnd 1 1000 0); goto timer
,case WM_TIMER
,,if(wParam=1)
,,,;timer
,,,str s.getwintext(id(2 hWnd)); s=val(s)+1; s.setwintext(id(2 hWnd))
,,,
Posts: 12,074
Threads: 141
Joined: Dec 2002
;/count
function# hWnd message wParam lParam
sel message
,case WM_CREATE
,CreateControl 0 "Static" 0 0 0 0 150 20 hWnd 2
,SetTimer(hWnd 1 1000 0); goto timer
,case WM_TIMER
,,if(wParam=1)
,,,;timer
,,,int c=GetProp(hWnd "count")
,,,if(c=300) clo hWnd; ret
,,,SetProp(hWnd "count" c+1)
,,,str s.getwintext(id(2 hWnd)); s=val(s)+1; s.setwintext(id(2 hWnd))
,,,
Posts: 45
Threads: 15
Joined: Jul 2006
Thanks for the help Gin..... I was wondering is it possible to get the text in the counter to be white instead of black?
Posts: 12,074
Threads: 141
Joined: Dec 2002
Posts: 45
Threads: 15
Joined: Jul 2006
Hello i have changed it to a dialog but i can't work out how to stop it starting soon as the dialog is open i want it to only start when i push the start button would be nice if someone could show me how or point me in the right direction to work it out my self
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("counter" &counter &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 221 133 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 6 4 24 14 ""
;4 Button 0x54032000 0x0 6 24 48 14 "start"
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init hDlg lParam
,SetTimer hDlg 1 1000 0
,ret 1
,case WM_TIMER
,str s.getwintext(id(3 hDlg)); s=val(s)+1; s.setwintext(id(3 hDlg))
,case WM_DESTROY DT_DeleteData hDlg
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,;
,case IDOK
,DT_Ok hDlg
,case IDCANCEL
,DT_Cancel hDlg
ret 1
Posts: 12,074
Threads: 141
Joined: Dec 2002
Move SetTimer line below case 4 line.
Posts: 45
Threads: 15
Joined: Jul 2006
Thanks for your help again Gin i have it working sort of but when it gets to 300 the 300 stays there even if i push start again.. how do i get it to clear once it gets to 300 so it can start again when i push start button..
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("counter" &counter &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 221 133 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 6 4 24 14 ""
;4 Button 0x54032000 0x0 6 24 48 14 "start"
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init hDlg lParam
,ret 1
,case WM_TIMER
,if(wParam=1)
,,int c=GetProp(hDlg "count")
,,if(c=300);ret
,,SetProp(hDlg "count" c+1)
,,str s.getwintext(id(3 hDlg)); s=val(s)+1; s.setwintext(id(3 hDlg))
,case WM_DESTROY DT_DeleteData hDlg
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,SetTimer(hDlg 1 1000 0)
,mac "TV Show"
,case IDOK
,DT_Ok hDlg
,case IDCANCEL
,DT_Cancel hDlg
ret 1
Posts: 1,769
Threads: 410
Joined: Feb 2003
i think you need to reset c to "0" just after the "case 4" line.
Posts: 12,074
Threads: 141
Joined: Dec 2002
Code between case WM_TIMER and case WM_DESTROY lines:
,if(wParam=1)
,,int c=GetProp(hDlg "count")+1
,,if(c=300) c=0; KillTimer(hDlg 1)
,,SetProp(hDlg "count" c)
,,str s=c; s.setwintext(id(3 hDlg))
Posts: 45
Threads: 15
Joined: Jul 2006
Hello thanks for all the help with this just one last thing is it possible to change the lil green arrow icon on the dialog? i have a lil TV icon i would like to have inplace of it..could u show me how to change it or again point me in the right direction so i can work it out my self..
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("counter" &counter &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 54 55 "TV"
;2 Button 0x54030000 0x4 3 40 48 14 "Cancel"
;3 Edit 0x54030080 0x200 3 4 24 14 ""
;4 Button 0x54032000 0x0 3 24 48 14 "start"
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""
ret
;messages
mov 936 25 hDlg
sel message
,case WM_INITDIALOG
,DT_Init hDlg lParam
,ret 1
,case WM_TIMER
,if(wParam=1)
,,int c=GetProp(hDlg "count")+1
,,if(c=300) c=0; KillTimer(hDlg 1)
,,SetProp(hDlg "count" c)
,,str s=c; s.setwintext(id(3 hDlg))
,case WM_DESTROY DT_DeleteData hDlg
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,SetTimer(hDlg 1 1000 0)
,mac "TV Show"
,case IDOK
,DT_Ok hDlg
,case IDCANCEL
,DT_Cancel hDlg
ret 1
|