ProgressCtrl Control

Purpose

Creates a Progress Bar control in the current active form, window, or dialog.

Syntax

ProgressCtrl text$, id%, x, y, w, h[, style%]

text$:control text
id%:control identifier
x, y, w, h:iexp
style%:the control styles

Description

A progress bar is a window that an application can use to indicate the progress of a lengthy operation. It consists of a rectangle that is gradually filled with the system highlight color as an operation progresses.

A progress bar's range represents the entire duration of the operation, and the current position represents the progress that the application has made toward completing the operation.

The minimum value in the range can be from 0 to 65,535. Likewise, the maximum value can be from 0 to 65,535. If you do not set the range values, the system sets the minimum value to 0 and the maximum value to 100.

The PBM_SETPOS message sets the position to a given value. The PBM_DELTAPOS message advances the position by adding a specified value to the current position.

The PBM_SETSTEP message allows you to specify a step increment for a progress bar. Subsequently, whenever you send the PBM_STEPIT message to the progress bar, the current position advances by the specified increment. By default, the step increment is set to 10.

Example

Dlg 3D On // 16 bit 3D effect

Global Enum PBM_SETRANGE = WM_USER + 1, _

PBM_SETPOS, PBM_DELTAPOS, _

PBM_SETSTEP, PBM_STEPIT, _

PBM_SETRANGE32, PBM_GETRANGE, _

PBM_GETPOS, PBM_SETBARCOLOR

Local a$ = "Test", i%, j%, x%

Dialog # 1, 10, 10, 400, 200, a$

ProgressCtrl "Hello", 10, 10, 30, _

375, 100, WS_CHILD | WS_BORDER

EndDialog

ShowDialog # 1

SendMessage Dlg(1, 10), PBM_SETRANGE, 0, MakeLong(100, 0)

// PBM_SETRANGE32 only > 65536 => only for NT/2000

'SendMessage Dlg(1, 10), PBM_SETRANGE32, 0, 100

SendMessage Dlg(1, 10), PBM_SETBARCOLOR, 0, RGB(255, 0, 0)

DoEvents

For i% = 0 To 100

SendMessage Dlg(1, 10), PBM_SETPOS, i%, 0

DoEvents

Delay 0.1 // a bit slower display

Next

Print "Please press a key"

KeyGet x%

Dlg 3D Off

CloseDialog # 1

Remarks

This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.

With the general Control statement any control type can be created.

See Also

Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}