1 \section{\class{wxSlider
}}\label{wxslider
}
3 A slider is a control with a handle which can be pulled
4 back and forth to change the value.
6 In Windows versions below Windows
95, a scrollbar is used to simulate the slider. In Windows
95,
7 the track bar control is used.
9 Slider events are handled in the same way as a scrollbar.
11 \wxheading{Derived from
}
13 \helpref{wxControl
}{wxcontrol
}\\
14 \helpref{wxWindow
}{wxwindow
}\\
15 \helpref{wxEvtHandler
}{wxevthandler
}\\
16 \helpref{wxObject
}{wxobject
}
18 \wxheading{Include files
}
22 \wxheading{Window styles
}
25 \begin{twocollist
}\itemsep=
0pt
26 \twocolitem{\windowstyle{wxSL
\_HORIZONTAL}}{Displays the slider horizontally.
}
27 \twocolitem{\windowstyle{wxSL
\_VERTICAL}}{Displays the slider vertically.
}
28 \twocolitem{\windowstyle{wxSL
\_AUTOTICKS}}{Displays tick marks.
}
29 \twocolitem{\windowstyle{wxSL
\_LABELS}}{Displays minimum, maximum and value labels.
}
30 \twocolitem{\windowstyle{wxSL
\_LEFT}}{Displays ticks on the left, if a vertical slider.
}
31 \twocolitem{\windowstyle{wxSL
\_RIGHT}}{Displays ticks on the right, if a vertical slider.
}
32 \twocolitem{\windowstyle{wxSL
\_TOP}}{Displays ticks on the top, if a horizontal slider.
}
33 \twocolitem{\windowstyle{wxSL
\_SELRANGE}}{Allows the user to select a range on the slider. Windows
95 only.
}
36 See also
\helpref{window styles overview
}{windowstyles
}.
38 \wxheading{Event handling
}
40 To process input from a slider, use one of these event handler macros to direct input to member
41 functions that take a
\helpref{wxScrollEvent
}{wxscrollevent
} argument:
45 \twocolitem{{\bf EVT
\_COMMAND\_SCROLL(id, func)
}}{Catch all scroll commands.
}
46 \twocolitem{{\bf EVT
\_COMMAND\_TOP(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
47 \twocolitem{{\bf EVT
\_COMMAND\_BOTTOM(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
48 \twocolitem{{\bf EVT
\_COMMAND\_LINEUP(id, func)
}}{Catch a line up command.
}
49 \twocolitem{{\bf EVT
\_COMMAND\_LINEDOWN(id, func)
}}{Catch a line down command.
}
50 \twocolitem{{\bf EVT
\_COMMAND\_PAGEUP(id, func)
}}{Catch a page up command.
}
51 \twocolitem{{\bf EVT
\_COMMAND\_PAGEDOWN(id, func)
}}{Catch a page down command.
}
52 \twocolitem{{\bf EVT
\_COMMAND\_THUMBTRACK(id, func)
}}{Catch a thumbtrack command (continuous movement of the scroll thumb).
}
53 \twocolitem{{\bf EVT
\_SLIDER(id, func)
}}{Process a wxEVT
\_COMMAND\_SLIDER\_UPDATED event,
54 when the slider is moved. Though provided for backward compatibility, this is obsolete.
}
59 \helpref{Event handling overview
}{eventhandlingoverview
},
\helpref{wxScrollBar
}{wxscrollbar
}
61 \latexignore{\rtfignore{\wxheading{Members
}}}
63 \membersection{wxSlider::wxSlider
}\label{wxsliderconstr
}
65 \func{}{wxSlider
}{\void}
69 \func{}{wxSlider
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
70 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
71 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
72 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
73 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
74 \param{const wxString\&
}{name = ``slider"
}}
76 Constructor, creating and showing a slider.
78 \wxheading{Parameters
}
80 \docparam{parent
}{Parent window. Must not be NULL.
}
82 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
84 \docparam{value
}{Initial position for the slider.
}
86 \docparam{minValue
}{Minimum slider position.
}
88 \docparam{maxValue
}{Maximum slider position.
}
90 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
92 \docparam{style
}{Window style. See
\helpref{wxSlider
}{wxslider
}.
}
94 \docparam{validator
}{Window validator.
}
96 \docparam{name
}{Window name.
}
100 \helpref{wxSlider::Create
}{wxslidercreate
},
\helpref{wxValidator
}{wxvalidator
}
102 \membersection{wxSlider::
\destruct{wxSlider
}}
104 \func{void
}{\destruct{wxSlider
}}{\void}
106 Destructor, destroying the slider.
108 \membersection{wxSlider::ClearSel
}\label{wxsliderclearsel
}
110 \func{void
}{ClearSel
}{\void}
112 Clears the selection, for a slider with the
{\bf wxSL
\_SELRANGE} style.
118 \membersection{wxSlider::ClearTicks
}\label{wxsliderclearticks
}
120 \func{void
}{ClearTicks
}{\void}
128 \membersection{wxSlider::Create
}\label{wxslidercreate
}
130 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
131 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
132 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
133 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
134 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
135 \param{const wxString\&
}{name = ``slider"
}}
137 Used for two-step slider construction. See
\helpref{wxSlider::wxSlider
}{wxsliderconstr
}\rtfsp
140 \membersection{wxSlider::GetLineSize
}\label{wxslidergetlinesize
}
142 \constfunc{int
}{GetLineSize
}{\void}
144 Returns the line size.
148 \helpref{wxSlider::SetLineSize
}{wxslidersetlinesize
}
150 \membersection{wxSlider::GetMax
}\label{wxslidergetmax
}
152 \constfunc{int
}{GetMax
}{\void}
154 Gets the maximum slider value.
158 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
160 \membersection{wxSlider::GetMin
}\label{wxslidergetmin
}
162 \constfunc{int
}{GetMin
}{\void}
164 Gets the minimum slider value.
168 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
170 \membersection{wxSlider::GetPageSize
}\label{wxslidergetpagesize
}
172 \constfunc{int
}{GetPageSize
}{\void}
174 Returns the page size.
178 \helpref{wxSlider::SetPageSize
}{wxslidersetpagesize
}
180 \membersection{wxSlider::GetSelEnd
}\label{wxslidergetselend
}
182 \constfunc{int
}{GetSelEnd
}{\void}
184 Returns the selection end point.
192 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
194 \membersection{wxSlider::GetSelStart
}\label{wxslidergetselstart
}
196 \constfunc{int
}{GetSelStart
}{\void}
198 Returns the selection start point.
206 \helpref{wxSlider::GetSelEnd
}{wxslidergetselend
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
208 \membersection{wxSlider::GetThumbLength
}\label{wxslidergetthumblength
}
210 \constfunc{int
}{GetThumbLength
}{\void}
212 Returns the thumb length.
220 \helpref{wxSlider::SetThumbLength
}{wxslidersetthumblength
}
222 \membersection{wxSlider::GetTickFreq
}\label{wxslidergettickfreq
}
224 \constfunc{int
}{GetTickFreq
}{\void}
226 Returns the tick frequency.
234 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
236 \membersection{wxSlider::GetValue
}\label{wxslidergetvalue
}
238 \constfunc{int
}{GetValue
}{\void}
240 Gets the current slider value.
244 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
},
\rtfsp
245 \helpref{wxSlider::SetValue
}{wxslidersetvalue
}
247 \membersection{wxSlider::SetRange
}\label{wxslidersetrange
}
249 \func{void
}{SetRange
}{\param{int
}{ minValue
},
\param{int
}{ maxValue
}}
251 Sets the minimum and maximum slider values.
255 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
}
257 \membersection{wxSlider::SetTickFreq
}\label{wxslidersettickfreq
}
259 \func{void
}{SetTickFreq
}{\param{int
}{n
},
\param{int
}{pos
}}
261 Sets the tick mark frequency and position.
263 \wxheading{Parameters
}
265 \docparam{n
}{Frequency. For example, if the frequency is set to two, a tick mark is displayed for
266 every other increment in the slider's range.
}
268 \docparam{pos
}{Position. Must be greater than zero. TODO: what is this for?
}
276 \helpref{wxSlider::GetTickFreq
}{wxslidergettickfreq
}
278 \membersection{wxSlider::SetLineSize
}\label{wxslidersetlinesize
}
280 \func{void
}{SetLineSize
}{\param{int
}{lineSize
}}
282 Sets the line size for the slider.
284 \wxheading{Parameters
}
286 \docparam{lineSize
}{The number of steps the slider moves when the user moves it up or down a line.
}
290 \helpref{wxSlider::GetLineSize
}{wxslidergetlinesize
}
292 \membersection{wxSlider::SetPageSize
}\label{wxslidersetpagesize
}
294 \func{void
}{SetPageSize
}{\param{int
}{pageSize
}}
296 Sets the page size for the slider.
298 \wxheading{Parameters
}
300 \docparam{pageSize
}{The number of steps the slider moves when the user pages up or down.
}
304 \helpref{wxSlider::GetPageSize
}{wxslidergetpagesize
}
306 \membersection{wxSlider::SetSelection
}\label{wxslidersetselection
}
308 \func{void
}{SetSelection
}{\param{int
}{startPos
},
\param{int
}{endPos
}}
312 \wxheading{Parameters
}
314 \docparam{startPos
}{The selection start position.
}
316 \docparam{endPos
}{The selection end position.
}
324 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::GetSelEnd
}{wxslidergetselend
}
326 \membersection{wxSlider::SetThumbLength
}\label{wxslidersetthumblength
}
328 \func{void
}{SetThumbLength
}{\param{int
}{len
}}
330 Sets the slider thumb length.
332 \wxheading{Parameters
}
334 \docparam{len
}{The thumb length.
}
342 \helpref{wxSlider::GetThumbLength
}{wxslidergetthumblength
}
344 \membersection{wxSlider::SetTick
}\label{wxslidersettick
}
346 \func{void
}{SetTick
}{\param{int
}{ tickPos
}}
348 Sets a tick position.
350 \wxheading{Parameters
}
352 \docparam{tickPos
}{The tick position.
}
360 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
362 \membersection{wxSlider::SetValue
}\label{wxslidersetvalue
}
364 \func{void
}{SetValue
}{\param{int
}{ value
}}
366 Sets the slider position.
368 \wxheading{Parameters
}
370 \docparam{value
}{The slider position.
}
374 \helpref{wxSlider::GetValue
}{wxslidergetvalue
}