WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.2
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Dual Timer Event

 Keywords:  



#DefineSubroutine TimerCallbackProc(Timer_Handle,Timer_Message,Timer_Name,Timer_EventInfo,Timer_ChangeInfo)
   ; Initialize Dialog Constants
   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   ;DialogprocOptions Constants
   MSG_INIT=0                    ; The one-time initialization
   MSG_TIMER=1                   ; Timer event
   MSG_BUTTONPUSHED=2            ; Pushbutton event
   ;DialogControlSet / DialogControlGet Constants
   DC_TITLE=4                ; PICTURE RADIOBUTTON CHECKBOX PICTUREBUTTON VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON MENUITEM
   ;Return code constants
   RET_DO_CANCEL=0           ; Cancels dialog
   RET_DO_DEFAULT= -1        ; Continue with default processing for control
   RET_DO_NOT_EXIT= -2       ; Do not exit the dialog
   switch Timer_Message                                     ; Switch based on Dialog Message type
      case MSG_INIT                                         ; Standard Initialization message
         DialogProcOptions(Timer_Handle,MSG_TIMER,1000)
         DialogProcOptions(Timer_Handle,MSG_BUTTONPUSHED,@TRUE)
         return(RET_DO_DEFAULT)

      case MSG_TIMER
         if flag == 1 ;CountDown code
            clockdown=DialogControlGet(Timer_Handle, "VaryText_1", DC_TITLE)
            clockdown=clockdown-1
            If clockdown==0 Then Return(RET_DO_CANCEL)
            DialogControlSet(Timer_Handle, "VaryText_1", DC_TITLE, clockdown)
         endif
         if flag == 2  ;CountUp code
            clockup=DialogControlGet(Timer_Handle, "VaryText_2", DC_TITLE)
            clockup=clockup+1
            If clockup==11 Then Return(RET_DO_CANCEL)
            DialogControlSet(Timer_Handle, "VaryText_2", DC_TITLE, clockup)
         endif
         return(RET_DO_NOT_EXIT)

      case MSG_BUTTONPUSHED
        if Timer_Name == "PushButton_Down"                  ; CountDown
              Pause(0,0)
              flag = 1
              return(RET_DO_NOT_EXIT)

        elseif Timer_Name == "PushButton_Up"                    ; CountUp
              flag = 2
              return(RET_DO_NOT_EXIT)

        endif                                              ; Timer_Name
        return(RET_DO_DEFAULT)

   endswitch                                                ; Timer_Message
   return(RET_DO_DEFAULT)
#EndSubRoutine                                                ; End of Dialog Callback TimerCallbackProc


flag = 0; initialize fla for timer event

TimerFormat=`WWWDLGED,6.2`

TimerCaption=`Dual Timer Example`
TimerX=078
TimerY=129
TimerWidth=258
TimerHeight=117
TimerNumControls=004
TimerProcedure=`TimerCallbackProc`
TimerFont=`DEFAULT`
TimerTextColor=`DEFAULT`
TimerBackground=`DEFAULT,DEFAULT`
TimerConfig=0

Timer001=`057,085,034,014,PUSHBUTTON,"PushButton_Down",DEFAULT,"CountDown",1,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer002=`127,085,034,014,PUSHBUTTON,"PushButton_Up",DEFAULT,"CountUp",2,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Timer003=`023,015,070,052,VARYTEXT,"VaryText_1",clockdown,"10",DEFAULT,DEFAULT,DEFAULT,"Tahoma|49152|70|34","128|0|0",DEFAULT`
Timer004=`127,015,070,052,VARYTEXT,"VaryText_2",clockup,"1",DEFAULT,DEFAULT,DEFAULT,"Tahoma|49152|70|34","128|0|0",DEFAULT`

ButtonPushed=Dialog("Timer")


 

Article ID:   W17719
Filename:   Dual Timer Event.txt
File Created: 2013:08:09:10:38:18
Last Updated: 2013:08:09:10:38:18