HScMax, HScMin, HScPos, HScPage, HScStep, HScTrack Properties

Purpose

Sets and returns the horizontal scrollbar values for a Form.

Syntax

Form.HScMax [ = value ]

Form.HScMin [ = value ]

Form.HScPos [ = value ]

Form.HScPage [ = value ]

Form.HScStep [ = value ]

Form.HScTrack [ = value ]

value : Long exp

Description

Properties used to the horizontal scrollbar of a Form object.

HScPos is the value of the control, and can range from HScMin to HScMax, inclusive. It designates where the scroll bar button is positioned along the scroll bar.

HScMin is a number specifying the minimum value that the scroll bar can have. This number ranges from 0 to 30,000, but cannot be greater than the maximum value given in HScMax.

HScMax is a number specifying the maximum value that the scroll bar can have. This number ranges from 0 to 30,000. Setting HScMax to 0 makes the scroll bar disappear. To disable the scroll bar but keep it visible use ~EnableScrollBar(hWnd, SB_HORZ, ESB_DISABLE_BOTH) and to enable it again use ~EnableScrollBar(hWnd, SB_HORZ, ESB_ENABLE_BOTH).

HScStep is a number specifying the increment that the value is adjusted by when the scrollbar arrow is clicked.

HScPage is a number specifying the increment that the value is adjusted by when the page scroll region of a scroll bar is clicked.

HScTrack returns the current position of the scrollbar in the _HScrolling event sub. This sub called only when the thumb is being moved. The _HScroll event sub is called after the scrolling is complete.

Note: If you manually change either HScPos or HScTrack, you MUST adjust the value of the other; if not, the scrollbars will display odd and incorrect behaviour. Also, using the SetFocus method will reset both of these values to zero.

Default values: .HScPos = 0, .HScTrack = 0, .HScMin = 0, .HScStep = 1, HScPage = 100, .HScMax = 1000.

Example

Global Int32 a = 160, b = a / 2, n

Global Int32 iw = (5 * a) + 100 // Width of the actual work area

Global Int32 vw = (2 * a) + // Width of visible area within window

OpenW Fixed 1, , , vw + (Screen.cxFixedFrame * 2), 500 : Win_1.ControlBox = False

For n = 0 To 4 : Ocx Command cmd(n) = "Close Button " & n, ((n * a) + b), 200, 100, 22 : Next n

Me.ScrollBars = basHorizontal

Me.HScMin = 0

Me.HScStep = b / 2

Me.HScPage = a / 2

Me.HScMax = iw - vw + Me.HScPage // Width of Work Area - Width of Visible Area + HScPage

Do

Sleep

Until Me Is Nothing

 

Sub Win_1_HScroll

For n = 0 To 4 : cmd(n).Left = (((n * 200) + 100) - Me.HScPos) : Next n

EndSub

 

Sub Win_1_HScrolling

For n = 0 To 4 : cmd(n).Left = (((n * 200) + 100) - Me.HScTrack) : Next n

EndSub

 

Sub cmd_Click(Index%)

Win_1.Close

EndSub

Remarks

See Also

Form, _HScrolling, _HScroll, VScMax, VScMin, VScPos, VScPage, VScStep, VScTrack, _VScrolling, _VScroll

{Created by Sjouke Hamstra; Last updated: 08/03/2018 by James Gaite}