pocket programs

Home
Products
Download
Licences
Support
Contact
DateTimePicker
MonthCal
Trackbar
-Methods
-Styles
-Constants
-Example
Up-Down
Keypad
Sketch
Progressbar
Buy-Now
Support
Contact

Trackbar

PP Controls offers trackbar controls that contain a slider and optional tick marks. The user moves the slider, using either the stylus or the direction keys. Labels can be added and aligned automatically. In addition a buddy window (i.e. a Textbox) whose value is updated as the slider is moved. Using a buddy textbox in this method allows for events to be supported.


Trackbar - Methods & Properties

NewTrackbar

Long hWnd = PPCtrl.NewTrackbar(hWnd, dwStyle)

Creates a new Trackbar and returns the handle of the new control.

hWnd hWnd of parent form (or frame) or placeholder (hWnd)
DwStyle Specifies the style of the window being created.
If the style PC_PLACEHOLDER is specified, then hWnd refers to the control to be used as a as placeholder. The new Trackbar control will be placed on the form at the same location as this control, with the same size and font. The place-holder control is then hidden. Note: If PC_PLACEHOLDER style is not given, then hWnd specifies the parent window for the new control. The new control is positioned according to the current values of PPCtrl.Left, PPCtrl.Top, PPCtrl.Width and PPCtrl.Height. The font of the parent window is used.
Tb1 = PPCtrl.NewTrackbar(Text1.hWn, TBS_VERT + PC_PLACEHOLDER)<br> Tb1 = PPCtrl.NewTrackbar(Frame1.hWnd, TBS_AUTOTICS)

Min, Max

PPCtrl.Min(hWnd) = long<br> PPCtrl.Max(hWnd) = long<br> long = PPCtrl.Min(hWnd)<br> long = PPCtrl.Max(hWnd)

Retrieves/Sets the current minimum and maximum positions for the trackbar control specified by hWnd.

PPCtrl.Min(dt1) = 1 PPCtrl.Max(Tb1) = 100

Pos

PPCtrl.Pos(hWNd) = long<br> long = PPCtrl.Pos(hWnd)

Retrieves/Sets the currently position of the slider of the trackbar control specified by hWnd.

PPCtrl.Pos(Tb1)=now<br> level=PPCtrl.Pos(Tb1)

Value

PPCtrl.Value(hWNd) = long<br> long = PPCtrl.Value(hWnd)

Retrieves/Sets the currently position of the slider of the trackbar control specified by hWnd. (Identical in function to pos)

PPCtrl.Value(Tb1)=now<br> level=PPCtrl.Value(Tb1)

SelStart, SelEnd

PPCtrl.SelStart(hWnd) = long<br> PPCtrl.SelEnd(hWnd) = long

Sets the start/end of the current selection range for the trackbar control specified by hWnd based on a given format string. The trackbar highlights the available range and displays triangular tick marks at the start and end.

PPCtrl.SelStart(TB1)=20<br> PPCtrl.SelEnd(Tb1)=40

TicFreq

PPCtrl.TicFreq(hWnd) = long

Sets the interval for the automatic tick marks, for the trackbar control specified by hWnd based on a given format string. You can use the TBS_AUTOTICKS style to automatically display additional tick marks at regular intervals along the trackbar. By default, a TBS_AUTOTICKS trackbar displays a tick mark at each increment of the trackbar's range.

PPCtrl.TicFreq(TB1)=10

NewTick

PPCtrl.NewTick(hWnd) = long

Sets a tick mark in the trackbar specified by hWnd at the specified position.

PPCtrl.NewTick(TB1)=35

BuddyLow, BuddyHigh

PPCtrl.BuddyLow(hWnd) = hWnd<br> PPCtrl.BuddyHigh(hWnd) = hWnd

Assigns a window as the buddy label window for the trackbar control specified by hWnd. Trackbar buddy windows are automatically displayed in a location relative to the control's orientation (horizontal or vertical).

PPCtrl.BuddyLow(TB1)=Text1.hWnd<br> PPCtrl.BuddyHigh(TB1)=Text2.hWnd

Buddy

PPCtrl.Buddy(hWnd) = hWnd

