BCX_PROGRESSBAR function
Purpose: BCX_PROGRESSBAR function draws a rectangle that
is filled gradually with the system highlight color as an operation
progresses. An application can use this to indicate the progress of
a lengthy operation.
Syntax:
hCtl = BCX_PROGRESSBAR(Text$, _
hWndParent, _
hCtlID%, _
Xpos%, _
Ypos%, _
Width%, _
Height% _
[,WinStyle%] _
[,ExWinStyle%])
Parameters:
- Text$ Caption for Progress Bar if WS_CAPTION window
style is used. The default window style for the Progress Bar does
not include the WS_CAPTION window style.
- hWndParent Handle to the parent window of the Progress
Bar being created.
- hCtlID% Specifies the identifier of the Progress Bar
being created. The identifier is an integer value used by the
Progress Bar being created to notify its parent about events. The
identifier must be unique for each control created with the same
parent window.
- Xpos% Specifies the initial horizontal position of the
Progress Bar being created. X% is the x-coordinate of the
upper-left corner of the Progress Bar being created relative to the
upper-left corner of the parent window's client area.
- Ypos% Specifies the initial vertical position of the
Progress Bar being created. Y% is the initial y-coordinate of the
upper-left corner of the Progress Bar being created relative to the
upper-left corner of the parent window's client area.
- Width% Specifies the width, in device units or, if the
PIXELS optional parameter was specified in
the GUI
statement, in pixels , of the Progress Bar being created.
- Height% Specifies the height, in device units or, if the
PIXELS optional parameter was specified in
the GUI
statement, in pixels , of the Progress Bar being created.
- WinStyle% [OPTIONAL] If the
WinStyle% parameter is used, the default Window Style for a
BCX_PROGRESSBAR control, WS_CHILD | WS_VISIBLE, is replaced with
the value in WinStyle%. See your Win32 SDK or PSDK Reference help
for more information about valid Window Styles.
- ExWinStyle% [OPTIONAL] The
default Extended Window Style for a BCX_PROGRESSBAR control is
WS_EX_CLIENTEDGE. See your Win32 SDK or PSDK Reference help for
more information about valid Extended Window Styles.
Return Value:
- hCtl, the return value, is a handle to the new progress
bar if the function succeeds. If the function fails, the return
value is NULL.
|
Here is an example of the BCX_PROGRESSBAR function.
'*******************************************************************
' The BCX_PROGRESSBAR uses a built in range of 0 to 100
'*******************************************************************
GUI "PROGBAR"
GLOBAL ProgressBar AS CONTROL
SUB FORMLOAD
LOCAL Form1 AS CONTROL
LOCAL Button AS CONTROL
Form1 = BCX_FORM("BCX Progressbar Demo",0, 0, 200, 100)
ProgressBar = BCX_PROGRESSBAR("", Form1, 123, 0, 5, 200, 10)
Button = BCX_BUTTON("Test", Form1, 456, 75, 40, 50 , 15)
CENTER(Form1)
SHOW(Form1)
END SUB
BEGIN EVENTS
IF CBCTL = 456 THEN CALL AnimateProgressBar(ProgressBar)
SELECT CASE CBMSG
CASE WM_CLOSE
DestroyWindow(Form1)
EXIT FUNCTION
END SELECT
END EVENTS
SUB AnimateProgressBar(hWnd AS HWND)
REPEAT 100 ' Go from 0 to 100
SendMessage(hWnd, PBM_STEPIT,0,0)
Sleep(25) ' Slow it down!
END REPEAT
MsgBox "Operation 100% Complete"
SendMessage(hWnd, PBM_SETPOS,0,0)
END SUB