Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Counter
#1
Hello how would i get this counter to stop and close the toolbar when it gets to 300?

Code:
Copy      Help
;/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))
,,,
#2
Code:
Copy      Help
;/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))
,,,
#3
Thanks for the help Gin..... I was wondering is it possible to get the text in the counter to be white instead of black?
#4
Search forum for CFont.
#5
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

Code:
Copy      Help
\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
#6
Move SetTimer line below case 4 line.
#7
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..


Code:
Copy      Help
\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
#8
i think you need to reset c to "0" just after the "case 4" line.
An old blog on QM coding and automation.

The Macro Hook
#9
Code between case WM_TIMER and case WM_DESTROY lines:

Code:
Copy      Help
,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))
#10
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..

Code:
Copy      Help
\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


Forum Jump:


Users browsing this thread: 3 Guest(s)