ScrollBar Control

Purpose

Creates a scroll-bar control in the current active form or dialog box.

Syntax

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

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

Description

The ScrollBar statement creates a scroll-bar control. The control is a rectangle that contains a scroll box and has direction arrows at both ends. The scroll-bar control sends a notification message to its parent whenever the user clicks the mouse in the control. The parent is responsible for updating the scroll-box position. Scroll-bar controls can be positioned anywhere in a window and used whenever needed to provide scrolling input.

style% specifies a combination (or none) of the following styles: WS_TABSTOP, WS_GROUP, and WS_DISABLED. In addition to these styles, the style parameter may contain a combination (or none) of the SCROLLBAR-class styles. If you do not specify a style, the default style is SBS_HORZ.

SBS_HORZ($0000) specifies a horizontal scroll bar.

SBS_VERT($0001) specifies a vertical scroll bar.

SBS_TOPALIGN($0002) used together with SBS_HORZ, to set the scroll bar to the top of the rectangle specified in CreateWindowEx().

SBS_LEFTALIGN($0002) used together with SBS_VERT to set the scroll bars to the left side in the parent window.

SBS_BOTTOMALIGN($0004) used together with SBS_HORZ, to set the scroll bar to the bottom of the parent window.

SBS_RIGHTALIGN ($0004) used together with SBS_VERT to set the scroll bars to the right side in the parent window.

SBS_SIZEBOXTOPLEFTALIGN ($0002) used together with SBS_SIZEBOX to align the upper left corner of the Sizebox with the upper left corner of the parent window.

SBS_SIZEBOXBOTTOMRIGHTALIGN ($0004) used together with SBS_SIZEBOX to align the upper left corner of the Sizebox with the bottom right corner of the parent window.

SBS_SIZEBOX($0008) creates a Sizebox, which - as long as no SBS_SIZEBOXTOPLEFTALIGN and SBS_SIZEBOXBOTTOMRIGHTALIGN are given - has the dimensions specified in the parent window.

A scrollbar's state is set using SetScrollRange and SetScrollPos Windows API functions.

A scrollbar control doesn't post a notification to the queue, so the parent's _Message() event sub cannot be used to respond to scrollbar messages. Instead, the scrollbar control sends WM_HSCROLL or WM_VSCROLL messages, which are handled in the parent's _MessageProc event sub.

Consult the MS Windows SDK or WinApi32.Hlp for more information about the ScrollBar control.

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: 12/05/14 by James Gaite}