WinBatch® Technical Support Forum

Archived Boards => WinBatch Dynamic Dialogs => Topic started by: stevengraff on May 30, 2014, 01:37:34 PM

Title: Progress bar function in Common Control Extender
Post by: stevengraff on May 30, 2014, 01:37:34 PM
Jim,

I tried a few permutations, then gave up, as nothing was appearing on the screen.

Does it work? what's the trick? Have you got an example you can show?

Thanks,
SG
Title: Re: Progress bar function in Common Control Extender
Post by: Deana on May 30, 2014, 02:12:17 PM
Here is a simple sample that should help:
Code (winbatch) Select
#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,MyDialog_ChangeInfo)
   ;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
;DialogprocOptions Constants
   MSG_INIT=0                    ; The one-time initialization
   MSG_TIMER=1                   ; Timer event
   MSG_BUTTONPUSHED=2            ; Pushbutton or Picturebutton

   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   switch MyDialog_Message                                  ; Switch based on Dialog Message type
      case MSG_INIT                                         ; Standard Initialization message
         DialogProcOptions(MyDialog_Handle,MSG_BUTTONPUSHED,@TRUE)
         return(RET_DO_DEFAULT)

     case MSG_BUTTONPUSHED
        if MyDialog_Name == "PushButton_OK"                ; OK

              ; Dialog Disable
              ; Grey the dialog's title bar and redraw dialog as necessary. Optionally, display the system's "wait cursor".
              ; Note: If you have code that may take a long time to execute in a callback, you may need to temporarily disable
              ; the dialog. Don't forget to enable after the process is complete.
              DialogProcOptions( MyDialog_Handle, 1000, 2 )

              ;#########################################################################################
              ;Create ProgressBar
              ;#########################################################################################
              pgControlHandle = pgCreateProgressBar(MyDialog_Handle,500,225,250,30,0)
              itext           = pgSetColor(pgControlHandle,"225|250|30",0)
              itext           = pgSetColor(pgControlHandle,"25|250|30",1)
              ; itext           = pgSetPosition(pgControlHandle,50)
              itext           = pgSetStep(pgControlHandle,1)
             
              For x = 1 to 100
                itext           = pgStep(pgControlHandle)
                TimeDelay(.1)
              Next
             
              ccShow(pgControlHandle,0)

              DialogProcOptions( MyDialog_Handle, 1000, 0 );re-enable
              return(RET_DO_NOT_EXIT)

        elseif MyDialog_Name == "PushButton_Cancel"        ; Cancel
              return(RET_DO_DEFAULT)

        endif                                              ; MyDialog_Name
        return(RET_DO_DEFAULT)

   endswitch                                                ; MyDialog_Message
   return(RET_DO_DEFAULT)
#EndFunction                                                ; End of Dialog Callback MyDialogCallbackProc


AddExtender( 'C:\WWW\Archived Extenders\CommControl\cmctrl44i.dll' )

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`ProgressBar`
MyDialogX=002
MyDialogY=059
MyDialogWidth=766
MyDialogHeight=353
MyDialogNumControls=002
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`231,333,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"Start",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`499,333,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")
Exit
Title: Re: Progress bar function in Common Control Extender
Post by: JTaylor on May 30, 2014, 04:22:49 PM
Thanks Deana.

Jim
Title: Re: Progress bar function in Common Control Extender
Post by: stevengraff on May 31, 2014, 04:07:22 PM
Yes, thanks very much!