Sets a control as the buddy window for the trackbar control specified by hWnd. The buddy window of a trackbar is automatically updated as the slider is moved.

PPCtrl.Buddy(TB1)=Textbox1.hwnd

LabelLow, LabelHigh

PPCtrl.LabelLow(hWnd) = string<br> PPCtrl.LabelHigh(hWnd) = string

Creates and assigns a control as the buddy label window for the trackbar control specified by hWnd. Trackbar buddy windows are automatically displayed in a location relative to the control's orientation (horizontal or vertical). If a place holder is specified when creating the trackbar, then the font of the placeholder is used for the label control.

PPCtrl.LabelLow(TB1)=”Label 1”<br> PPCtrl.LabelHigh(TB1)=”Label 2”

Trackbar – Styles

TBS_AUTOTICKS

The trackbar control has a tick mark for each increment in its range of values.

TBS_BOTH

The trackbar control displays tick marks on both sides of the control. This will be both top and bottom when used with TBS_HORZ or both left and right if used with TBS_VERT.

TBS_BOTTOM

The trackbar control displays tick marks below the control. This style is valid only with TBS_HORZ.

TBS_ENABLESELRANGE

The trackbar control displays a selection range only. The tick marks at the starting and ending positions of a selection range are displayed as triangles (instead of vertical dashes), and the selection range is highlighted.

TBS_HORZ

The trackbar control is oriented horizontally. This is the default orientation.

TBS_LEFT

The trackbar control displays tick marks to the left of the control. This style is valid only with TBS_VERT.

TBS_NOTHUMB

The trackbar control does not display a slider.

TBS_NOTICKS

The trackbar control does not display any tick marks.

TBS_RIGHT

The trackbar control displays tick marks to the right of the control. This style is valid only with TBS_VERT.

TBS_TOP

The trackbar control displays tick marks above the control. This style is valid only with TBS_HORZ.

TBS_VERT

The trackbar control is oriented vertically.

Trackbar - Constants

Const TBS_AUTOTICKS = &H1 ' automatically set tick position Const TBS_VERT = &H2 ' vertical trackbar Const TBS_HORZ = &H0 ' Horizontal trackbar Const TBS_TOP = &H4 ' tick marks above trackbar Const TBS_BOTTOM = &H0 ' tick marks below trackbar Const TBS_LEFT = &H4 ' tick marks to left of trackbar Const TBS_RIGHT = &H0 ' tick marks to right of trackbar Const TBS_BOTH = &H8 ' tick marks on both sides of trackbar Const TBS_NOTICKS = &H10 ' trackbar will not display any tick marks. Const TBS_ENABLESELRANGE = &H20 ' trackbar can display a selection range Const TBS_NOTHUMB = &H80 ' trackbar does not display a slider.

Trackbar - Example

Dim PPCtrl As Object Set PPCtrl = CreateObject("PPControl.Controls") style = TBS_AUTOTICKS + TBS_BOTH + TBS_HORZ Tracker1 = PPCtrl.NewTrackBar(FrameTracker.hWnd, style, Text5.hWnd) PPCtrl.Min(Tracker1) = 1 PPCtrl.Max(Tracker1) = 10 PPCtrl.BuddyLow(Tracker1) = Text9.hWnd PPCtrl.LabelHigh(Tracker1) = Text10.hwnd style = TBS_VERT + TBS_ENABLESELRANGE Tracker2 = PPCtrl.NewTrackBar(FrameTracker.hWnd, style, Text6.hWnd) PPCtrl.Min(Tracker2) = 1 PPCtrl.Max(Tracker2) = 100 PPCtrl.ticfreq(Tracker2) = 10 PPCtrl.SelStart(Tracker2) = 20 PPCtrl.SelEnd(Tracker2) = 50 PPCtrl.LabelLow(Tracker2) = “Start” PPCtrl.LabelHigh(Tracker2) = “End” PPCtrl.Pos(Tracker2)=75 PPCtrl.Buddy(Tracker2)=Text15.hwnd Private Sub Text15_Change() If CLng(Text15.Text) > 50 Then PPCtrl.pos(Tracker2) = 50 End If End Sub