CONTROL ADD SCROLLBAR

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > UI (User Interface) > CONTROLS > Control Types > ScrollBar Control > ScrollBar Control Creation >

CONTROL ADD SCROLLBAR

 

Description

 

Add a scrollbar control inside a dialog.

 

Syntax

 

hndl = CONTROL ADD SCROLLBAR [Name ControlName], hwnd, ctrlID, txt, xPos, yPos, Width, Height [, [Style] [, [ExStyle]]] [[,] CALL CallBack]

 

Returns

 

Number

Control window handler.

 

Parameters

 

Name

Type

Optional

Meaning

ControlName

String

Yes

Optional name for the control.

 

This name must be globally unique, and is used to create a global variable to be used with control name methods and properties.

hwnd

Number

No

Handle of the dialog containing the control

ctrlID

Number

No

Control identifier

txt

String

No

A text expression representing the text you want to assign to the control.

xPos

Number

No

Horizontal position of the control inside the dialog

yPos

Number

No

Vertical position of the control inside the dialog

Width

Number

No

Control width

Height

Number

No

Control height

Style

Number

Yes

Primary style of the control. See SCROLLBAR Style equates.

ExStyle

Number

Yes

Extended style of the control. See SCROLLBAR ExStyle equates.

CallBack

Function

Yes

Optional name of a Callback Function that receives all %WM_COMMAND and %WM_NOTIFY messages for the control.

 

If the Callback Function processes a message, it should return %TRUE (non-zero) to prevent the message being passed unnecessarily to the dialog callback (if one exists).

 

The dialog callback should also return %TRUE if the notification message is processed by that Callback Function.

 

Remarks

 

If the ampersand (&) character appears in the txt parameter, the letter that follows will become a control accelerator (hot-key) to enable the user to directly select the scroll bar control, simply by pressing and holding the ALT key while pressing the specified hot-key. For example, "&5" makes ALT+5 the hot-key. The actual text in txt is not displayed in a scroll bar control.

 

When the user clicks on a scroll bar, drags the thumb (also called the scroll box), or initiates a scroll event with the keyboard, a message is sent to the Callback Function designated for the control. If there is no Callback Function designated, the message is sent to the callback for the dialog.

 

%WM_HSCROLLSent when the user adjusts a horizontal scroll bar.
%WM_VSCROLLSent when the user adjusts a vertical scroll bar.

 

When a Callback Function receives a %WM_COMMAND message, it should explicitly test the value of CBCTL and CBCTLMSG to guarantee it is responding appropriately to the notification message.

 

When a Callback Function receives a %WM_HSCROLL or %WM_VSCROLL message, it should retrieve and set the scroll bar control settings through the GetScrollInfo and SetScrollInfo API function calls or using thinBasic functions dedicated to Scrollbar control. Be sure to use the %SB_CTL flag with these API functions, rather than the %SB_HORZ or %SB_VERT flags. See SCROLLINFO structure info.

 

Upon creation, a scrollbar has the following setup:

lower limit = 0

upper limit = 100

page size = 10

current position = 0

 

Restrictions

 

See also

 

Scrollbar control specific functions

 

Examples