TickFrequency, TickStyle Properties, GetNumTicks Method

Purpose

Returns or sets (the frequency of) tick marks on a Slider control.

Syntax

object.TickFrequency [= number%]

object.GetNumTicks

object.TickStyle [= number%]

object:Slider Ocx

Description

TickFrequency returns or sets the frequency of tick marks on a Slider control in relation to its range. For example, if the range is 100, and the TickFrequency property is set to 2, there will be one tick for every 2 increments in the range. To change the number of ticks, reset the Min or Max properties or the TickFrequency property.

GetNumTicks returns the number of ticks between the Min and Max properties.

TickStyle returns or sets the style (or positioning) of the tick marks displayed on the Slider control.

TickStyle = 0 - ticks at the bottom or at the right
TickStyle = 1 - ticks at the top or at the left
TickStyle = 2 - ticks at the both sides
TickStyle = 3 - none. no ticks

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 = 3

Data Ticks Top/Left,Ticks Bottom/Right,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

Slider

{Created by Sjouke Hamstra; Last updated: 25/10/2014 by James Gaite}