File: wx207.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (511 lines) | stat: -rw-r--r-- 14,870 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<HTML>
<head><title>wxSlider</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxslider"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx206.htm#wxsizeevent"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx208.htm#wxsockaddress"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxSlider</H2>
<P>
A slider is a control with a handle which can be pulled
back and forth to change the value.<P>
In Windows versions below Windows 95, a scrollbar is used to simulate the slider. In Windows 95,
the track bar control is used.<P>
Slider events are handled in the same way as a scrollbar.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>

<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>

<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/slider.h&gt;<P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>wxSL_HORIZONTAL</B>
</TD>

<TD VALIGN=TOP>
Displays the slider horizontally.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_VERTICAL</B>
</TD>

<TD VALIGN=TOP>
Displays the slider vertically.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_AUTOTICKS</B>
</TD>

<TD VALIGN=TOP>
Displays tick marks.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_LABELS</B>
</TD>

<TD VALIGN=TOP>
Displays minimum, maximum and value labels.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_LEFT</B>
</TD>

<TD VALIGN=TOP>
Displays ticks on the left, if a vertical slider.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_RIGHT</B>
</TD>

<TD VALIGN=TOP>
Displays ticks on the right, if a vertical slider.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_TOP</B>
</TD>

<TD VALIGN=TOP>
Displays ticks on the top, if a horizontal slider.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxSL_SELRANGE</B>
</TD>

<TD VALIGN=TOP>
Allows the user to select a range on the slider. Windows 95 only.
</TD></TR>


</TABLE>
<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A>.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
To process input from a slider, use one of these event handler macros to direct input to member
functions that take a <A HREF="wx202.htm#wxscrollevent">wxScrollEvent</A> argument:<P>


