User Tools

Site Tools


progress_declare_a_progress_control_.htm
Navigation:  Language Reference > 8 - Controls > Control Declarations >====== PROGRESS (declare a progress control) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

PROGRESS, AT( ) [,CURSOR( )] [,USE( )] [,LAYOUT( )][,DISABLE] [,FULL] [,SCROLL] [,HIDE]

[,TRN] [,COLOR( )] [,DROPID( )] [,RANGE( )] [,SMOOTH( )] [,VERTICAL( )]

blk2blue.jpg

PROGRESS Places a control that displays the current progress of a batch process in the WINDOW or TOOLBAR.
AT Specifies the initial size and location of the control (PROP:AT). If omitted, default values are selected by the runtime library.
CURSOR Specifies a mouse cursor to display when the mouse is positioned over the control (PROP:CURSOR). If omitted, the WINDOW's CURSOR attribute is used, else the Windows default cursor is used.
USE The label of the variable containing the value of the current progress, or a field equate label to reference the control in executable code (PROP:USE).
LAYOUT Specifies the control's left-to-right or right-to-left display orientation (PROP:LAYOUT)
DISABLE Specifies the control appears dimmed when the WINDOW or APPLICATION is first opened (PROP:DISABLE).
FULL Specifies the control expands to occupy the entire size of the WINDOW for any missing AT attribute width or height parameter (PROP:FULL).
SCROLL Specifies the control scrolls with the window (PROP:SCROLL).
HIDE Specifies the control does not appear when the WINDOW or APPLICATION is first opened (PROP:HIDE). UNHIDE must be used to display it.
TRN Specifies the control transparently displays over the background (PROP:TRN).
COLOR Specifies a background color for the control (PROP:COLOR).
DROPID Specifies the control may serve as a drop target for drag-and-drop actions (PROP:DROPID).
RANGE Specifies the range of values the progress bar displays (PROP:RANGE). If omitted, the default range is zero (0) to one hundred (100).
SMOOTH Specifies a smooth incremental display of the progress control instead of the standard “block” format(PROP:Smooth).
VERTICAL Specifies to allow the progress control to operate from the bottom of the control to the top. If your progress control is positioned in a horizontal (left to right) display format, you should resize the progress control accordingly.

The PROGRESS control declares a control that displays a progress bar in a WINDOW or TOOLBAR (not valid in a REPORT). This usually displays the current percentage of completion of a batch process.

If a variable is named as the USE attribute, the progress bar is automatically updated whenever the value in that variable changes. If the USE attribute is a field equate label, you must directly update the display by assigning a value (within the range defined by the RANGE attribute) to the control's PROP:progress property (an undeclared property equate – see Undeclared Properties).

This control cannot receive input focus.

Events Generated:

EVENT:Drop A successful drag-and-drop to the control.

Example:

BackgroundProcess  PROCEDURE     !Background processing batch process

ProgressVariable  LONG

Win  WINDOW('Batch Processing…'),AT(,,400,400),TIMER(1),MDI,CENTER

     PROGRESS,AT(100,100,200,20),USE(ProgressVariable),RANGE(0,200)

     PROGRESS,AT(100,140,200,20),USE(?ProgressBar),RANGE(0,200)

     BUTTON('Cancel'),AT(190,300,20,20),STD(STD:Close)

    END

CODE

OPEN(Win)

OPEN(File)

?ProgressVariable{PROP:rangehigh} = RECORDS(File)

?ProgressBar{PROP:rangehigh} = RECORDS(File)

SET(File)                      !Set up a batch process

ACCEPT

 CASE EVENT()

 OF EVENT:CloseWindow

  BREAK

 OF EVENT:Timer                !Process records when timer allows it

  ProgressVariable += 3        !Auto-updates 1st progress bar

  LOOP 3 TIMES

   NEXT(File)

   IF ERRORCODE()

    BREAK

   END

   ?ProgressBar{PROP:progress} = ?ProgressBar{PROP:progress} + 1

                               !Manually update 2nd progress bar

   !Perform some batch processing code HERE

  END

 END

END

CLOSE(File)

progress_declare_a_progress_control_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1