Version: 2.9.4
Public Types | Public Member Functions
wxIntegerValidator< T > Class Template Reference

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

Inheritance diagram for wxIntegerValidator< T >:

Detailed Description

template<typename T>
class wxIntegerValidator< T >

整数を入力するテキスト項目に使用するバリデータ。

This validator can be used with wxTextCtrl or wxComboBox (and potentially any other class implementing wxTextEntry interface) to check that only valid integer values can be entered into them.

This is a template class which can be instantiated for all the integer types (i.e. short, int, long and long long if available) as well as their unsigned versions.

By default this validator accepts any integer values in the range appropriate for its type, e.g. INT_MIN..INT_MAX for int or 0..USHRT_MAX for unsigned short. This range can be restricted further by calling SetMin() and SetMax() or SetRange() methods inherited from the base class.

When the validator displays integers with thousands separators, the character used for the separators (usually "." or ",") depends on the locale set with wxLocale (note that you shouldn't change locale with setlocale() as this can result in a mismatch between the thousands separator used by wxLocale and the one used by the run-time library).

A simple example of using this class:

        class MyDialog : public wxDialog
        {
        public:
            MyDialog()
            {
                ...
                // Allow positive integers and display them with thousands
                // separators.
                wxIntegerValidator<unsigned long>
                    val(&m_value, wxNUM_VAL_THOUSANDS_SEPARATOR);

                // If the variable were of type "long" and not "unsigned long"
                // we would have needed to call val.SetMin(0) but as it is,
                // this is not needed.

                // Associate it with the text control:
                new wxTextCtrl(this, ..., val);
            }

        private:
            unsigned long m_value;
        };

For more information, please see wxValidator Overview.

Library:  wxCore
Category:  Validators
参照:
wxValidator Overview, wxValidator, wxGenericValidator, wxTextValidator, wxMakeIntegerValidator()
Since:
2.9.2

Public Types

typedef T ValueType
 Type of the values this validator is used with.

Public Member Functions

 wxIntegerValidator (ValueType *value=NULL, int style=wxNUM_VAL_DEFAULT)
 Validator constructor.

List of all members.


Member Typedef Documentation

template<typename T>
typedef T wxIntegerValidator< T >::ValueType

Type of the values this validator is used with.

Reimplemented from wxNumValidator< T >.


Constructor & Destructor Documentation

template<typename T>
wxIntegerValidator< T >::wxIntegerValidator ( ValueType value = NULL,
int  style = wxNUM_VAL_DEFAULT 
)

Validator constructor.

Parameters:
valueA pointer to the variable associated with the validator. If non NULL, this variable should have a lifetime equal to or longer than the validator lifetime (which is usually determined by the lifetime of the window).
styleA combination of wxNumValidatorStyle enum values with the exception of wxNUM_VAL_NO_TRAILING_ZEROES which can't be used here.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines