Slider Ocx

Purpose

Creates an Ocx Slider scrollbar control in the current active form, window, or dialog.

Syntax

Ocx Slider name [= text$] [, id] [, x, y, b, h] [, style%]

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

Description

A Slider control is a window containing a slider and optional tick marks. You can move the slider by dragging it, clicking the mouse to either side of the slider, or using the keyboard.

Slider controls are useful when you want to select a discrete value or a set of consecutive values in a range. For example, you could use a Slider to set the size of a displayed image by moving the slider to a given tick mark rather than by typing a number. To select a range of values, set the SelectRange property to True, and program the control to select a range when the SHIFT key is down.

The Align property allows a Slider control to be aligned to a side of the parent (basTop, basLeft, basRight, basBottom).

The Orientation property sets a value (basHorizO or basVertO) that determines whether the Slider control is oriented horizontally or vertically. The Align property always overrules the Orientation property.

Properties

Align | Appearance | BorderStyle | Enabled | Height | HelpContextID | hWnd | Index | LargeChange | Left | Max | Min | MouseCursor | MouseIcon | MousePointer | Name | Orientation | Parent | SelectRange | SelStart | SelLength | SmallChange | TabStop | Tag | TickFrequency | TickStyle | Top | ToolTiptext | Value | Visible | WhatsThisHelpID | Width

Methods

ClearSel | GetNumTicks | Move | Refresh | SetFocus | ZOrder

Events

Change | Click | GotFocus | LostFocus | KeyDown | Keyup | KeyPress | MouseDown | MouseUp | MouseMove | Scroll

Example

Local a$, n%

OpenW Center # 1, , , 400, 200

Me.BackColor = colBtnFace

Ocx Slider sli1 = "", 0, 0, 350, 45

.TickStyle = 0

.TickFrequency = 20

.Appearance = 3

Text 10, 50, "Minimum Value:" : Ocx TextBox tb(1) = "", 90, 49, 45, 15 : tb(1).BorderStyle = 1 : tb(1).Text = sli1.Min

Text 10, 68, "Maximum Value:" : Ocx TextBox tb(2) = "", 90, 67, 45, 15 : tb(2).BorderStyle = 1 : tb(2).Text = sli1.Max

Text 10, 86, "TickFrequency:" : Ocx TextBox tb(3) = "", 90, 85, 45, 15 : tb(3).BorderStyle = 1 : tb(3).Text = sli1.TickFrequency

Text 10, 104, "Tick Style:" : Ocx ComboBox cmb = "", 90, 101, 120, 22 : cmb.Style = 2

For n% = 0 To 3 : Read a$ : cmb.AddItem a$, n% : Next n% : cmb.ListIndex = 2

Data Ticks Bottom/Right,Ticks Top/Left,Ticks Both Sides,No Ticks

Do

Sleep

Loop Until Me Is Nothing

 

Sub cmb_Click

sli1.TickStyle = cmb.ItemData(cmb.ListIndex)

EndSub

 

Sub tb_Change(Index%)

Select Index%

Case 1 : sli1.Min = Val(tb(1).Text)

Case 2 : sli1.Max = Val(tb(2).Text)

Case 3 : sli1.TickFrequency = Val(tb(3).Text)

EndSelect

EndSub

See Also

Ocx, OcxOcx

Animation, CheckBox, ComboBox, Command, CommDlg, Form, Frame, Image, ImageList, Label, ListBox, ListView, MonthView, Option, ProgressBar, RichEdit, Scroll, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown

{Created by Sjouke Hamstra; Last updated: 28/06/2020 by James Gaite}