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 (NB: only displays the current value label under wxGTK)
}
31 \twocolitem{\windowstyle{wxSL
\_LEFT}}{Displays ticks on the left, if a vertical slider.
}
32 \twocolitem{\windowstyle{wxSL
\_RIGHT}}{Displays ticks on the right, if a vertical slider.
}
33 \twocolitem{\windowstyle{wxSL
\_TOP}}{Displays ticks on the top, if a horizontal slider.
}
34 \twocolitem{\windowstyle{wxSL
\_SELRANGE}}{Allows the user to select a range on the slider. Windows
95 only.
}
37 See also
\helpref{window styles overview
}{windowstyles
}.
39 \wxheading{Event handling
}
41 To process input from a slider, use one of these event handler macros to direct input to member
42 functions that take a
\helpref{wxScrollEvent
}{wxscrollevent
} argument:
46 \twocolitem{{\bf EVT
\_COMMAND\_SCROLL(id, func)
}}{Catch all scroll commands.
}
47 \twocolitem{{\bf EVT
\_COMMAND\_TOP(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
48 \twocolitem{{\bf EVT
\_COMMAND\_BOTTOM(id, func)
}}{Catch a command to put the scroll thumb at the maximum position.
}
49 \twocolitem{{\bf EVT
\_COMMAND\_LINEUP(id, func)
}}{Catch a line up command.
}
50 \twocolitem{{\bf EVT
\_COMMAND\_LINEDOWN(id, func)
}}{Catch a line down command.
}
51 \twocolitem{{\bf EVT
\_COMMAND\_PAGEUP(id, func)
}}{Catch a page up command.
}
52 \twocolitem{{\bf EVT
\_COMMAND\_PAGEDOWN(id, func)
}}{Catch a page down command.
}
53 \twocolitem{{\bf EVT
\_COMMAND\_THUMBTRACK(id, func)
}}{Catch a thumbtrack command (continuous movement of the scroll thumb).
}
54 \twocolitem{{\bf EVT
\_SLIDER(id, func)
}}{Process a wxEVT
\_COMMAND\_SLIDER\_UPDATED event,
55 when the slider is moved. Though provided for backward compatibility, this is obsolete.
}
60 \helpref{Event handling overview
}{eventhandlingoverview
},
\helpref{wxScrollBar
}{wxscrollbar
}
62 \latexignore{\rtfignore{\wxheading{Members
}}}
64 \membersection{wxSlider::wxSlider
}\label{wxsliderconstr
}
66 \func{}{wxSlider
}{\void}
70 \func{}{wxSlider
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
71 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
72 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
73 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
74 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
75 \param{const wxString\&
}{name = ``slider"
}}
77 Constructor, creating and showing a slider.
79 \wxheading{Parameters
}
81 \docparam{parent
}{Parent window. Must not be NULL.
}
83 \docparam{id
}{Window identifier. A value of -
1 indicates a default value.
}
85 \docparam{value
}{Initial position for the slider.
}
87 \docparam{minValue
}{Minimum slider position.
}
89 \docparam{maxValue
}{Maximum slider position.
}
91 \docparam{size
}{Window size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
93 \docparam{style
}{Window style. See
\helpref{wxSlider
}{wxslider
}.
}
95 \docparam{validator
}{Window validator.
}
97 \docparam{name
}{Window name.
}
101 \helpref{wxSlider::Create
}{wxslidercreate
},
\helpref{wxValidator
}{wxvalidator
}
103 \membersection{wxSlider::
\destruct{wxSlider
}}
105 \func{void
}{\destruct{wxSlider
}}{\void}
107 Destructor, destroying the slider.
109 \membersection{wxSlider::ClearSel
}\label{wxsliderclearsel
}
111 \func{void
}{ClearSel
}{\void}
113 Clears the selection, for a slider with the
{\bf wxSL
\_SELRANGE} style.
119 \membersection{wxSlider::ClearTicks
}\label{wxsliderclearticks
}
121 \func{void
}{ClearTicks
}{\void}
129 \membersection{wxSlider::Create
}\label{wxslidercreate
}
131 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\param{int
}{value
},
\rtfsp
132 \param{int
}{ minValue
},
\param{int
}{ maxValue
},
\rtfsp
133 \param{const wxPoint\&
}{point = wxDefaultPosition
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
134 \param{long
}{ style = wxSL
\_HORIZONTAL},
\rtfsp
135 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
\rtfsp
136 \param{const wxString\&
}{name = ``slider"
}}
138 Used for two-step slider construction. See
\helpref{wxSlider::wxSlider
}{wxsliderconstr
}\rtfsp
141 \membersection{wxSlider::GetLineSize
}\label{wxslidergetlinesize
}
143 \constfunc{int
}{GetLineSize
}{\void}
145 Returns the line size.
149 \helpref{wxSlider::SetLineSize
}{wxslidersetlinesize
}
151 \membersection{wxSlider::GetMax
}\label{wxslidergetmax
}
153 \constfunc{int
}{GetMax
}{\void}
155 Gets the maximum slider value.
159 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
161 \membersection{wxSlider::GetMin
}\label{wxslidergetmin
}
163 \constfunc{int
}{GetMin
}{\void}
165 Gets the minimum slider value.
169 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::SetRange
}{wxslidersetrange
}
171 \membersection{wxSlider::GetPageSize
}\label{wxslidergetpagesize
}
173 \constfunc{int
}{GetPageSize
}{\void}
175 Returns the page size.
179 \helpref{wxSlider::SetPageSize
}{wxslidersetpagesize
}
181 \membersection{wxSlider::GetSelEnd
}\label{wxslidergetselend
}
183 \constfunc{int
}{GetSelEnd
}{\void}
185 Returns the selection end point.
193 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
195 \membersection{wxSlider::GetSelStart
}\label{wxslidergetselstart
}
197 \constfunc{int
}{GetSelStart
}{\void}
199 Returns the selection start point.
207 \helpref{wxSlider::GetSelEnd
}{wxslidergetselend
},
\helpref{wxSlider::SetSelection
}{wxslidersetselection
}
209 \membersection{wxSlider::GetThumbLength
}\label{wxslidergetthumblength
}
211 \constfunc{int
}{GetThumbLength
}{\void}
213 Returns the thumb length.
221 \helpref{wxSlider::SetThumbLength
}{wxslidersetthumblength
}
223 \membersection{wxSlider::GetTickFreq
}\label{wxslidergettickfreq
}
225 \constfunc{int
}{GetTickFreq
}{\void}
227 Returns the tick frequency.
235 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
237 \membersection{wxSlider::GetValue
}\label{wxslidergetvalue
}
239 \constfunc{int
}{GetValue
}{\void}
241 Gets the current slider value.
245 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
},
\rtfsp
246 \helpref{wxSlider::SetValue
}{wxslidersetvalue
}
248 \membersection{wxSlider::SetRange
}\label{wxslidersetrange
}
250 \func{void
}{SetRange
}{\param{int
}{ minValue
},
\param{int
}{ maxValue
}}
252 Sets the minimum and maximum slider values.
256 \helpref{wxSlider::GetMin
}{wxslidergetmin
},
\helpref{wxSlider::GetMax
}{wxslidergetmax
}
258 \membersection{wxSlider::SetTickFreq
}\label{wxslidersettickfreq
}
260 \func{void
}{SetTickFreq
}{\param{int
}{n
},
\param{int
}{pos
}}
262 Sets the tick mark frequency and position.
264 \wxheading{Parameters
}
266 \docparam{n
}{Frequency. For example, if the frequency is set to two, a tick mark is displayed for
267 every other increment in the slider's range.
}
269 \docparam{pos
}{Position. Must be greater than zero. TODO: what is this for?
}
277 \helpref{wxSlider::GetTickFreq
}{wxslidergettickfreq
}
279 \membersection{wxSlider::SetLineSize
}\label{wxslidersetlinesize
}
281 \func{void
}{SetLineSize
}{\param{int
}{lineSize
}}
283 Sets the line size for the slider.
285 \wxheading{Parameters
}
287 \docparam{lineSize
}{The number of steps the slider moves when the user moves it up or down a line.
}
291 \helpref{wxSlider::GetLineSize
}{wxslidergetlinesize
}
293 \membersection{wxSlider::SetPageSize
}\label{wxslidersetpagesize
}
295 \func{void
}{SetPageSize
}{\param{int
}{pageSize
}}
297 Sets the page size for the slider.
299 \wxheading{Parameters
}
301 \docparam{pageSize
}{The number of steps the slider moves when the user pages up or down.
}
305 \helpref{wxSlider::GetPageSize
}{wxslidergetpagesize
}
307 \membersection{wxSlider::SetSelection
}\label{wxslidersetselection
}
309 \func{void
}{SetSelection
}{\param{int
}{startPos
},
\param{int
}{endPos
}}
313 \wxheading{Parameters
}
315 \docparam{startPos
}{The selection start position.
}
317 \docparam{endPos
}{The selection end position.
}
325 \helpref{wxSlider::GetSelStart
}{wxslidergetselstart
},
\helpref{wxSlider::GetSelEnd
}{wxslidergetselend
}
327 \membersection{wxSlider::SetThumbLength
}\label{wxslidersetthumblength
}
329 \func{void
}{SetThumbLength
}{\param{int
}{len
}}
331 Sets the slider thumb length.
333 \wxheading{Parameters
}
335 \docparam{len
}{The thumb length.
}
343 \helpref{wxSlider::GetThumbLength
}{wxslidergetthumblength
}
345 \membersection{wxSlider::SetTick
}\label{wxslidersettick
}
347 \func{void
}{SetTick
}{\param{int
}{ tickPos
}}
349 Sets a tick position.
351 \wxheading{Parameters
}
353 \docparam{tickPos
}{The tick position.
}
361 \helpref{wxSlider::SetTickFreq
}{wxslidersettickfreq
}
363 \membersection{wxSlider::SetValue
}\label{wxslidersetvalue
}
365 \func{void
}{SetValue
}{\param{int
}{ value
}}
367 Sets the slider position.
369 \wxheading{Parameters
}
371 \docparam{value
}{The slider position.
}
375 \helpref{wxSlider::GetValue
}{wxslidergetvalue
}