#include <wx/slider.h>

On Windows, the track bar control is used.
Slider events are handled in the same way as a scrollbar.
Styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
The EVT_SCROLL_CHANGED event also occurs when using the keyboard to change the thumb position, and when clicking next to the thumb (In all these cases the EVT_SCROLL_THUMBRELEASE event does not happen). In short, the EVT_SCROLL_CHANGED event is triggered when scrolling/ moving has finished independently of the way it had started. Please see the widgets sample ("Slider" page) to see the difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED in action.
![]() | ![]() | ![]() |
| wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
| wxSlider () | |
| wxSlider (wxWindow *parent, wxWindowID id, int value, int minValue, int maxValue, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSL_HORIZONTAL, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSliderNameStr) | |
| virtual | ~wxSlider () |
| virtual void | ClearSel () |
| virtual void | ClearTicks () |
| bool | Create (wxWindow *parent, wxWindowID id, int value, int minValue, int maxValue, const wxPoint &point=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSL_HORIZONTAL, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSliderNameStr) |
| virtual int | GetLineSize () const |
| virtual int | GetMax () const |
| virtual int | GetMin () const |
| virtual int | GetPageSize () const |
| virtual int | GetSelEnd () const |
| virtual int | GetSelStart () const |
| virtual int | GetThumbLength () const |
| virtual int | GetTickFreq () const |
| virtual int | GetValue () const |
| virtual void | SetLineSize (int lineSize) |
| virtual void | SetPageSize (int pageSize) |
| virtual void | SetRange (int minValue, int maxValue) |
| virtual void | SetSelection (int startPos, int endPos) |
| virtual void | SetThumbLength (int len) |
| virtual void | SetTick (int tickPos) |
| virtual void | SetTickFreq (int n, int pos) |
| virtual void | SetValue (int value) |
| wxSlider::wxSlider | ( | ) |
Default constructor
| wxSlider::wxSlider | ( | wxWindow * | parent, | |
| wxWindowID | id, | |||
| int | value, | |||
| int | minValue, | |||
| int | maxValue, | |||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = wxSL_HORIZONTAL, |
|||
| const wxValidator & | validator = wxDefaultValidator, |
|||
| const wxString & | name = wxSliderNameStr | |||
| ) |
Constructor, creating and showing a slider.
| parent | Parent window. Must not be NULL. | |
| id | Window identifier. The value wxID_ANY indicates a default value. | |
| value | Initial position for the slider. | |
| minValue | Minimum slider position. | |
| maxValue | Maximum slider position. | |
| pos | Window position. If wxDefaultPosition is specified then a default position is chosen. | |
| size | Window size. If wxDefaultSize is specified then a default size is chosen. | |
| style | Window style. See wxSlider. | |
| validator | Window validator. | |
| name | Window name. |
| virtual wxSlider::~wxSlider | ( | ) | [virtual] |
Destructor, destroying the slider.
| virtual void wxSlider::ClearSel | ( | ) | [virtual] |
Clears the selection, for a slider with the wxSL_SELRANGE style.
| virtual void wxSlider::ClearTicks | ( | ) | [virtual] |
| bool wxSlider::Create | ( | wxWindow * | parent, | |
| wxWindowID | id, | |||
| int | value, | |||
| int | minValue, | |||
| int | maxValue, | |||
| const wxPoint & | point = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = wxSL_HORIZONTAL, |
|||
| const wxValidator & | validator = wxDefaultValidator, |
|||
| const wxString & | name = wxSliderNameStr | |||
| ) |
Used for two-step slider construction. See wxSlider() for further details.
| virtual int wxSlider::GetLineSize | ( | ) | const [virtual] |
| virtual int wxSlider::GetMax | ( | ) | const [virtual] |
| virtual int wxSlider::GetMin | ( | ) | const [virtual] |
| virtual int wxSlider::GetPageSize | ( | ) | const [virtual] |
| virtual int wxSlider::GetSelEnd | ( | ) | const [virtual] |
Returns the selection end point.
| virtual int wxSlider::GetSelStart | ( | ) | const [virtual] |
Returns the selection start point.
| virtual int wxSlider::GetThumbLength | ( | ) | const [virtual] |
Returns the thumb length.
| virtual int wxSlider::GetTickFreq | ( | ) | const [virtual] |
| virtual int wxSlider::GetValue | ( | ) | const [virtual] |
| virtual void wxSlider::SetLineSize | ( | int | lineSize | ) | [virtual] |
Sets the line size for the slider.
| lineSize | The number of steps the slider moves when the user moves it up or down a line. |
| virtual void wxSlider::SetPageSize | ( | int | pageSize | ) | [virtual] |
Sets the page size for the slider.
| pageSize | The number of steps the slider moves when the user pages up or down. |
| virtual void wxSlider::SetRange | ( | int | minValue, | |
| int | maxValue | |||
| ) | [virtual] |
| virtual void wxSlider::SetSelection | ( | int | startPos, | |
| int | endPos | |||
| ) | [virtual] |
Sets the selection.
| startPos | The selection start position. | |
| endPos | The selection end position. |
| virtual void wxSlider::SetThumbLength | ( | int | len | ) | [virtual] |
Sets the slider thumb length.
| len | The thumb length. |
| virtual void wxSlider::SetTick | ( | int | tickPos | ) | [virtual] |
Sets a tick position.
| tickPos | The tick position. |
| virtual void wxSlider::SetTickFreq | ( | int | n, | |
| int | pos | |||
| ) | [virtual] |
Sets the tick mark frequency and position.
| n | Frequency. For example, if the frequency is set to two, a tick mark is displayed for every other increment in the slider's range. | |
| pos | Position. Must be greater than zero. |
| virtual void wxSlider::SetValue | ( | int | value | ) | [virtual] |
Sets the slider position.
| value | The slider position. |
|
[ top ] |