Version: 2.9.4
Public Member Functions
wxSpinCtrl Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/spinctrl.h>

Inheritance diagram for wxSpinCtrl:

Detailed Description

wxSpinCtrl combines wxTextCtrl and wxSpinButton in one control.

Styles

This class supports the following styles:

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxSpinEvent& event)

Event macros for events emitted by this class:

You may also use the wxSpinButton event macros, however the corresponding events will not be generated under all platforms. Finally, if the user modifies the text in the edit part of the spin control directly, the EVT_TEXT is generated, like for the wxTextCtrl. When the use enters text into the text area, the text is not validated until the control loses focus (e.g. by using the TAB key). The value is then adjusted to the range and a wxSpinEvent sent then if the value is different from the last value sent.

Library:  wxCore
Category:  Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance
参照:
wxSpinButton, wxSpinCtrlDouble, wxControl

Public Member Functions

 wxSpinCtrl ()
 Default constructor.
 wxSpinCtrl (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_ARROW_KEYS, int min=0, int max=100, int initial=0, const wxString &name="wxSpinCtrl")
 Constructor, creating and showing a spin control.
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_ARROW_KEYS, int min=0, int max=100, int initial=0, const wxString &name="wxSpinCtrl")
 Creation function called by the spin control constructor.
int GetMax () const
 Gets maximal allowable value.
int GetMin () const
 Gets minimal allowable value.
int GetValue () const
 Gets the value of the spin control.
void SetRange (int minVal, int maxVal)
 Sets range of allowable values.
virtual void SetSelection (long from, long to)
 Select the text in the text part of the control between positions from (inclusive) and to (exclusive).
virtual void SetValue (const wxString &text)
 Sets the value of the spin control.
void SetValue (int value)
 Sets the value of the spin control.

List of all members.


Constructor & Destructor Documentation

wxSpinCtrl::wxSpinCtrl ( )

Default constructor.

wxSpinCtrl::wxSpinCtrl ( wxWindow parent,
wxWindowID  id = wxID_ANY,
const wxString value = wxEmptyString,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxSP_ARROW_KEYS,
int  min = 0,
int  max = 100,
int  initial = 0,
const wxString name = "wxSpinCtrl" 
)

Constructor, creating and showing a spin control.

If value is non-empty, it will be shown in the text entry part of the control and if it has numeric value, the initial numeric value of the control, as returned by GetValue() will also be determined by it instead of by initial. Hence, it only makes sense to specify initial if value is an empty string or is not convertible to a number, otherwise initial is simply ignored and the number specified by value is used.

Parameters:
parentParent window. Must not be NULL.
valueDefault value (as text).
idWindow identifier. The value wxID_ANY indicates a default value.
posWindow position. If wxDefaultPosition is specified then a default position is chosen.
sizeWindow size. If wxDefaultSize is specified then a default size is chosen.
styleWindow style. See wxSpinButton.
minMinimal value.
maxMaximal value.
initialInitial value.
nameWindow name.
参照:
Create()

Member Function Documentation

bool wxSpinCtrl::Create ( wxWindow parent,
wxWindowID  id = wxID_ANY,
const wxString value = wxEmptyString,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxSP_ARROW_KEYS,
int  min = 0,
int  max = 100,
int  initial = 0,
const wxString name = "wxSpinCtrl" 
)

Creation function called by the spin control constructor.

See wxSpinCtrl() for details.

int wxSpinCtrl::GetMax ( ) const

Gets maximal allowable value.

int wxSpinCtrl::GetMin ( ) const

Gets minimal allowable value.

int wxSpinCtrl::GetValue ( ) const

Gets the value of the spin control.

void wxSpinCtrl::SetRange ( int  minVal,
int  maxVal 
)

Sets range of allowable values.

virtual void wxSpinCtrl::SetSelection ( long  from,
long  to 
) [virtual]

Select the text in the text part of the control between positions from (inclusive) and to (exclusive).

This is similar to wxTextCtrl::SetSelection().

注:
this is currently only implemented for Windows and generic versions of the control.
void wxSpinCtrl::SetValue ( int  value)

Sets the value of the spin control.

virtual void wxSpinCtrl::SetValue ( const wxString text) [virtual]

Sets the value of the spin control.

Use the variant using int instead.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines