1 \section{\class{wxButton
}}\label{wxbutton
}
3 A button is a control that contains a text string,
4 and is one of the commonest elements of a GUI. It may be placed on a
5 \rtfsp\helpref{dialog box
}{wxdialog
} or
\helpref{panel
}{wxpanel
}, or indeed
6 almost any other window.
8 \wxheading{Derived from
}
10 \helpref{wxControl
}{wxcontrol
}\\
11 \helpref{wxWindow
}{wxwindow
}\\
12 \helpref{wxEvtHandler
}{wxevthandler
}\\
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Window styles
}
17 There are no special styles for wxButton.
19 See also
\helpref{window styles overview
}{windowstyles
}.
23 \helpref{wxBitmapButton
}{wxbitmapbutton
}
25 \latexignore{\rtfignore{\wxheading{Members
}}}
27 \membersection{wxButton::wxButton
}\label{wxbuttonconstr
}
29 \func{}{wxButton
}{\void}
33 \func{}{wxButton
}{\param{wxWindow*
}{parent
},
\param{const wxWindowID
}{ id
},
\param{const wxString\&
}{label
},
\rtfsp
34 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
35 \param{const long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
37 Constructor, creating and showing a button.
39 \wxheading{Parameters
}
41 \docparam{parent
}{Parent window. Must not be NULL.
}
43 \docparam{id
}{Button identifier. A value of -
1 indicates a default value.
}
45 \docparam{label
}{Text to be displayed on the button.
}
47 \docparam{pos
}{Button position.
}
49 \docparam{size
}{Button size. If the default size (-
1, -
1) is specified then the button is sized
50 appropriately for the text.
}
52 \docparam{style
}{Window style. See
\helpref{wxButton
}{wxbutton
}.
}
54 \docparam{validator
}{Window validator.
}
56 \docparam{name
}{Window name.
}
60 \helpref{wxButton::Create
}{wxbuttoncreate
},
\helpref{wxValidator
}{wxvalidator
}
62 \membersection{wxButton::
\destruct{wxButton
}}
64 \func{}{\destruct{wxButton
}}{\void}
66 Destructor, destroying the button.
68 \membersection{wxButton::Create
}\label{wxbuttoncreate
}
70 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{const wxWindowID
}{ id
},
\param{const wxString\&
}{label
},
\rtfsp
71 \param{const wxPoint\&
}{pos
},
\param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
72 \param{const long
}{ style =
0},
\param{const wxValidator\&
}{validator
},
\param{const wxString\&
}{name = ``button"
}}
74 Button creation function for two-step creation. For more details, see
\helpref{wxButton::wxButton
}{wxbuttonconstr
}.
76 \membersection{wxButton::GetLabel
}\label{wxbuttongetlabel
}
78 \constfunc{wxString
}{GetLabel
}{\void}
80 Returns the string label for the button.
82 \wxheading{Return value
}
88 \helpref{wxButton::SetLabel
}{wxbuttonsetlabel
}
90 \membersection{wxButton::SetDefault
}\label{wxbuttonsetdefault
}
92 \func{void
}{SetDefault
}{\void}
94 This sets the button to be the default item for the panel or dialog
99 Under Windows, only dialog box buttons respond to this function. As
100 normal under Windows and Motif, pressing return causes the default button to
101 be depressed when the return key is pressed. See also
\helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}\rtfsp
102 which sets the keyboard focus for windows and text panel items,
\helpref{wxWindow::OnDefaultAction
}{wxwindowondefaultaction
}\rtfsp
103 and
\helpref{wxWindow::GetDefaultItem
}{wxwindowgetdefaultitem
}.
105 Note that under Motif, calling this function immediately after
106 creation of a button and before the creation of other buttons
107 will cause misalignment of the row of buttons, since default
108 buttons are larger. To get around this, call
{\it SetDefault
}\rtfsp
109 after you have created a row of buttons: wxWindows will
110 then set the size of all buttons currently on the panel to
113 \membersection{wxButton::SetLabel
}\label{wxbuttonsetlabel
}
115 \func{void
}{SetLabel
}{\param{const wxString\&
}{label
}}
117 Sets the string label for the button.
119 \wxheading{Parameters
}
121 \docparam{label
}{The label to set.
}
125 \helpref{wxButton::GetLabel
}{wxbuttongetlabel
}