<TABLE>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_SCROLL(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch all scroll commands.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_TOP(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a command to put the scroll thumb at the maximum position.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_BOTTOM(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a command to put the scroll thumb at the maximum position.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_LINEUP(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a line up command.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_LINEDOWN(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a line down command.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_PAGEUP(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a page up command.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_PAGEDOWN(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a page down command.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_THUMBTRACK(id, func)</B>
</TD>

<TD VALIGN=TOP>
Catch a thumbtrack command (continuous movement of the scroll thumb).
</TD></TR>


<TR><TD VALIGN=TOP>
<B>EVT_SLIDER(id, func)</B>
</TD>

<TD VALIGN=TOP>
Process a wxEVT_COMMAND_SLIDER_UPDATED event,
when the slider is moved. Though provided for backward compatibility, this is obsolete.
</TD></TR>


</TABLE>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx299.htm#eventhandlingoverview">Event handling overview</A>, <A HREF="wx201.htm#wxscrollbar">wxScrollBar</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxsliderconstr">wxSlider::wxSlider</A><BR>
<A HREF="#topic818">wxSlider::~wxSlider</A><BR>
<A HREF="#wxsliderclearsel">wxSlider::ClearSel</A><BR>
<A HREF="#wxsliderclearticks">wxSlider::ClearTicks</A><BR>
<A HREF="#wxslidercreate">wxSlider::Create</A><BR>
<A HREF="#wxslidergetlinesize">wxSlider::GetLineSize</A><BR>
<A HREF="#wxslidergetmax">wxSlider::GetMax</A><BR>
<A HREF="#wxslidergetmin">wxSlider::GetMin</A><BR>
<A HREF="#wxslidergetpagesize">wxSlider::GetPageSize</A><BR>
<A HREF="#wxslidergetselend">wxSlider::GetSelEnd</A><BR>
<A HREF="#wxslidergetselstart">wxSlider::GetSelStart</A><BR>
<A HREF="#wxslidergetthumblength">wxSlider::GetThumbLength</A><BR>
<A HREF="#wxslidergettickfreq">wxSlider::GetTickFreq</A><BR>
<A HREF="#wxslidergetvalue">wxSlider::GetValue</A><BR>
<A HREF="#wxslidersetrange">wxSlider::SetRange</A><BR>
<A HREF="#wxslidersettickfreq">wxSlider::SetTickFreq</A><BR>
<A HREF="#wxslidersetlinesize">wxSlider::SetLineSize</A><BR>
<A HREF="#wxslidersetpagesize">wxSlider::SetPageSize</A><BR>
<A HREF="#wxslidersetselection">wxSlider::SetSelection</A><BR>
<A HREF="#wxslidersetthumblength">wxSlider::SetThumbLength</A><BR>
<A HREF="#wxslidersettick">wxSlider::SetTick</A><BR>
<A HREF="#wxslidersetvalue">wxSlider::SetValue</A><BR>
<P>

<HR>
<A NAME="wxsliderconstr"></A>
<H3>wxSlider::wxSlider</H3>
<P>
<B></B> <B>wxSlider</B>()<P>
Default slider.<P>
<B></B> <B>wxSlider</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID </B><I>id</I>, <B>int </B><I>value </I>,
<B>int</B><I> minValue</I>, <B>int</B><I> maxValue</I>,
<B>const wxPoint&amp; </B><I>point = wxDefaultPosition</I>, <B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = wxSL_HORIZONTAL</I>,
<B>const wxValidator&amp; </B><I>validator = wxDefaultValidator</I>,
<B>const wxString&amp; </B><I>name = "slider"</I>)<P>
Constructor, creating and showing a slider.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Must not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Window identifier. A value of -1 indicates a default value.</UL></UL>
<P>
<I>value</I><UL><UL>
Initial position for the slider.</UL></UL>
<P>
<I>minValue</I><UL><UL>
Minimum slider position.</UL></UL>
<P>
<I>maxValue</I><UL><UL>
Maximum slider position.</UL></UL>
<P>
<I>size</I><UL><UL>
Window size. If the default size (-1, -1) is specified then a default size is chosen.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx207.htm#wxslider">wxSlider</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidercreate">wxSlider::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>

<HR>
<A NAME="topic818"></A>
<H3>wxSlider::~wxSlider</H3>
<P>
<B>void</B> <B>~wxSlider</B>()<P>
Destructor, destroying the slider.<P>

<HR>
<A NAME="wxsliderclearsel"></A>
<H3>wxSlider::ClearSel</H3>
<P>
<B>void</B> <B>ClearSel</B>()<P>
Clears the selection, for a slider with the <B>wxSL_SELRANGE</B> style.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>

<HR>
<A NAME="wxsliderclearticks"></A>
<H3>wxSlider::ClearTicks</H3>
<P>
<B>void</B> <B>ClearTicks</B>()<P>
Clears the ticks.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>

<HR>
<A NAME="wxslidercreate"></A>
<H3>wxSlider::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID </B><I>id</I>, <B>int </B><I>value </I>,
<B>int</B><I> minValue</I>, <B>int</B><I> maxValue</I>,
<B>const wxPoint&amp; </B><I>point = wxDefaultPosition</I>, <B>const wxSize&amp; </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = wxSL_HORIZONTAL</I>,
<B>const wxValidator&amp; </B><I>validator = wxDefaultValidator</I>,
<B>const wxString&amp; </B><I>name = "slider"</I>)<P>
Used for two-step slider construction. See <A HREF="wx207.htm#wxsliderconstr">wxSlider::wxSlider</A>
for further details.<P>

<HR>
<A NAME="wxslidergetlinesize"></A>
<H3>wxSlider::GetLineSize</H3>
<P>
<B>int</B> <B>GetLineSize</B>() <B>const</B><P>
Returns the line size.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidersetlinesize">wxSlider::SetLineSize</A><P>

<HR>
<A NAME="wxslidergetmax"></A>
<H3>wxSlider::GetMax</H3>
<P>
<B>int</B> <B>GetMax</B>() <B>const</B><P>
Gets the maximum slider value.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetmin">wxSlider::GetMin</A>, <A HREF="wx207.htm#wxslidersetrange">wxSlider::SetRange</A><P>

<HR>
<A NAME="wxslidergetmin"></A>
<H3>wxSlider::GetMin</H3>
<P>
<B>int</B> <B>GetMin</B>() <B>const</B><P>
Gets the minimum slider value.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetmin">wxSlider::GetMin</A>, <A HREF="wx207.htm#wxslidersetrange">wxSlider::SetRange</A><P>

<HR>
<A NAME="wxslidergetpagesize"></A>
<H3>wxSlider::GetPageSize</H3>
<P>
<B>int</B> <B>GetPageSize</B>() <B>const</B><P>
Returns the page size.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidersetpagesize">wxSlider::SetPageSize</A><P>

<HR>
<A NAME="wxslidergetselend"></A>
<H3>wxSlider::GetSelEnd</H3>
<P>
<B>int</B> <B>GetSelEnd</B>() <B>const</B><P>
Returns the selection end point.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetselstart">wxSlider::GetSelStart</A>, <A HREF="wx207.htm#wxslidersetselection">wxSlider::SetSelection</A><P>

<HR>
<A NAME="wxslidergetselstart"></A>
<H3>wxSlider::GetSelStart</H3>
<P>
<B>int</B> <B>GetSelStart</B>() <B>const</B><P>
Returns the selection start point.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetselend">wxSlider::GetSelEnd</A>, <A HREF="wx207.htm#wxslidersetselection">wxSlider::SetSelection</A><P>

<HR>
<A NAME="wxslidergetthumblength"></A>
<H3>wxSlider::GetThumbLength</H3>
<P>
<B>int</B> <B>GetThumbLength</B>() <B>const</B><P>
Returns the thumb length.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidersetthumblength">wxSlider::SetThumbLength</A><P>

<HR>
<A NAME="wxslidergettickfreq"></A>
<H3>wxSlider::GetTickFreq</H3>
<P>
<B>int</B> <B>GetTickFreq</B>() <B>const</B><P>
Returns the tick frequency.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidersettickfreq">wxSlider::SetTickFreq</A><P>

<HR>
<A NAME="wxslidergetvalue"></A>
<H3>wxSlider::GetValue</H3>
<P>
<B>int</B> <B>GetValue</B>() <B>const</B><P>
Gets the current slider value.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetmin">wxSlider::GetMin</A>, <A HREF="wx207.htm#wxslidergetmax">wxSlider::GetMax</A>,
<A HREF="wx207.htm#wxslidersetvalue">wxSlider::SetValue</A><P>

<HR>
<A NAME="wxslidersetrange"></A>
<H3>wxSlider::SetRange</H3>
<P>
<B>void</B> <B>SetRange</B>(<B>int</B><I> minValue</I>, <B>int</B><I> maxValue</I>)<P>
Sets the minimum and maximum slider values.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetmin">wxSlider::GetMin</A>, <A HREF="wx207.htm#wxslidergetmax">wxSlider::GetMax</A><P>

<HR>
<A NAME="wxslidersettickfreq"></A>
<H3>wxSlider::SetTickFreq</H3>
<P>
<B>void</B> <B>SetTickFreq</B>(<B>int </B><I>n</I>, <B>int </B><I>pos</I>)<P>
Sets the tick mark frequency and position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
Frequency. For example, if the frequency is set to two, a tick mark is displayed for
every other increment in the slider's range.</UL></UL>
<P>
<I>pos</I><UL><UL>
Position. Must be greater than zero. TODO: what is this for?</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergettickfreq">wxSlider::GetTickFreq</A><P>

<HR>
<A NAME="wxslidersetlinesize"></A>
<H3>wxSlider::SetLineSize</H3>
<P>
<B>void</B> <B>SetLineSize</B>(<B>int </B><I>lineSize</I>)<P>
Sets the line size for the slider.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>lineSize</I><UL><UL>
The number of steps the slider moves when the user moves it up or down a line.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetlinesize">wxSlider::GetLineSize</A><P>

<HR>
<A NAME="wxslidersetpagesize"></A>
<H3>wxSlider::SetPageSize</H3>
<P>
<B>void</B> <B>SetPageSize</B>(<B>int </B><I>pageSize</I>)<P>
Sets the page size for the slider.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pageSize</I><UL><UL>
The number of steps the slider moves when the user pages up or down.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetpagesize">wxSlider::GetPageSize</A><P>

<HR>
<A NAME="wxslidersetselection"></A>
<H3>wxSlider::SetSelection</H3>
<P>
<B>void</B> <B>SetSelection</B>(<B>int </B><I>startPos</I>, <B>int </B><I>endPos</I>)<P>
Sets the selection.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>startPos</I><UL><UL>
The selection start position.</UL></UL>
<P>
<I>endPos</I><UL><UL>
The selection end position.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetselstart">wxSlider::GetSelStart</A>, <A HREF="wx207.htm#wxslidergetselend">wxSlider::GetSelEnd</A><P>

<HR>
<A NAME="wxslidersetthumblength"></A>
<H3>wxSlider::SetThumbLength</H3>
<P>
<B>void</B> <B>SetThumbLength</B>(<B>int </B><I>len</I>)<P>
Sets the slider thumb length.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>len</I><UL><UL>
The thumb length.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetthumblength">wxSlider::GetThumbLength</A><P>

<HR>
<A NAME="wxslidersettick"></A>
<H3>wxSlider::SetTick</H3>
<P>
<B>void</B> <B>SetTick</B>(<B>int</B><I> tickPos</I>)<P>
Sets a tick position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>tickPos</I><UL><UL>
The tick position.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Windows 95 only.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidersettickfreq">wxSlider::SetTickFreq</A><P>

<HR>
<A NAME="wxslidersetvalue"></A>
<H3>wxSlider::SetValue</H3>
<P>
<B>void</B> <B>SetValue</B>(<B>int</B><I> value</I>)<P>
Sets the slider position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>value</I><UL><UL>
The slider position.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx207.htm#wxslidergetvalue">wxSlider::GetValue</A><P>

</BODY></HTML>