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