]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxSlider}}\label{wxslider} |
2 | ||
3 | A slider is a control with a handle which can be pulled | |
4 | back and forth to change the value. | |
5 | ||
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. | |
8 | ||
9 | Slider events are handled in the same way as a scrollbar. | |
10 | ||
11 | \wxheading{Derived from} | |
12 | ||
13 | \helpref{wxControl}{wxcontrol}\\ | |
14 | \helpref{wxWindow}{wxwindow}\\ | |
15 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
16 | \helpref{wxObject}{wxobject} | |
17 | ||
18 | \wxheading{Window styles} | |
19 | ||
20 | \twocolwidtha{5cm} | |
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.} | |
30 | \end{twocollist} | |
31 | ||
32 | See also \helpref{window styles overview}{windowstyles}. | |
33 | ||
5de76427 JS |
34 | \wxheading{Event handling} |
35 | ||
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: | |
38 | ||
39 | \twocolwidtha{7cm} | |
40 | \begin{twocollist} | |
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.} | |
51 | \end{twocollist}% | |
52 | ||
a660d684 KB |
53 | \wxheading{See also} |
54 | ||
55 | \helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxScrollBar}{wxscrollbar} | |
56 | ||
57 | \latexignore{\rtfignore{\wxheading{Members}}} | |
58 | ||
59 | \membersection{wxSlider::wxSlider}\label{wxsliderconstr} | |
60 | ||
61 | \func{}{wxSlider}{\void} | |
62 | ||
63 | Default slider. | |
64 | ||
eaaa6a06 JS |
65 | \func{}{wxSlider}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{int }{value },\rtfsp |
66 | \param{int}{ minValue}, \param{int}{ maxValue},\rtfsp | |
a660d684 | 67 | \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 68 | \param{long}{ style = wxSL\_HORIZONTAL},\rtfsp |
a660d684 KB |
69 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
70 | \param{const wxString\& }{name = ``slider"}} | |
71 | ||
72 | Constructor, creating and showing a slider. | |
73 | ||
74 | \wxheading{Parameters} | |
75 | ||
76 | \docparam{parent}{Parent window. Must not be NULL.} | |
77 | ||
78 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
79 | ||
80 | \docparam{value}{Initial position for the slider.} | |
81 | ||
82 | \docparam{minValue}{Minimum slider position.} | |
83 | ||
84 | \docparam{maxValue}{Maximum slider position.} | |
85 | ||
86 | \docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.} | |
87 | ||
88 | \docparam{style}{Window style. See \helpref{wxSlider}{wxslider}.} | |
89 | ||
90 | \docparam{validator}{Window validator.} | |
91 | ||
92 | \docparam{name}{Window name.} | |
93 | ||
94 | \wxheading{See also} | |
95 | ||
96 | \helpref{wxSlider::Create}{wxslidercreate}, \helpref{wxValidator}{wxvalidator} | |
97 | ||
98 | \membersection{wxSlider::\destruct{wxSlider}} | |
99 | ||
100 | \func{void}{\destruct{wxSlider}}{\void} | |
101 | ||
102 | Destructor, destroying the slider. | |
103 | ||
104 | \membersection{wxSlider::ClearSel}\label{wxsliderclearsel} | |
105 | ||
106 | \func{void}{ClearSel}{\void} | |
107 | ||
108 | Clears the selection, for a slider with the {\bf wxSL\_SELRANGE} style. | |
109 | ||
110 | \wxheading{Remarks} | |
111 | ||
112 | Windows 95 only. | |
113 | ||
114 | \membersection{wxSlider::ClearTicks}\label{wxsliderclearticks} | |
115 | ||
116 | \func{void}{ClearTicks}{\void} | |
117 | ||
118 | Clears the ticks. | |
119 | ||
120 | \wxheading{Remarks} | |
121 | ||
122 | Windows 95 only. | |
123 | ||
124 | \membersection{wxSlider::Create}\label{wxslidercreate} | |
125 | ||
eaaa6a06 JS |
126 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{int }{value },\rtfsp |
127 | \param{int}{ minValue}, \param{int}{ maxValue},\rtfsp | |
a660d684 | 128 | \param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp |
eaaa6a06 | 129 | \param{long}{ style = wxSL\_HORIZONTAL},\rtfsp |
a660d684 KB |
130 | \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
131 | \param{const wxString\& }{name = ``slider"}} | |
132 | ||
133 | Used for two-step slider construction. See \helpref{wxSlider::wxSlider}{wxsliderconstr}\rtfsp | |
134 | for further details. | |
135 | ||
136 | \membersection{wxSlider::GetLineSize}\label{wxslidergetlinesize} | |
137 | ||
138 | \constfunc{int}{GetLineSize}{\void} | |
139 | ||
140 | Returns the line size. | |
141 | ||
142 | \wxheading{See also} | |
143 | ||
144 | \helpref{wxSlider::SetLineSize}{wxslidersetlinesize} | |
145 | ||
146 | \membersection{wxSlider::GetMax}\label{wxslidergetmax} | |
147 | ||
148 | \constfunc{int}{GetMax}{\void} | |
149 | ||
150 | Gets the maximum slider value. | |
151 | ||
152 | \wxheading{See also} | |
153 | ||
154 | \helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::SetRange}{wxslidersetrange} | |
155 | ||
156 | \membersection{wxSlider::GetMin}\label{wxslidergetmin} | |
157 | ||
158 | \constfunc{int}{GetMin}{\void} | |
159 | ||
160 | Gets the minimum slider value. | |
161 | ||
162 | \wxheading{See also} | |
163 | ||
164 | \helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::SetRange}{wxslidersetrange} | |
165 | ||
166 | \membersection{wxSlider::GetPageSize}\label{wxslidergetpagesize} | |
167 | ||
168 | \constfunc{int}{GetPageSize}{\void} | |
169 | ||
170 | Returns the page size. | |
171 | ||
172 | \wxheading{See also} | |
173 | ||
174 | \helpref{wxSlider::SetPageSize}{wxslidersetpagesize} | |
175 | ||
176 | \membersection{wxSlider::GetSelEnd}\label{wxslidergetselend} | |
177 | ||
178 | \constfunc{int}{GetSelEnd}{\void} | |
179 | ||
180 | Returns the selection end point. | |
181 | ||
182 | \wxheading{Remarks} | |
183 | ||
184 | Windows 95 only. | |
185 | ||
186 | \wxheading{See also} | |
187 | ||
188 | \helpref{wxSlider::GetSelStart}{wxslidergetselstart}, \helpref{wxSlider::SetSelection}{wxslidersetselection} | |
189 | ||
190 | \membersection{wxSlider::GetSelStart}\label{wxslidergetselstart} | |
191 | ||
192 | \constfunc{int}{GetSelStart}{\void} | |
193 | ||
194 | Returns the selection start point. | |
195 | ||
196 | \wxheading{Remarks} | |
197 | ||
198 | Windows 95 only. | |
199 | ||
200 | \wxheading{See also} | |
201 | ||
202 | \helpref{wxSlider::GetSelEnd}{wxslidergetselend}, \helpref{wxSlider::SetSelection}{wxslidersetselection} | |
203 | ||
204 | \membersection{wxSlider::GetThumbLength}\label{wxslidergetthumblength} | |
205 | ||
206 | \constfunc{int}{GetThumbLength}{\void} | |
207 | ||
208 | Returns the thumb length. | |
209 | ||
210 | \wxheading{Remarks} | |
211 | ||
212 | Windows 95 only. | |
213 | ||
214 | \wxheading{See also} | |
215 | ||
216 | \helpref{wxSlider::SetThumbLength}{wxslidersetthumblength} | |
217 | ||
218 | \membersection{wxSlider::GetTickFreq}\label{wxslidergettickfreq} | |
219 | ||
220 | \constfunc{int}{GetTickFreq}{\void} | |
221 | ||
222 | Returns the tick frequency. | |
223 | ||
224 | \wxheading{Remarks} | |
225 | ||
226 | Windows 95 only. | |
227 | ||
228 | \wxheading{See also} | |
229 | ||
230 | \helpref{wxSlider::SetTickFreq}{wxslidersettickfreq} | |
231 | ||
232 | \membersection{wxSlider::GetValue}\label{wxslidergetvalue} | |
233 | ||
234 | \constfunc{int}{GetValue}{\void} | |
235 | ||
236 | Gets the current slider value. | |
237 | ||
238 | \wxheading{See also} | |
239 | ||
240 | \helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::GetMax}{wxslidergetmax},\rtfsp | |
241 | \helpref{wxSlider::SetValue}{wxslidersetvalue} | |
242 | ||
243 | \membersection{wxSlider::SetRange}\label{wxslidersetrange} | |
244 | ||
eaaa6a06 | 245 | \func{void}{SetRange}{\param{int}{ minValue}, \param{int}{ maxValue}} |
a660d684 KB |
246 | |
247 | Sets the minimum and maximum slider values. | |
248 | ||
249 | \wxheading{See also} | |
250 | ||
251 | \helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::GetMax}{wxslidergetmax} | |
252 | ||
253 | \membersection{wxSlider::SetTickFreq}\label{wxslidersettickfreq} | |
254 | ||
eaaa6a06 | 255 | \func{void}{SetTickFreq}{\param{int }{n}, \param{int }{pos}} |
a660d684 KB |
256 | |
257 | Sets the tick mark frequency and position. | |
258 | ||
259 | \wxheading{Parameters} | |
260 | ||
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.} | |
263 | ||
264 | \docparam{pos}{Position. Must be greater than zero. TODO: what is this for?} | |
265 | ||
266 | \wxheading{Remarks} | |
267 | ||
268 | Windows 95 only. | |
269 | ||
270 | \wxheading{See also} | |
271 | ||
272 | \helpref{wxSlider::GetTickFreq}{wxslidergettickfreq} | |
273 | ||
274 | \membersection{wxSlider::SetLineSize}\label{wxslidersetlinesize} | |
275 | ||
eaaa6a06 | 276 | \func{void}{SetLineSize}{\param{int }{lineSize}} |
a660d684 KB |
277 | |
278 | Sets the line size for the slider. | |
279 | ||
280 | \wxheading{Parameters} | |
281 | ||
282 | \docparam{lineSize}{The number of steps the slider moves when the user moves it up or down a line.} | |
283 | ||
284 | \wxheading{See also} | |
285 | ||
286 | \helpref{wxSlider::GetLineSize}{wxslidergetlinesize} | |
287 | ||
288 | \membersection{wxSlider::SetPageSize}\label{wxslidersetpagesize} | |
289 | ||
eaaa6a06 | 290 | \func{void}{SetPageSize}{\param{int }{pageSize}} |
a660d684 KB |
291 | |
292 | Sets the page size for the slider. | |
293 | ||
294 | \wxheading{Parameters} | |
295 | ||
296 | \docparam{pageSize}{The number of steps the slider moves when the user pages up or down.} | |
297 | ||
298 | \wxheading{See also} | |
299 | ||
300 | \helpref{wxSlider::GetPageSize}{wxslidergetpagesize} | |
301 | ||
302 | \membersection{wxSlider::SetSelection}\label{wxslidersetselection} | |
303 | ||
eaaa6a06 | 304 | \func{void}{SetSelection}{\param{int }{startPos}, \param{int }{endPos}} |
a660d684 KB |
305 | |
306 | Sets the selection. | |
307 | ||
308 | \wxheading{Parameters} | |
309 | ||
310 | \docparam{startPos}{The selection start position.} | |
311 | ||
312 | \docparam{endPos}{The selection end position.} | |
313 | ||
314 | \wxheading{Remarks} | |
315 | ||
316 | Windows 95 only. | |
317 | ||
318 | \wxheading{See also} | |
319 | ||
320 | \helpref{wxSlider::GetSelStart}{wxslidergetselstart}, \helpref{wxSlider::GetSelEnd}{wxslidergetselend} | |
321 | ||
322 | \membersection{wxSlider::SetThumbLength}\label{wxslidersetthumblength} | |
323 | ||
eaaa6a06 | 324 | \func{void}{SetThumbLength}{\param{int }{len}} |
a660d684 KB |
325 | |
326 | Sets the slider thumb length. | |
327 | ||
328 | \wxheading{Parameters} | |
329 | ||
330 | \docparam{len}{The thumb length.} | |
331 | ||
332 | \wxheading{Remarks} | |
333 | ||
334 | Windows 95 only. | |
335 | ||
336 | \wxheading{See also} | |
337 | ||
338 | \helpref{wxSlider::GetThumbLength}{wxslidergetthumblength} | |
339 | ||
340 | \membersection{wxSlider::SetTick}\label{wxslidersettick} | |
341 | ||
eaaa6a06 | 342 | \func{void}{SetTick}{\param{int}{ tickPos}} |
a660d684 KB |
343 | |
344 | Sets a tick position. | |
345 | ||
346 | \wxheading{Parameters} | |
347 | ||
348 | \docparam{tickPos}{The tick position.} | |
349 | ||
350 | \wxheading{Remarks} | |
351 | ||
352 | Windows 95 only. | |
353 | ||
354 | \wxheading{See also} | |
355 | ||
356 | \helpref{wxSlider::SetTickFreq}{wxslidersettickfreq} | |
357 | ||
358 | \membersection{wxSlider::SetValue}\label{wxslidersetvalue} | |
359 | ||
eaaa6a06 | 360 | \func{void}{SetValue}{\param{int}{ value}} |
a660d684 KB |
361 | |
362 | Sets the slider position. | |
363 | ||
364 | \wxheading{Parameters} | |
365 | ||
366 | \docparam{value}{The slider position.} | |
367 | ||
368 | \wxheading{See also} | |
369 | ||
370 | \helpref{wxSlider::GetValue}{wxslidergetvalue} | |
371 |