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{Window styles
}
21 \begin{twocollist
}\itemsep=
0pt
22 \twocolitem{\windowstyle{wxSL
\_HORIZONTAL}}{Displays the slider horizontally.
}
23 \twocolitem{\windowstyle{wxSL
\_VERTICAL}}{Displays the slider vertically.
}
24 \twocolitem{\windowstyle{wxSL
\_AUTOTICKS}}{Displays tick marks.
}
25 \twocolitem{\windowstyle{wxSL
\_LABELS}}{Displays minimum, maximum and value labels.
}
26 \twocolitem{\windowstyle{wxSL
\_LEFT}}{Displays ticks on the left, if a vertical slider.
}
27 \twocolitem{\windowstyle{wxSL
\_RIGHT}}{Displays ticks on the right, if a vertical slider.
}
28 \twocolitem{\windowstyle{wxSL
\_TOP}}{Displays ticks on the top, if a horizontal slider.
}
29 \twocolitem{\windowstyle{wxSL
\_SELRANGE}}{Allows the user to select a range on the slider. Windows
95 only.
}
32 See also
\helpref{window styles overview
}{windowstyles
}.
34 \wxheading{Event handling
}
36 To process input from a slider, use one of these event handler macros to direct input to member
37 functions that take a
\helpref{wxScrollEvent
}{wxscrollevent
} argument:
41 \twocolitem{{\bf EVT
\_COMMAND\_SCROLL(id, func)
}}{Catch all scroll commands.
}
42 \twocolitem{{\bf EVT
\_COMMAND\_TOP(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
43 \twocolitem{{\bf EVT
\_COMMAND\_BOTTOM(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
44 \twocolitem{{\bf EVT
\_COMMAND\_LINEUP(id, func)
}}{Catch a line up command.
}
45 \twocolitem{{\bf EVT
\_COMMAND\_LINEDOWN(id, func)
}}{Catch a line down command.
}
46 \twocolitem{{\bf EVT
\_COMMAND\_PAGEUP(id, func)
}}{Catch a page up command.
}
47 \twocolitem{{\bf EVT
\_COMMAND\_PAGEDOWN(id, func)
}}{Catch a page down command.
}
48 \twocolitem{{\bf EVT
\_COMMAND\_THUMBTRACK(id, func)
}}{Catch a thumbtrack command (continuous movement of the scroll thumb).
}
49 \twocolitem{{\bf EVT
\_SLIDER(id, func)
}}{Process a wxEVT
\_COMMAND\_SLIDER\_UPDATED event,
50 when the slider is moved. Though provided for backward compatibility, this is obsolete.
}
55 \helpref{Event handling overview
}{eventhandlingoverview
},
\helpref{wxScrollBar
}{wxscrollbar
}
57 \latexignore{\rtfignore{\wxheading{Members
}}}
59 \membersection{wxSlider::wxSlider
}\label{wxsliderconstr
}
61 \func{}{wxSlider
}{\void}
65 \func{}{wxSlider
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
66 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
67 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
68 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
69 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
70 \param{const wxString\&
}{name = ``slider"
}}
72 Constructor, creating and showing a slider.
74 \wxheading{Parameters
}
76 \docparam{parent
}{Parent window. Must not be NULL.
}
78 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
80 \docparam{value
}{Initial position for the slider.
}
82 \docparam{minValue
}{Minimum slider position.
}
84 \docparam{maxValue
}{Maximum slider position.
}
86 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
88 \docparam{style
}{Window style. See
\helpref{wxSlider
}{wxslider
}.
}
90 \docparam{validator
}{Window validator.
}
92 \docparam{name
}{Window name.
}
96 \helpref{wxSlider::Create
}{wxslidercreate
},
\helpref{wxValidator
}{wxvalidator
}
98 \membersection{wxSlider::
\destruct{wxSlider
}}
100 \func{void
}{\destruct{wxSlider
}}{\void}
102 Destructor, destroying the slider.
104 \membersection{wxSlider::ClearSel
}\label{wxsliderclearsel
}
106 \func{void
}{ClearSel
}{\void}
108 Clears the selection, for a slider with the
{\bf wxSL
\_SELRANGE} style.
114 \membersection{wxSlider::ClearTicks
}\label{wxsliderclearticks
}
116 \func{void
}{ClearTicks
}{\void}
124 \membersection{wxSlider::Create
}\label{wxslidercreate
}
126 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
127 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
128 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
129 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
130 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
131 \param{const wxString\&
}{name = ``slider"
}}
133 Used for two-step slider construction. See
\helpref{wxSlider::wxSlider
}{wxsliderconstr
}\rtfsp
136 \membersection{wxSlider::GetLineSize
}\label{wxslidergetlinesize
}
138 \constfunc{int
}{GetLineSize
}{\void}
140 Returns the line size.
144 \helpref{wxSlider::SetLineSize
}{wxslidersetlinesize
}
146 \membersection{wxSlider::GetMax
}\label{wxslidergetmax
}
148 \constfunc{int
}{GetMax
}{\void}
150 Gets the maximum slider value.
154 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
156 \membersection{wxSlider::GetMin
}\label{wxslidergetmin
}
158 \constfunc{int
}{GetMin
}{\void}
160 Gets the minimum slider value.
164 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
166 \membersection{wxSlider::GetPageSize
}\label{wxslidergetpagesize
}
168 \constfunc{int
}{GetPageSize
}{\void}
170 Returns the page size.
174 \helpref{wxSlider::SetPageSize
}{wxslidersetpagesize
}
176 \membersection{wxSlider::GetSelEnd
}\label{wxslidergetselend
}
178 \constfunc{int
}{GetSelEnd
}{\void}
180 Returns the selection end point.
188 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
190 \membersection{wxSlider::GetSelStart
}\label{wxslidergetselstart
}
192 \constfunc{int
}{GetSelStart
}{\void}
194 Returns the selection start point.
202 \helpref{wxSlider::GetSelEnd
}{wxslidergetselend
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
204 \membersection{wxSlider::GetThumbLength
}\label{wxslidergetthumblength
}
206 \constfunc{int
}{GetThumbLength
}{\void}
208 Returns the thumb length.
216 \helpref{wxSlider::SetThumbLength
}{wxslidersetthumblength
}
218 \membersection{wxSlider::GetTickFreq
}\label{wxslidergettickfreq
}
220 \constfunc{int
}{GetTickFreq
}{\void}
222 Returns the tick frequency.
230 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
232 \membersection{wxSlider::GetValue
}\label{wxslidergetvalue
}
234 \constfunc{int
}{GetValue
}{\void}
236 Gets the current slider value.
240 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
},
\rtfsp
241 \helpref{wxSlider::SetValue
}{wxslidersetvalue
}
243 \membersection{wxSlider::SetRange
}\label{wxslidersetrange
}
245 \func{void
}{SetRange
}{\param{int
}{ minValue
},
\param{int
}{ maxValue
}}
247 Sets the minimum and maximum slider values.
251 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
}
253 \membersection{wxSlider::SetTickFreq
}\label{wxslidersettickfreq
}
255 \func{void
}{SetTickFreq
}{\param{int
}{n
},
\param{int
}{pos
}}
257 Sets the tick mark frequency and position.
259 \wxheading{Parameters
}
261 \docparam{n
}{Frequency. For example, if the frequency is set to two, a tick mark is displayed for
262 every other increment in the slider's range.
}
264 \docparam{pos
}{Position. Must be greater than zero. TODO: what is this for?
}
272 \helpref{wxSlider::GetTickFreq
}{wxslidergettickfreq
}
274 \membersection{wxSlider::SetLineSize
}\label{wxslidersetlinesize
}
276 \func{void
}{SetLineSize
}{\param{int
}{lineSize
}}
278 Sets the line size for the slider.
280 \wxheading{Parameters
}
282 \docparam{lineSize
}{The number of steps the slider moves when the user moves it up or down a line.
}
286 \helpref{wxSlider::GetLineSize
}{wxslidergetlinesize
}
288 \membersection{wxSlider::SetPageSize
}\label{wxslidersetpagesize
}
290 \func{void
}{SetPageSize
}{\param{int
}{pageSize
}}
292 Sets the page size for the slider.
294 \wxheading{Parameters
}
296 \docparam{pageSize
}{The number of steps the slider moves when the user pages up or down.
}
300 \helpref{wxSlider::GetPageSize
}{wxslidergetpagesize
}
302 \membersection{wxSlider::SetSelection
}\label{wxslidersetselection
}
304 \func{void
}{SetSelection
}{\param{int
}{startPos
},
\param{int
}{endPos
}}
308 \wxheading{Parameters
}
310 \docparam{startPos
}{The selection start position.
}
312 \docparam{endPos
}{The selection end position.
}
320 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::GetSelEnd
}{wxslidergetselend
}
322 \membersection{wxSlider::SetThumbLength
}\label{wxslidersetthumblength
}
324 \func{void
}{SetThumbLength
}{\param{int
}{len
}}
326 Sets the slider thumb length.
328 \wxheading{Parameters
}
330 \docparam{len
}{The thumb length.
}
338 \helpref{wxSlider::GetThumbLength
}{wxslidergetthumblength
}
340 \membersection{wxSlider::SetTick
}\label{wxslidersettick
}
342 \func{void
}{SetTick
}{\param{int
}{ tickPos
}}
344 Sets a tick position.
346 \wxheading{Parameters
}
348 \docparam{tickPos
}{The tick position.
}
356 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
358 \membersection{wxSlider::SetValue
}\label{wxslidersetvalue
}
360 \func{void
}{SetValue
}{\param{int
}{ value
}}
362 Sets the slider position.
364 \wxheading{Parameters
}
366 \docparam{value
}{The slider position.
}
370 \helpref{wxSlider::GetValue
}{wxslidergetvalue
}