Author Topic: Progress bar function in Common Control Extender  (Read 4055 times)

stevengraff

  • Sr. Member
  • ****
  • Posts: 271
Progress bar function in Common Control Extender
« 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

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Progress bar function in Common Control Extender
« Reply #1 on: May 30, 2014, 02:12:17 pm »
Here is a simple sample that should help:
Code: Winbatch
#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
Deana F.
Technical Support
Wilson WindowWare Inc.

JTaylor

  • Pundit
  • *****
  • Posts: 1939
    • Data & Stuff Inc.
Re: Progress bar function in Common Control Extender
« Reply #2 on: May 30, 2014, 04:22:49 pm »
Thanks Deana.

Jim

stevengraff

  • Sr. Member
  • ****
  • Posts: 271
Re: Progress bar function in Common Control Extender
« Reply #3 on: May 31, 2014, 04:07:22 pm »
Yes, thanks very much!