TrackBarCtrl Control

Purpose

Creates a track bar control in the current active form, window, or dialog.

Syntax

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

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

Description

A TrackBarCtrl is a window that contains a slider and optional tick marks. When the user moves the slider, using either the mouse or the direction keys, the trackbar sends notification messages to indicate the change.

A track bar notifies its parent window of user actions by sending the parent WM_HSCROLL or WM_VSCROLL messages that should be handled in the form's _MessageProc sub.

Example

Public Const TB_LINEUP              = 0

Public Const TB_LINEDOWN            = 1

Public Const TB_PAGEUP              = 2

Public Const TB_PAGEDOWN            = 3

Public Const TB_THUMBPOSITION       = 4

Public Const TB_THUMBTRACK          = 5

Public Const TB_TOP                 = 6

Public Const TB_BOTTOM              = 7

Public Const TB_ENDTRACK            = 8

Form frm

TrackBarCtrl "", 10, 20, 20, 150, 30

Global Handle hWndTrack = GetDlgItem(frm.hWnd, 10)

Do

Sleep

Until Me Is Nothing

 

Sub frm_MessageProc(hWnd%, Mess%, wParam%, lParam%, retval%, ValidRet?)

Switch Mess

Case WM_HSCROLL, WM_VSCROLL

If lParam = hWndTrack

'Trace LoWord(wParam)

Switch LoWord(wParam'Notification Message (Reason, sent)

Case TB_BOTTOM         'VK_END

Case TB_ENDTRACK       'WM_KEYUP (the user released a key that sent a relevant virtual key code)

Case TB_LINEDOWN       'VK_RIGHT Or VK_DOWN

Case TB_LINEUP         'VK_LEFT Or VK_UP

Case TB_PAGEDOWN       'VK_NEXT (the user clicked the channel below or to the right of the slider)

Case TB_PAGEUP         'VK_PRIOR (the user clicked the channel above or to the left of the slider)

Case TB_THUMBPOSITION  'WM_LBUTTONUP following a TB_THUMBTRACK notification message

Case TB_THUMBTRACK     'Slider movement (the user dragged the slider)

Case TB_TOP            'VK_HOME

EndSwitch

EndIf

EndSwitch

EndSub

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: 25/10/2014 by James Gaite}