1 \section{\class{wxCheckBox
}}\label{wxcheckbox
}
3 A checkbox is a labelled box which by default is either on (checkmark is
4 visible) or off (no checkmark). Optionally (when the wxCHK
\_3STATE style flag
5 is set) it can have a third state, called the mixed or undetermined state.
6 Often this is used as a "Does Not Apply" state.
8 \wxheading{Derived from
}
10 \helpref{wxControl
}{wxcontrol
}\\
11 \helpref{wxWindow
}{wxwindow
}\\
12 \helpref{wxEvtHandler
}{wxevthandler
}\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
19 \wxheading{Window styles
}
22 \begin{twocollist
}\itemsep=
0pt
23 \twocolitem{\windowstyle{wxCHK
\_2STATE}}{Create a
2-state checkbox. This is the default.
}
24 \twocolitem{\windowstyle{wxCHK
\_3STATE}}{Create a
3-state checkbox.
25 Not implemented in wxMGL, wxOS2 and wxGTK built against GTK+
1.2.
}
26 \twocolitem{\windowstyle{wxCHK
\_ALLOW\_3RD\_STATE\_FOR\_USER}}{By default a user can't set a
3-state checkbox
27 to the third state. It can only be done from code. Using this flags allows the user to set the checkbox to the third state by clicking.
}
28 \twocolitem{\windowstyle{wxALIGN
\_RIGHT}}{Makes the text appear on the left of the checkbox.
}
31 See also
\helpref{window styles overview
}{windowstyles
}.
33 \wxheading{Event handling
}
36 \begin{twocollist
}\itemsep=
0pt
37 \twocolitem{{\bf EVT
\_CHECKBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_CHECKBOX\_CLICKED event,
38 when the checkbox is clicked.
}
43 \helpref{wxRadioButton
}{wxradiobutton
},
\helpref{wxCommandEvent
}{wxcommandevent
}
45 \latexignore{\rtfignore{\wxheading{Members
}}}
47 \membersection{wxCheckBox::wxCheckBox
}\label{wxcheckboxconstr
}
49 \func{}{wxCheckBox
}{\void}
53 \func{}{wxCheckBox
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
54 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
55 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
56 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
58 Constructor, creating and showing a checkbox.
60 \wxheading{Parameters
}
62 \docparam{parent
}{Parent window. Must not be NULL.
}
64 \docparam{id
}{Checkbox identifier. A value of -
1 indicates a default value.
}
66 \docparam{label
}{Text to be displayed next to the checkbox.
}
68 \docparam{pos
}{Checkbox position. If the position (-
1, -
1) is specified then a default position is chosen.
}
70 \docparam{size
}{Checkbox size. If the default size (-
1, -
1) is specified then a default size is chosen.
}
72 \docparam{style
}{Window style. See
\helpref{wxCheckBox
}{wxcheckbox
}.
}
74 \docparam{validator
}{Window validator.
}
76 \docparam{name
}{Window name.
}
80 \helpref{wxCheckBox::Create
}{wxcheckboxcreate
},
\helpref{wxValidator
}{wxvalidator
}
82 \membersection{wxCheckBox::
\destruct{wxCheckBox
}}
84 \func{}{\destruct{wxCheckBox
}}{\void}
86 Destructor, destroying the checkbox.
88 \membersection{wxCheckBox::Create
}\label{wxcheckboxcreate
}
90 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{ id
},
\rtfsp
91 \param{const wxString\&
}{label
},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
92 \param{const wxSize\&
}{size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
93 \param{const wxValidator\&
}{val
},
\param{const wxString\&
}{name = ``checkBox"
}}
95 Creates the checkbox for two-step construction. See
\helpref{wxCheckBox::wxCheckBox
}{wxcheckboxconstr
}\rtfsp
98 \membersection{wxCheckBox::GetValue
}\label{wxcheckboxgetvalue
}
100 \constfunc{bool
}{GetValue
}{\void}
102 Gets the state of a
2-state checkbox.
104 \wxheading{Return value
}
106 Returns
\true if it is checked,
\false otherwise.
108 \membersection{wxCheckBox::Get3StateValue
}\label{wxcheckboxgetthreestatevalue
}
110 \constfunc{wxCheckBoxState
}{Get3StateValue
}{\void}
112 Gets the state of a
3-state checkbox.
114 \wxheading{Return value
}
116 Returns wxCHK
\_UNCHECKED when the checkbox is unchecked, wxCHK
\_CHECKED
117 when it is checked and wxCHK
\_UNDETERMINED when it's in the undetermined
118 state. Asserts when the function is used with a
2-state checkbox.
120 \membersection{wxCheckBox::Is3rdStateAllowedForUser
}\label{wxcheckboxis3rdstateallowedforuser
}
122 \constfunc{bool
}{Is3rdStateAllowedForUser
}{\void}
124 Returns whether or not the user can set the checkbox to the third state.
126 \wxheading{Return value
}
128 Returns
\true if the user can set the third state of this checkbox,
\false if it can only be set
129 programmatically or if it's a
2-state checkbox.
131 \membersection{wxCheckBox::Is3State
}\label{wxcheckboxis3state
}
133 \constfunc{bool
}{Is3State
}{\void}
135 Returns whether or not the checkbox is a
3-state checkbox.
137 \wxheading{Return value
}
139 Returns
\true if this checkbox is a
3-state checkbox,
\false if it's a
2-state checkbox.
141 \membersection{wxCheckBox::IsChecked
}\label{wxcheckboxischecked
}
143 \constfunc{bool
}{IsChecked
}{\void}
145 This is just a maybe more readable synonym for
146 \helpref{GetValue
}{wxcheckboxgetvalue
}: just as the latter, it returns
147 \true if the checkbox is checked and
\false otherwise.
149 \membersection{wxCheckBox::SetValue
}\label{wxcheckboxsetvalue
}
151 \func{void
}{SetValue
}{\param{bool
}{ state
}}
153 Sets the checkbox to the given state. This does not cause a
154 wxEVT
\_COMMAND\_CHECKBOX\_CLICKED event to get emitted.
156 \wxheading{Parameters
}
158 \docparam{state
}{If
\true, the check is on, otherwise it is off.
}
160 \membersection{wxCheckBox::Set3StateValue
}\label{wxcheckboxset3statevalue
}
162 \func{void
}{Set3StateValue
}{\param{const wxCheckBoxState
}{ state
}}
164 Sets the checkbox to the given state. This does not cause a
165 wxEVT
\_COMMAND\_CHECKBOX\_CLICKED event to get emitted.
167 \wxheading{Parameters
}
169 \docparam{state
}{Can be one of: wxCHK
\_UNCHECKED (Check is off), wxCHK
\_CHECKED
170 (Check is on) or wxCHK
\_UNDETERMINED (Check is mixed). Asserts when the checkbox
171 is a
2-state checkbox and setting the state to wxCHK
\_UNDETERMINED.
}