Announcement

Collapse
No announcement yet.

ProgressBar offset start

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ProgressBar offset start

    I am trying to set a progressbar so it starts at an offset but does NOT show up to that point.

    For instance, I have a 1 to 100% ProgressBar
    I ay want to offset that at 10%.

    I can set pos and then run from 10% to 100%, but when I start, I do not want to make that first 10 to show. Just the new starting point. The first 10% exists, but the new start is 10% in, so when the progress bar is finished, the only parts colored in is from 10 to 100 percent. I tried placing a text box and covereing the start by changing its size. That is fine except the progressbar ends up covering the text box as I guess the progress bar is drawn every time it steps from the progrress bar start to current position. I have not tried putting the lable inside the loop, as that seems not the way to do this. I was suprised not to find a function for this. I am using the DDT ProgressBar, BTW.
    Barry

  • #2
    Code not shown, but if you are using PBM_SETPOS message, just don't send it until you have "enough" progress. (10% in your case)

    If you are using PBM_STEP... I guess I'd just not send that until you have "enough" progress, at which time I'd send PBM_SETPOS, and then start sending PBM_STEP as each increment occurs. Or, you could send all the PBM_STEP you DID NOT send earlier because you did not have 'enough'.

    eg
    Code:
      IF progressPct > 10 THEN 
         IF Not SentFirstTen THEN 
             FOR Z = 1 TO 10 
                 SendMessage hCtrl, %PBM_STEP ...
             NEXT
            SentFirstTen = %TRUE
        END IF 
        SendMessage hctrl %PBM_STEP ...
    FWIW if you don';t have these already, as long as you are working with progress bar controls:
    Code:
    ' a couple of progressbar MACROS not available from Win API
    MACRO ProgressBar_SetRange    (hCtrl, pMin, pMax)  =  SendMessage hCtrl, %PBM_SETRANGE, 0, MAKLNG(pMin, pMax)
    MACRO ProgressBar_SetStep     (Hctrl, iStep)       =  SendMessage hCtrl, %PBM_SETSTEP, iStep, 0
    MACRO ProgressBar_SetBarColor (hCtrl, rgbcolor)    =  SendMessage hCtrl, %PBM_SETBARCOLOR, 0, rgbColor
    MACRO ProgressBar_SetBkColor  (hCtrl, rgbColor)    =  SendMessage hCtrl, %PBM_SETBkColor,  0, rgbcolor
    MACRO ProgressBar_SetPos      (hCtrl, newPos)      =  SendMessage hCtrl, %PBM_SETPOS, newPos, 0
    MACRO ProgressBar_Step        (hCtrl)              =  SendMessage hCtrl, %PBM_STEPIT, 0, 0
    Hmm, I guess "PBM_STEP" above should be "PBM_STEPIT" . I use the MACROs so I don't always remember the actual message name too good.

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I am using the sample ProgressBar in DDt folder to add an offset. I added a textbox to get it and a few statements; Maybe I need to place a progress bar on top of the one I want to cover it. Change style and let the one I want just fit it inside a text block carrying the style.

      Here is the modified sample:
      Code:
      '==============================================================================
      '
      '  PROGRESS.BAS example for PowerBASIC for Windows
      '  Copyright (c) 2002-2008 PowerBASIC, Inc.
      '  All Rights Reserved.
      '
      '  DDT demonstration featuring the Progress bar common control.
      '
      '  This sample shows a way to create a MODAL Progress bar dialog with a
      '  Cancel button, to enable the user to cancel the process at any time.
      '
      '==============================================================================
      
      
      '------------------------------------------------------------------------------
      ' Metastatements
      '------------------------------------------------------------------------------
      #COMPILER PBWIN 9
      #COMPILE EXE
      #DIM ALL
      
      
      '------------------------------------------------------------------------------
      ' Include files
      '------------------------------------------------------------------------------
      #INCLUDE "Win32API.inc"
      
      
      '------------------------------------------------------------------------------
      ' Equates
      '------------------------------------------------------------------------------
      %WM_USER      = &H400
      %ID_PROGRESS  = %WM_USER + 2048
      %ID_PROGRLBL  = %WM_USER + 2049
      %ID_PROGRLBL2 = %WM_USER + 2050
      %ID_OFFSETLBL = %WM_USER + 2060
      %ID_OFFSETTXT = %WM_USER + 2062
      %ID_ProgressFudgeCover = %WM_USER + 2064
      
      GLOBAL MainDlg AS DWORD
      
      
      '------------------------------------------------------------------------------
      ' Build and show Progress dialog
      '------------------------------------------------------------------------------
      SUB ShowProgressDialog (BYVAL hParent AS DWORD)
      
          LOCAL hDlg AS DWORD
      
          '----------------------------------------------------------------
          DIALOG NEW hParent, "Status:",,, 200, 70, %DS_MODALFRAME OR %WS_CAPTION, 0 TO hDlg
          DIALOG SET COLOR hDlg, -1, RGB(192,192,222)
      
          '----------------------------------------------------------------
          CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL, "Processing:",    5,  2, 190, 10
          CONTROL SET COLOR   hDlg, %ID_PROGRLBL, -1, RGB(192,192,222)
      
          CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL2, "Processed:",   55, 32,  90, 10, %SS_CENTER
          CONTROL SET COLOR   hDlg, %ID_PROGRLBL2, -1, RGB(192,192,222)
      
          CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Cancel",          70, 50,  60, 14
          CONTROL ADD PROGRESSBAR, hDlg, %ID_PROGRESS, "",  5, 12, 190, 12, %WS_CHILD OR %WS_VISIBLE OR %PBS_SMOOTH
          CONTROL ADD TEXTBOX, hdlg, %ID_ProgressFudgeCover, "", 5,12,5,24
          CONTROL SET COLOR hDlg, %ID_ProgressFudgeCover, %RED, %RED
          '----------------------------------------------------------------
          DIALOG SHOW MODAL hDlg, CALL PBarDlgProc
      
      END SUB
      
      
      '------------------------------------------------------------------------------
      ' Progress dialog callback
      ' In %WM_INITDIALOG, we post a user defined message to the dialog's message
      ' queue via DIALOG POST. Posted messages are placed at bottom of the message
      ' queue, so this ensures dialog will be shown before the action starts.
      '------------------------------------------------------------------------------
      CALLBACK FUNCTION PBarDlgProc () AS LONG
      
          LOCAL i      AS LONG
          LOCAL lMax   AS LONG
          STATIC Abort AS LONG
          LOCAL sRes AS STRING
          LOCAL res AS LONG
          SELECT CASE CB.MSG
          CASE %WM_INITDIALOG
              ' Post a user defined (private) message to self
              DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0
      
          CASE %WM_USER + 999&
              Abort = 0   ' flag for cancel operation
              lMax  = 200 ' user defined value that equals the progress bar's 100%
      
              ' Ensures all controls are drawn before starting
              DIALOG REDRAW CB.HNDL
              PROGRESSBAR SET RANGE CB.HNDL, %ID_PROGRESS, 0, lMax
              PROGRESSBAR SET STEP  CB.HNDL, %ID_PROGRESS, 1
              
              'new code
              CONTROL GET TEXT Maindlg, %ID_OFFSETTXT TO sRes
      
              res = VAL(sRes)
              IF res < 1 THEN res=1
              IF res >150 THEN res = 150
              '---------------------------------------
      
              PROGRESSBAR SET POS CB.HNDL, %ID_PROGRESS, res 'set it to START offset in. wihtout showing itself????????
              
      
              FOR i = res TO lMax
                  PROGRESSBAR STEP CB.HNDL, %ID_PROGRESS
                  '----------------------
              CONTROL SET SIZE CB.HNDL, %ID_ProgressFudgeCover ,res,24  'Cover the front end.... since this control was made after the progressbar
                                                                         'make it tall so I can see it while trying to cover the front.
                  '----------------------
                  ' Here working code can be placed. Sample does nothing, so we
                  ' take a short break, just to enable you to follow the progress..
                  SLEEP 20
      
                  IF i MOD 2 = 0 THEN
                      CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL, "Processing item #" & STR$(i)
                      CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL2, FORMAT$(i / lMax, "#%"" done""")
                      DIALOG DOEVENTS ' allow processor to breathe
                  END IF
      
                  IF Abort THEN EXIT FOR     ' user cancelled action
              NEXT
      
              BEEP
              DIALOG END CB.HNDL, 0           ' Done, so close dialog
      
          CASE %WM_COMMAND
              SELECT CASE CB.CTL
              CASE %IDCANCEL                 ' Cancel or Escape was pressed
                  IF CB.CTLMSG = %BN_CLICKED THEN
                      IF MSGBOX("Abort the process?", _
                                %MB_YESNO OR %MB_ICONQUESTION OR %MB_TASKMODAL, _
                                "Abort?") = %IDYES THEN Abort = %TRUE
                      DIALOG REDRAW CB.HNDL
                  END IF
              END SELECT
      
          CASE %WM_SYSCOLORCHANGE
              ' If user changes color scheme, forward the notification to the control
              CONTROL SEND CB.HNDL, %ID_PROGRESS, CB.MSG, CB.WPARAM, CB.LPARAM
      
          END SELECT
      
      END FUNCTION
      
      
      '------------------------------------------------------------------------------
      ' Main callback
      '------------------------------------------------------------------------------
      CALLBACK FUNCTION MainDlgProc () AS LONG
      
          SELECT CASE CB.MSG
      
          CASE %WM_COMMAND
              SELECT CASE CB.CTL
      
              CASE %IDOK                ' Show Progress bar dialog
                  IF CB.CTLMSG = %BN_CLICKED THEN
                      ShowProgressDialog CB.HNDL
                  END IF
      
              CASE %IDCANCEL           ' Close the sample
                  IF CB.CTLMSG = %BN_CLICKED THEN
                      DIALOG END CB.HNDL, 0
                  END IF
      
              END SELECT
      
          END SELECT
      
      END FUNCTION
      
      
      '------------------------------------------------------------------------------
      ' Main entry point for the application
      '------------------------------------------------------------------------------
      FUNCTION PBMAIN () AS LONG
      
          LOCAL hDlg AS DWORD
      
          '----------------------------------------------------------------
          DIALOG FONT "Times New Roman", 16
      
          DIALOG NEW 0, "DDT Progress bar demo",,, 140, 100, %WS_CAPTION OR %WS_SYSMENU TO hDlg
          DIALOG SET COLOR hDlg, -1, RGB(222,192,192)
      
          '----------------------------------------------------------------
          CONTROL ADD LABEL, hDlg, -1, "Press Start to show action", 5, 35, 130, 10, %SS_CENTER
          CONTROL SET COLOR  hDlg, -1, -1, RGB(222,192,192)
      
          CONTROL ADD BUTTON, hDlg, %IDOK,     "&Start",  18, 80, 50, 14
          CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Close", 72, 80, 50, 14
          CONTROL ADD LABEL, HdLG, %ID_OffsetLBL, "Offset from Start (1 to 150)",5,57,80,10
          CONTROL ADD TEXTBOX, hDLG, %ID_OFFSETTXT, "",88,57,20,10
      
          DIALOG FONT "MS Sans Serif", 8
          MainDlg = hDlg
          '----------------------------------------------------------------
          DIALOG SHOW MODAL hDlg CALL MainDlgProc
      
      END FUNCTION
      Barry

      Comment


      • #4
        One way to get the effect you describe is to hide the progress bar and place a 'buddy' graphic control in the same position.
        Here's a modification of your code showing what I mean..
        Code:
        '==============================================================================
        '
        '  PROGRESS.BAS example for PowerBASIC for Windows
        '  Copyright (c) 2002-2008 PowerBASIC, Inc.
        '  All Rights Reserved.
        '
        '  DDT demonstration featuring the Progress bar common control.
        '
        '  This sample shows a way to create a MODAL Progress bar dialog with a
        '  Cancel button, to enable the user to cancel the process at any time.
        '
        '==============================================================================
         
         
        '------------------------------------------------------------------------------
        ' Metastatements
        '------------------------------------------------------------------------------
        #COMPILER PBWIN 9
        #COMPILE EXE
        #DIM ALL
         
         
        '------------------------------------------------------------------------------
        ' Include files
        '------------------------------------------------------------------------------
        #INCLUDE "Win32API.inc"
         
         
        '------------------------------------------------------------------------------
        ' Equates
        '------------------------------------------------------------------------------
        %WM_USER      = &H400
        %ID_PROGRESS  = %WM_USER + 2048
        %ID_PROGRLBL  = %WM_USER + 2049
        %ID_PROGRLBL2 = %WM_USER + 2050
        %ID_OFFSETLBL = %WM_USER + 2060
        %ID_OFFSETTXT = %WM_USER + 2062
        %ID_ProgressFudgeCover = %WM_USER + 2064
         
        %ID_GRAPHIC1  = %WM_USER + 2066
         
        GLOBAL MainDlg AS DWORD
         
         
        '------------------------------------------------------------------------------
        ' Build and show Progress dialog
        '------------------------------------------------------------------------------
        SUB ShowProgressDialog (BYVAL hParent AS DWORD)
         
            LOCAL hDlg AS DWORD
         
            '----------------------------------------------------------------
            DIALOG New hParent, "Status:",,, 200, 95, %DS_MODALFRAME OR %WS_CAPTION, 0 TO hDlg
            DIALOG SET COLOR hDlg, -1, RGB(192,192,222)
         
            '----------------------------------------------------------------
            CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL, "Processing:",    5,  20, 190, 10
            CONTROL SET COLOR   hDlg, %ID_PROGRLBL, -1, RGB(192,192,222)
         
            CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL2, "Processed:",   55, 50, 90, 10, %SS_CENTER
            CONTROL SET COLOR   hDlg, %ID_PROGRLBL2, -1, RGB(192,192,222)
         
            CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Cancel",          70, 70,  60, 14
            CONTROL ADD PROGRESSBAR, hDlg, %ID_PROGRESS, "",  5, 30, 190, 12, %WS_CHILD OR %WS_VISIBLE OR %PBS_SMOOTH
         '    CONTROL ADD TEXTBOX, hdlg, %ID_ProgressFudgeCover, "", 5,12,5,24
         '    CONTROL SET COLOR hDlg, %ID_ProgressFudgeCover, %RED, %RED
            '----------------------------------------------------------------
            'CONTROL SHOW STATE hDlg, %ID_PROGRESS, %SW_HIDE
            CONTROL ADD GRAPHIC, hDlg, %ID_GRAPHIC1, "", 5, 5, 190, 12, %SS_SUNKEN
            '----------------------------------------------------------------
            DIALOG SHOW MODAL hDlg, CALL PBarDlgProc
         
        END SUB
         
         
        '------------------------------------------------------------------------------
        ' Progress dialog callback
        ' In %WM_INITDIALOG, we post a user defined message to the dialog's message
        ' queue via DIALOG POST. Posted messages are placed at bottom of the message
        ' queue, so this ensures dialog will be shown before the action starts.
        '------------------------------------------------------------------------------
        CALLBACK FUNCTION PBarDlgProc () AS LONG
         
            LOCAL i      AS LONG
            LOCAL lMax   AS LONG
            STATIC Abort AS LONG
            LOCAL sRes AS STRING
            LOCAL res AS Long 
         
            LOCAL BarPos AS LONG        '
         
            SELECT CASE CB.MSG
            CASE %WM_INITDIALOG
                ' Post a user defined (private) message to self
                DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0
         
            CASE %WM_USER + 999&
                Abort = 0   ' flag for cancel operation
                lMax  = 200 ' user defined value that equals the progress bar's 100%
         
                GRAPHIC ATTACH CBHNDL, %ID_GRAPHIC1, REDRAW
                GRAPHIC COLOR GetSysColor(%COLOR_HIGHLIGHT), GetSysColor(%COLOR_BTNFACE)
                GRAPHIC CLEAR
                GRAPHIC Redraw
                GRAPHIC SCALE (0, 0) - (lMax, 12)         ' Scale to suit progbar's 100% value
         
                ' Ensures all controls are drawn before starting
                DIALOG REDRAW CB.HNDL
                PROGRESSBAR SET RANGE CB.HNDL, %ID_PROGRESS, 0, lMax
                PROGRESSBAR SET STEP  CB.HNDL, %ID_PROGRESS, 1
         
                'new code
                CONTROL GET TEXT Maindlg, %ID_OFFSETTXT TO sRes
         
                res = VAL(sRes)
                IF res < 1 THEN res=1
                IF res >150 THEN res = 150
                '---------------------------------------
         
                PROGRESSBAR SET POS CB.HNDL, %ID_PROGRESS, res 'set it to START offset in. wihtout showing itself????????
         
         
                FOR i = res TO lMax
                    PROGRESSBAR STEP CB.HNDL, %ID_PROGRESS
         
                    PROGRESSBAR GET POS CB.HNDL, %ID_PROGRESS TO BarPos       ' get current position of progress bar
                    GRAPHIC ATTACH CBHNDL, %ID_GRAPHIC1, REDRAW               ' (to draw the graphic box)
                    GRAPHIC CLEAR                               
                    GRAPHIC BOX (res, 0.5)-(res+(BarPos-res), 11.5), 0, GetSysColor(%COLOR_HIGHLIGHT), GetSysColor(%COLOR_HIGHLIGHT), 0 
                    GRAPHIC Redraw
         
                    '----------------------
         '        CONTROL SET SIZE CB.HNDL, %ID_ProgressFudgeCover ,res,24  'Cover the front end.... since this control was made after the progressbar
                                                                           'make it tall so I can see it while trying to cover the front.
                    '----------------------
                    ' Here working code can be placed. Sample does nothing, so we
                    ' take a short break, just to enable you to follow the progress..
                    SLEEP 20
         
                    IF i MOD 2 = 0 THEN
                        CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL, "Processing item #" & STR$(i)
                        CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL2, FORMAT$(i / lMax, "#%"" done""")
                        DIALOG DOEVENTS ' allow processor to breathe
                    END IF
         
                    IF Abort THEN EXIT FOR     ' user cancelled action
                NEXT
         
                BEEP
                DIALOG END CB.HNDL, 0           ' Done, so close dialog
         
            CASE %WM_COMMAND
                SELECT CASE CB.CTL
                CASE %IDCANCEL                 ' Cancel or Escape was pressed
                    IF CB.CTLMSG = %BN_CLICKED THEN
                        IF MSGBOX("Abort the process?", _
                                  %MB_YESNO OR %MB_ICONQUESTION OR %MB_TASKMODAL, _
                                  "Abort?") = %IDYES THEN Abort = %TRUE
                        DIALOG REDRAW CB.HNDL
                    END IF
                END SELECT
         
            CASE %WM_SYSCOLORCHANGE
                ' If user changes color scheme, forward the notification to the control
                CONTROL SEND CB.HNDL, %ID_PROGRESS, CB.MSG, CB.WPARAM, CB.LPARAM
         
            END SELECT
         
        END FUNCTION
         
         
        '------------------------------------------------------------------------------
        ' Main callback
        '------------------------------------------------------------------------------
        CALLBACK FUNCTION MainDlgProc () AS LONG
         
            SELECT CASE CB.MSG
         
            CASE %WM_COMMAND
                SELECT CASE CB.CTL
         
                CASE %IDOK                ' Show Progress bar dialog
                    IF CB.CTLMSG = %BN_CLICKED THEN
                        ShowProgressDialog CB.HNDL
                    END IF
         
                CASE %IDCANCEL           ' Close the sample
                    IF CB.CTLMSG = %BN_CLICKED THEN
                        DIALOG END CB.HNDL, 0
                    END IF
         
                END SELECT
         
            END SELECT
         
        END FUNCTION
         
         
        '------------------------------------------------------------------------------
        ' Main entry point for the application
        '------------------------------------------------------------------------------
        FUNCTION PBMAIN () AS LONG
         
            LOCAL hDlg AS DWORD
         
            '----------------------------------------------------------------
            DIALOG FONT "Times New Roman", 16
         
            DIALOG NEW 0, "DDT Progress bar demo",,, 140, 100, %WS_CAPTION OR %WS_SYSMENU TO hDlg
            DIALOG SET COLOR hDlg, -1, RGB(222,192,192)
         
            '----------------------------------------------------------------
            CONTROL ADD LABEL, hDlg, -1, "Press Start to show action", 5, 35, 130, 10, %SS_CENTER
            CONTROL SET COLOR  hDlg, -1, -1, RGB(222,192,192)
         
            CONTROL ADD BUTTON, hDlg, %IDOK,     "&Start",  18, 80, 50, 14
            CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Close", 72, 80, 50, 14
            CONTROL ADD LABEL, HdLG, %ID_OffsetLBL, "Offset from Start (1 to 150)",5,57,80,10
            CONTROL ADD TEXTBOX, hDLG, %ID_OFFSETTXT, "",88,57,20,10
         
            DIALOG FONT "MS Sans Serif", 8
            MainDlg = hDlg
            '----------------------------------------------------------------
            DIALOG SHOW MODAL hDlg CALL MainDlgProc
         
        END FUNCTION
        (Here both the graphic and progress bar visible for comparison).
        Rgds, Dave

        Comment


        • #5
          Is this the effect you wanted? Progress bar shows itself immediately but stays at zero until you reach the desired starting point, at which point it starts showing iteself?

          I could not get the main dialog to start with the focus in the "offset" text box. Then again, I''m not a 'DDT' guy.

          I included a few 'style points' comments, although some may refer to stuff you added when you could not immediately get the video effect you wanted.


          MCM

          Code:
          '==============================================================================
          '
          '  PROGRESS.BAS example for PowerBASIC for Windows
          '  Copyright (c) 2002-2008 PowerBASIC, Inc.
          '  All Rights Reserved.
          '
          '  DDT demonstration featuring the Progress bar common control.
          '
          '  This sample shows a way to create a MODAL Progress bar dialog with a
          '  Cancel button, to enable the user to cancel the process at any time.
          '  changes by MCM 1/18/09
          '==============================================================================
          
          
          '------------------------------------------------------------------------------
          ' Metastatements
          '------------------------------------------------------------------------------
          #COMPILER PBWIN 9
          #COMPILE EXE
          #DIM ALL
          
          
          '------------------------------------------------------------------------------
          ' Include files
          '------------------------------------------------------------------------------
          #INCLUDE "Win32API.inc"
          
          
          '------------------------------------------------------------------------------
          ' Equates
          '------------------------------------------------------------------------------
          %WM_USER      = &H400
          %ID_PROGRESS  = %WM_USER + 2048
          %ID_PROGRLBL  = %WM_USER + 2049
          %ID_PROGRLBL2 = %WM_USER + 2050
          %ID_OFFSETLBL = %WM_USER + 2060
          %ID_OFFSETTXT = %WM_USER + 2062
          %ID_ProgressFudgeCover = %WM_USER + 2064
          
          GLOBAL MainDlg AS DWORD
          
          
          '------------------------------------------------------------------------------
          ' Build and show Progress dialog
          '------------------------------------------------------------------------------
          SUB ShowProgressDialog (BYVAL hParent AS DWORD)
          
              LOCAL hDlg AS DWORD
              
              ' HERE IS WHERE I'D PUT THE FONT SIZE FOR THIS SUBORDINATE DIALOG
          
          
              '----------------------------------------------------------------
              DIALOG NEW hParent, "Status:",,, 200, 70, %DS_MODALFRAME OR %WS_CAPTION, 0 TO hDlg
              DIALOG SET COLOR hDlg, -1, RGB(192,192,222)
          
              '----------------------------------------------------------------
              CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL, "Processing:",    5,  2, 190, 10
              CONTROL SET COLOR   hDlg, %ID_PROGRLBL, -1, RGB(192,192,222)
          
              CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL2, "Processed:",   55, 32,  90, 10, %SS_CENTER
              CONTROL SET COLOR   hDlg, %ID_PROGRLBL2, -1, RGB(192,192,222)
          
              CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Cancel",          70, 50,  60, 14
              CONTROL ADD PROGRESSBAR, hDlg, %ID_PROGRESS, "",  5, 12, 190, 12, %WS_CHILD OR %WS_VISIBLE OR %PBS_SMOOTH
              CONTROL ADD TEXTBOX, hdlg, %ID_ProgressFudgeCover, "", 5,12,5,24
              CONTROL SET COLOR hDlg, %ID_ProgressFudgeCover, %RED, %RED
              '----------------------------------------------------------------
              DIALOG SHOW MODAL hDlg, CALL PBarDlgProc
          
          END SUB
          
          MACRO Redraw_Off (hCtrl)
            SendMessage hCtrl, %WM_SETREDRAW, %FALSE, 0&
          END MACRO
          MACRO Redraw_On (hCtrl)
            SendMessage hCtrl, %WM_SETREDRAW, %TRUE, 0&
          END MACRO
          
          
          
          '------------------------------------------------------------------------------
          ' Progress dialog callback
          ' In %WM_INITDIALOG, we post a user defined message to the dialog's message
          ' queue via DIALOG POST. Posted messages are placed at bottom of the message
          ' queue, so this ensures dialog will be shown before the action starts.
          '------------------------------------------------------------------------------
          CALLBACK FUNCTION PBarDlgProc () AS LONG
          
              LOCAL i      AS LONG
              LOCAL lMax   AS LONG
              STATIC Abort AS LONG
              LOCAL sRes AS STRING
              LOCAL res AS LONG
              SELECT CASE CB.MSG
              CASE %WM_INITDIALOG
                  ' Post a user defined (private) message to self
                  DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0
          
              CASE %WM_USER + 999&
                  Abort = 0   ' flag for cancel operation
                  lMax  = 200 ' user defined value that equals the progress bar's 100%
          
                  ' Ensures all controls are drawn before starting
                  ' this is not necessary, as dialog is always drawn when shown after WM_INITDIALOG n
                  'DIALOG      REDRAW CB.HNDL
                  
                  PROGRESSBAR SET RANGE CB.HNDL, %ID_PROGRESS, 0, lMax
                  PROGRESSBAR SET STEP  CB.HNDL, %ID_PROGRESS, 1
          
          
                  'new code
                  CONTROL GET TEXT Maindlg, %ID_OFFSETTXT TO sRes    ' maindlg is a GLOBAL
          
                  res = VAL(sRes)
                  IF res < 1 THEN res=1
                  IF res >150 THEN res = 150
                  
                  '-----------------------------------------------------
                  ' force control to be drawn at zero percent progress
                  '-----------------------------------------------------
                   CONTROL REDRAW CB.HNDL, %ID_PROGRESS
                  ' ------------------------------------------------------------------------
                  ' Now don't allow bar to redraw itself until we reach desired progress level
                  ' ------------------------------------------------------------------------
                  LOCAL hPB AS LONG
                  CONTROL HANDLE CB.HNDL, %ID_PROGRESS TO hPB
                  redraw_off (hPB)
          
                  PROGRESSBAR SET POS CB.HNDL, %ID_PROGRESS, res 'set it to START offset in. without showing itself????????
                  
                 ' CONTROL REDRAW CB.HNDL, %ID_PROGRESS   '  OUT. THis just shows it at the starting point
          
                  FOR i = 1 TO lMax          ' we want to see progress on EVERY loop, not just when we get to res
          
                      IF I =  res THEN      ' enable the progress bar redraw from this point forward
                         Redraw_on (hPB)
                      ELSEIF I > res THEN   ' start stepping the bar because we are now past start point.
                          PROGRESSBAR STEP CB.HNDL, %ID_PROGRESS
                      END IF
                      '----------------------
                  ' take thisout
                  ' CONTROL SET SIZE CB.HNDL, %ID_ProgressFudgeCover ,res,24  'Cover the front end.... since this control was made after the progressbar
                                                                             'make it tall so I can see it while trying to cover the front.
                      '----------------------
                      ' Here working code can be placed. Sample does nothing, so we
                      ' take a short break, just to enable you to follow the progress..
                      SLEEP 50   ' 10 is too fast I can't see what the heck is going on
          
                      IF i MOD 2 = 0 THEN
                          CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL, "Processing item #" & STR$(i)
                          CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL2, FORMAT$(i / lMax, "#%"" done""")
                      END IF
          
                      IF Abort THEN EXIT FOR     ' user cancelled action
                  NEXT
          
                  BEEP
                  DIALOG END CB.HNDL, 0           ' Done, so close dialog
          
              CASE %WM_COMMAND
                  SELECT CASE CB.CTL
                  CASE %IDCANCEL                 ' Cancel or Escape was pressed
                      IF CB.CTLMSG = %BN_CLICKED THEN
                          IF MSGBOX("Abort the process?", _
                                    %MB_YESNO OR %MB_ICONQUESTION OR %MB_TASKMODAL, _
                                    "Abort?") = %IDYES THEN Abort = %TRUE
                          DIALOG REDRAW CB.HNDL
                      END IF
                  END SELECT
          
              CASE %WM_SYSCOLORCHANGE
                  ' If user changes color scheme, forward the notification to the control
                  CONTROL SEND CB.HNDL, %ID_PROGRESS, CB.MSG, CB.WPARAM, CB.LPARAM
          
              END SELECT
          
          END FUNCTION
          
          
          '------------------------------------------------------------------------------
          ' Main callback
          '------------------------------------------------------------------------------
          CALLBACK FUNCTION MainDlgProc () AS LONG
          
              SELECT CASE CB.MSG
          
              CASE %WM_COMMAND
                  SELECT CASE CB.CTL
          
                  CASE %IDOK                ' Show Progress bar dialog
                      IF CB.CTLMSG = %BN_CLICKED THEN
                          ShowProgressDialog CB.HNDL
                      END IF
          
                  CASE %IDCANCEL           ' Close the sample
                      IF CB.CTLMSG = %BN_CLICKED THEN
                          DIALOG END CB.HNDL, 0
                      END IF
          
                  END SELECT
          
              END SELECT
          
          END FUNCTION
          
          
          '------------------------------------------------------------------------------
          ' Main entry point for the application
          '------------------------------------------------------------------------------
          FUNCTION PBMAIN () AS LONG
          
              LOCAL hDlg AS DWORD
          
              '----------------------------------------------------------------
              DIALOG FONT "Times New Roman", 16
          
              DIALOG NEW 0, "DDT Progress bar demo",,, 140, 100, %WS_CAPTION OR %WS_SYSMENU TO hDlg
              DIALOG SET COLOR hDlg, -1, RGB(222,192,192)
          
              '----------------------------------------------------------------
              
              ' make the offset box the first WS_TABTOP control maybe that will fix the focus issue.
              ' no that does not work either. Does that **** label get the focus?
              CONTROL ADD LABEL, HdLG, %ID_OffsetLBL, "Offset from Start (1 to 150)",5,57,80,10
              CONTROL ADD TEXTBOX, hDLG, %ID_OFFSETTXT, "",88,57,20,10
              
              ' is this getting the initial focus? Let's move it here to find out
              CONTROL ADD LABEL, hDlg, -1, "Press Start to show action", 5, 35, 130, 10, %SS_CENTER
              
              CONTROL SET COLOR  hDlg, -1, -1, RGB(222,192,192)   ' this is weird; control id '-1' could be anything
                                                                  ' label control should have its own ID if it needs
                                                                  ' to be addressed in a command.
          
              CONTROL ADD BUTTON, hDlg, %IDOK,     "&Start",  18, 80, 50, 14
              CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Close", 72, 80, 50, 14
          
              
          
              DIALOG FONT "MS Sans Serif", 8   ' a little late, isn't it? Oh, this will affect the OTHER dialog
                                               ' I Think I'd put this with the creation code for the other dialog
              MainDlg = hDlg
              '----------------------------------------------------------------
              DIALOG SHOW MODAL hDlg CALL MainDlgProc
          
          END FUNCTION
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            I already had the progress bar starting off at the right position. I just could not show a vertical line at that position before it started. With the Graphic approach, I can draw a little box at the offset, one pixel wide, and then when it starts all is fine. This is in a music editing thing, so we are trimming the start offset with up/down controls and want the offset on the progress bar to show that. I also have a offset at the end and all of this is working, now.

            Thanks, Michael and Dave.
            Barry

            Comment


            • #7
              Screen shot or demo code, please?

              I simply cannot visualize what you describe.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Wait a minute....

                Is this supposed to come out looking like a trackbar control, which can start in the middle and then move toward 'complete' as you go from that point forward?

                Not to put too fine a spin on it, if this is the case maybe there is a different control choice you could have made.....

                MCM
                Last edited by Michael Mattias; 18 Jan 2009, 11:32 AM.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Now that you mention it, a trackbar might be it. I always used a progressbar to track a music file time and worked on that... but the updown control may need more of a trackbar.

                  Will do this after hockey.. two games on.. no matter what Penguins game you look at, the score is now Penguins 3, opposition 0.
                  Barry

                  Comment


                  • #10
                    Ok, now that both Penguins teams won 3-0 today, here is the modified sample doing what I need. In the actual program, an updown control is tied to this, not a textbox.

                    Code:
                    '==============================================================================
                    '
                    '  PROGRESS.BAS example for PowerBASIC for Windows
                    '  Copyright (c) 2002-2008 PowerBASIC, Inc.
                    '  All Rights Reserved.
                    '
                    '  DDT demonstration featuring the Progress bar common control.
                    '
                    '  This sample shows a way to create a MODAL Progress bar dialog with a
                    '  Cancel button, to enable the user to cancel the process at any time.
                    '
                    '==============================================================================
                    
                    
                    '------------------------------------------------------------------------------
                    ' Metastatements
                    '------------------------------------------------------------------------------
                    #COMPILER PBWIN 9
                    #COMPILE EXE
                    #DIM ALL
                    
                    
                    '------------------------------------------------------------------------------
                    ' Include files
                    '------------------------------------------------------------------------------
                    #INCLUDE "Win32API.inc"
                    
                    
                    '------------------------------------------------------------------------------
                    ' Equates
                    '------------------------------------------------------------------------------
                    %WM_USER      = &H400
                    %ID_PROGRESS  = %WM_USER + 2048
                    %ID_PROGRLBL  = %WM_USER + 2049
                    %ID_PROGRLBL2 = %WM_USER + 2050
                    %ID_OFFSETLBL = %WM_USER + 2060
                    %ID_OFFSETTXT = %WM_USER + 2062
                    %ID_ProgressFudgeCover = %WM_USER + 2064
                    %ID_EndOFfsetLbl = %WM_USER + 2068
                    %ID_EndOffsetTxt = %WM_USER + 2070
                    %ID_GRAPHIC1  = %WM_USER + 2066
                    
                    GLOBAL MainDlg AS DWORD
                    
                    
                    '------------------------------------------------------------------------------
                    ' Build and show Progress dialog
                    '------------------------------------------------------------------------------
                    SUB ShowProgressDialog (BYVAL hParent AS DWORD)
                    
                        LOCAL hDlg AS DWORD
                    
                        '----------------------------------------------------------------
                        DIALOG NEW hParent, "Status:",,, 200, 95, %DS_MODALFRAME OR %WS_CAPTION, 0 TO hDlg
                        DIALOG SET COLOR hDlg, -1, RGB(192,192,222)
                    
                        '----------------------------------------------------------------
                        CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL, "Processing:",    5,  20, 190, 10
                        CONTROL SET COLOR   hDlg, %ID_PROGRLBL, -1, RGB(192,192,222)
                    
                        CONTROL ADD LABEL,  hDlg, %ID_PROGRLBL2, "Processed:",   55, 50, 90, 10, %SS_CENTER
                        CONTROL SET COLOR   hDlg, %ID_PROGRLBL2, -1, RGB(192,192,222)
                    
                        CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Cancel",          70, 70,  60, 14
                        CONTROL ADD PROGRESSBAR, hDlg, %ID_PROGRESS, "",  5, 30, 190, 12, %WS_CHILD OR %WS_VISIBLE OR %PBS_SMOOTH
                     '    CONTROL ADD TEXTBOX, hdlg, %ID_ProgressFudgeCover, "", 5,12,5,24
                     '    CONTROL SET COLOR hDlg, %ID_ProgressFudgeCover, %RED, %RED
                        '----------------------------------------------------------------
                        'CONTROL SHOW STATE hDlg, %ID_PROGRESS, %SW_HIDE
                        CONTROL ADD GRAPHIC, hDlg, %ID_GRAPHIC1, "", 5, 5, 190, 12, %WS_BORDER '%SS_SUNKEN
                        '----------------------------------------------------------------
                        DIALOG SHOW MODAL hDlg, CALL PBarDlgProc
                    
                    END SUB
                    
                    
                    '------------------------------------------------------------------------------
                    ' Progress dialog callback
                    ' In %WM_INITDIALOG, we post a user defined message to the dialog's message
                    ' queue via DIALOG POST. Posted messages are placed at bottom of the message
                    ' queue, so this ensures dialog will be shown before the action starts.
                    '------------------------------------------------------------------------------
                    CALLBACK FUNCTION PBarDlgProc () AS LONG
                    
                        LOCAL i      AS LONG
                        LOCAL lMax   AS LONG
                        STATIC Abort AS LONG
                        LOCAL sRes AS STRING
                        LOCAL res AS LONG
                    
                        LOCAL BarPos AS LONG        '
                    
                        SELECT CASE CB.MSG
                        CASE %WM_INITDIALOG
                            ' Post a user defined (private) message to self
                            DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0
                    
                        CASE %WM_USER + 999&
                            Abort = 0   ' flag for cancel operation
                            lMax  = 200 ' user defined value that equals the progress bar's 100%
                    
                            GRAPHIC ATTACH CBHNDL, %ID_GRAPHIC1, REDRAW
                            GRAPHIC COLOR GetSysColor(%COLOR_HIGHLIGHT), GetSysColor(%COLOR_BTNFACE)
                            GRAPHIC CLEAR
                            GRAPHIC REDRAW
                            GRAPHIC SCALE (0, 0) - (lMax, 12)         ' Scale to suit progbar's 100% value
                    
                            ' Ensures all controls are drawn before starting
                            DIALOG REDRAW CB.HNDL
                            PROGRESSBAR SET RANGE CB.HNDL, %ID_PROGRESS, 0, lMax
                            PROGRESSBAR SET STEP  CB.HNDL, %ID_PROGRESS, 1
                    
                            'new code
                            LOCAL sEndRes AS STRING
                            LOCAL EndRes AS LONG
                            CONTROL GET TEXT Maindlg, %ID_OFFSETTXT TO sRes
                            CONTROL GET TEXT Maindlg, %ID_EndOFFSETTXT TO sEndRes
                            res = VAL(sRes)
                            IF res < 1 THEN res=1
                            IF res >150 THEN res = 150
                            endres = VAL(sEndRes)
                            IF endres <1 THEN endRes = 1
                            IF endres > lMax THEN endRes = lMax
                            IF endres<res THEN Endres = Res + 1
                            '---------------------------------------
                    
                            PROGRESSBAR SET POS CB.HNDL, %ID_PROGRESS, res 'set it to START offset in. wihtout showing itself????????
                            GRAPHIC ATTACH CB.HNDL, %ID_GRAPHIC1,REDRAW
                            GRAPHIC CLEAR
                            GRAPHIC BOX (res,0.5)-(res+1,11.5),0,getsyscolor(%COLOR_HIGHLiGHT), GetSysColor(%COLOR_Background),0
                            GRAPHIC BOX (lmax-endres,0.5)-(lMax-endres+1,11.5),0,GetSysColor(%Color_Highlight),GetSysColor(%COLOR_BACKGROUND),0
                            GRAPHIC REDRAW
                                LOCAL a AS LONG
                                a=TIMER
                                DO
                                    LOOP UNTIL TIMER-a>10
                            FOR i = res TO lMax - endres
                                PROGRESSBAR STEP CB.HNDL, %ID_PROGRESS
                    
                                PROGRESSBAR GET POS CB.HNDL, %ID_PROGRESS TO BarPos       ' get current position of progress bar
                                GRAPHIC ATTACH CBHNDL, %ID_GRAPHIC1, REDRAW               ' (to draw the graphic box)
                                GRAPHIC CLEAR
                                GRAPHIC BOX (res, 0.5)-((res)+(BarPos-res), 11.5), 0,GetSysColor(%COLOR_Highlight),GetSysColor(%Color_BackGround), 0
                                GRAPHIC REDRAW
                    
                                '----------------------
                     '        CONTROL SET SIZE CB.HNDL, %ID_ProgressFudgeCover ,res,24  'Cover the front end.... since this control was made after the progressbar
                                                                                       'make it tall so I can see it while trying to cover the front.
                                '----------------------
                                ' Here working code can be placed. Sample does nothing, so we
                                ' take a short break, just to enable you to follow the progress..
                                SLEEP 20
                    
                                IF i MOD 2 = 0 THEN
                                    CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL, "Processing item #" & STR$(i)
                                    CONTROL SET TEXT CB.HNDL, %ID_PROGRLBL2, FORMAT$(i / lMax, "#%"" done""")
                                    DIALOG DOEVENTS ' allow processor to breathe
                                END IF
                    
                                IF Abort THEN EXIT FOR     ' user cancelled action
                            NEXT
                    
                            BEEP
                            DIALOG END CB.HNDL, 0           ' Done, so close dialog
                    
                        CASE %WM_COMMAND
                            SELECT CASE CB.CTL
                            CASE %IDCANCEL                 ' Cancel or Escape was pressed
                                IF CB.CTLMSG = %BN_CLICKED THEN
                                    IF MSGBOX("Abort the process?", _
                                              %MB_YESNO OR %MB_ICONQUESTION OR %MB_TASKMODAL, _
                                              "Abort?") = %IDYES THEN Abort = %TRUE
                                    DIALOG REDRAW CB.HNDL
                                END IF
                            END SELECT
                    
                        CASE %WM_SYSCOLORCHANGE
                            ' If user changes color scheme, forward the notification to the control
                            CONTROL SEND CB.HNDL, %ID_PROGRESS, CB.MSG, CB.WPARAM, CB.LPARAM
                    
                        END SELECT
                    
                    END FUNCTION
                    
                    
                    '------------------------------------------------------------------------------
                    ' Main callback
                    '------------------------------------------------------------------------------
                    CALLBACK FUNCTION MainDlgProc () AS LONG
                    
                        SELECT CASE CB.MSG
                    
                        CASE %WM_COMMAND
                            SELECT CASE CB.CTL
                    
                            CASE %IDOK                ' Show Progress bar dialog
                                IF CB.CTLMSG = %BN_CLICKED THEN
                                    ShowProgressDialog CB.HNDL
                                END IF
                    
                            CASE %IDCANCEL           ' Close the sample
                                IF CB.CTLMSG = %BN_CLICKED THEN
                                    DIALOG END CB.HNDL, 0
                                END IF
                    
                            END SELECT
                    
                        END SELECT
                    
                    END FUNCTION
                    
                    
                    '------------------------------------------------------------------------------
                    ' Main entry point for the application
                    '------------------------------------------------------------------------------
                    FUNCTION PBMAIN () AS LONG
                    
                        LOCAL hDlg AS DWORD
                    
                        '----------------------------------------------------------------
                        DIALOG FONT "Times New Roman", 16
                    
                        DIALOG NEW 0, "DDT Progress bar demo",,, 140, 100, %WS_CAPTION OR %WS_SYSMENU TO hDlg
                        DIALOG SET COLOR hDlg, -1, RGB(222,192,192)
                    
                        '----------------------------------------------------------------
                        CONTROL ADD LABEL, hDlg, -1, "Press Start to show action", 5, 35, 130, 10, %SS_CENTER
                        CONTROL SET COLOR  hDlg, -1, -1, RGB(222,192,192)
                    
                        CONTROL ADD BUTTON, hDlg, %IDOK,     "&Start",  18, 80, 50, 14
                        CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Close", 72, 80, 50, 14
                        CONTROL ADD LABEL, HdLG, %ID_OffsetLBL, "Offset from Start (1 to 150)",5,57,105,10
                        CONTROL ADD LABEL, hDlg, %ID_EndOffsetLbl, "Offset from end (200 to start offset)",5,68,105,10
                        CONTROL ADD TEXTBOX, hDLG, %ID_OFFSETTXT, "",108,57,20,10 ,%ES_NUMBER
                        CONTROL ADD TEXTBOX, hdlg, %ID_EndOffsetTxt,"",108,68,20,10,%ES_NUMBER
                        DIALOG FONT "MS Sans Serif", 8
                        MainDlg = hDlg
                        '----------------------------------------------------------------
                        DIALOG SHOW MODAL hDlg CALL MainDlgProc
                    
                    END FUNCTION '(\Here both the graphic and progress bar visible for comparison).
                    __________________
                    Barry

                    Comment


                    • #11
                      I fooled around with Barry's example with the aim of incorporating into existing (and future) programs. It was very easy to C&P the relevant sections below to do it. (marked by '----------- Progress Bar ..)

                      '
                      Code:
                      'http://www.powerbasic.com/support/pbforums/showthread.php?t=39600
                      'PBWIN 9.00 - WinApi 05/2008 - XP Pro SP3
                      #Compile Exe                                
                      #Dim All 
                      #Include "WIN32API.INC"
                      #Include "COMDLG32.INC"
                      '------------ Progress Bar Setup & Macros ------------------------------------------------------
                      '------Begin Top of program -----------
                       %ID_PROGRESS = 3000
                       %ID_PROGRLBL = 3001
                      '
                       Type ProgressBar_Type
                          Owner As Dword 'parent dialog handle
                          Wdth As Long
                          Height As Long        
                          Title As String * 60 'should be enough
                          Start As Long 'start counting
                          Finish As Long 'done counting
                       End Type                   
                      '
                      Macro ProgressBar_Standard_Setup 
                      '    pb.Dialg = hDlg 'Parent dialog
                           pb.Title = "ProgressBar Title"
                           pb.Wdth = 400  'set width of bar
                           pb.Height = 30 'set height
                      End Macro
                      '
                      Macro ProgressBar_Draw
                          Local hPbar As Dword 'just needed for setup
                          Dialog New pb.Owner, pb.Title,,, pb.Wdth, pb.Height, %DS_MODALFRAME Or %WS_CAPTION, 0 To hPbar
                          Control Add Label,  hPbar, %ID_PROGRLBL, "Processing:", 5,  2, pb.Wdth - 10, 10 'pb.Height \ 2
                          Control Add ProgressBar, hPbar, %ID_PROGRESS, "",  5, 13, pb.Wdth - 10, 15, %WS_CHILD Or %WS_VISIBLE Or %PBS_SMOOTH
                          Dialog Show Modeless hPbar
                         ' Ensures all controls are drawn before starting
                           Dialog ReDraw hPbar 'pb.Owner
                           ProgressBar Set Range hPbar, %ID_PROGRESS, pb.Start, pb.finish
                           ProgressBar Set Step  hPbar, %ID_PROGRESS, 1
                      End Macro
                      '------------ End Progress Bar Setup & Macros ------------------------------------------------------
                      '
                      Function PBMain
                          Local ctr As Long                        
                      '
                      '----------- Progress Bar Inside Procedure ----------------
                          Local PB As ProgressBar_Type
                          ProgressBar_Standard_Setup 'get generic size
                           pb.Owner = 0 ' normally the handle of the parent dialog
                           pb.Title = "ProgressBar Counter" 'Anything you want
                           pb.Start = 1     'used to measure progress
                           pb.Finish = 1000 'change to outer range of loop
                          ProgressBar_Draw 'draw it     
                      '----------- End Progress Bar Inside Procedure ----------------
                      '    
                           Local s$
                            s$ = "Processing Item #,    #% Done"
                      '    
                          For ctr = 1 To 1000 'do work here      
                      '    
                      '----------- Progress Bar Inside loop --------    
                            ProgressBar Step hPbar, %ID_PROGRESS
                            Control Set Text hPbar, %ID_PROGRLBL, Using$(s$, ctr, ctr / pb.Finish * 100)
                            Dialog DoEvents ' allow processor to breathe
                      '----------- End Progress Bar Inside Loop --------    
                          Next ctr     
                          
                      '----------- Progress Bar End --------    
                          Dialog End hPbar, 0           ' Done, so close PBar
                      '----------- Progress Bar Done --------    
                      '    
                      End Function 
                      '
                      =====================================
                      "Problems worthy of attack
                      prove their worth by fighting back."
                      Paul Erdos (1913-1996)
                      =====================================
                      It's a pretty day. I hope you enjoy it.

                      Gösta

                      JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                      LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                      Comment

                      Working...
                      X