1wxButton(3)                Erlang Module Definition                wxButton(3)
2
3
4

NAME

6       wxButton - Functions for wxButton class
7

DESCRIPTION

9       A  button  is  a control that contains a text string, and is one of the
10       most common elements of a GUI.
11
12       It may be placed on a wxDialog or on a wxPanel panel, or indeed on  al‐
13       most any other window.
14
15       By default, i.e. if none of the alignment styles are specified, the la‐
16       bel is centered both horizontally and vertically.  If  the  button  has
17       both a label and a bitmap, the alignment styles above specify the loca‐
18       tion of the rectangle combining both the label and the bitmap  and  the
19       bitmap position set with wxButton::SetBitmapPosition() (not implemented
20       in wx) defines the relative position of the bitmap with respect to  the
21       label (however currently non-default alignment combinations are not im‐
22       plemented on all platforms).
23
24       Since version 2.9.1 wxButton supports showing both text  and  an  image
25       (currently only when using wxMSW, wxGTK or wxOSX/Cocoa ports), see Set‐
26       Bitmap() (not implemented in wx)  and  setBitmapLabel/2,  setBitmapDis‐
27       abled/2 &c methods. In the previous wxWidgets versions this functional‐
28       ity was only available in (the now trivial) wxBitmapButton class  which
29       was only capable of showing an image without text.
30
31       A button may have either a single image for all states or different im‐
32       ages for the following states (different images are not currently  sup‐
33       ported under macOS where the normal image is used for all states):
34
35       All  of the bitmaps must be of the same size and the normal bitmap must
36       be set first (to a valid bitmap), before setting any other ones.  Also,
37       if  the  size  of  the bitmaps is changed later, you need to change the
38       size of the normal bitmap before setting any other bitmaps with the new
39       size (and you do need to reset all of them as their original values can
40       be lost when the normal bitmap size changes).
41
42       The position of the image inside the button be  configured  using  Set‐
43       BitmapPosition()  (not  implemented  in wx). By default the image is on
44       the left of the text.
45
46       Please also notice that GTK+ uses a global setting  called  gtk-button-
47       images  to  determine  if  the images should be shown in the buttons at
48       all. If it is off (which is the case in e.g. Gnome 2.28 by default), no
49       images will be shown, consistently with the native behaviour.
50
51       Styles
52
53       This class supports the following styles:
54
55       See: wxBitmapButton
56
57       This  class is derived (and can use functions) from: wxControl wxWindow
58       wxEvtHandler
59
60       wxWidgets docs: wxButton
61

EVENTS

63       Event types emitted from this class: command_button_clicked
64

DATA TYPES

66       wxButton() = wx:wx_object()
67

EXPORTS

69       new() -> wxButton()
70
71              Default ctor.
72
73       new(Parent, Id) -> wxButton()
74
75              Types:
76
77                 Parent = wxWindow:wxWindow()
78                 Id = integer()
79
80       new(Parent, Id, Options :: [Option]) -> wxButton()
81
82              Types:
83
84                 Parent = wxWindow:wxWindow()
85                 Id = integer()
86                 Option =
87                     {label, unicode:chardata()} |
88                     {pos, {X :: integer(), Y :: integer()}} |
89                     {size, {W :: integer(), H :: integer()}} |
90                     {style, integer()} |
91                     {validator, wx:wx_object()}
92
93              Constructor, creating and showing a button.
94
95              The preferred way to create standard buttons is to  use  default
96              value  of  label. If no label is supplied and id is one of stan‐
97              dard IDs from this list, a standard label will be used. In other
98              words,  if you use a predefined wxID_XXX constant, just omit the
99              label completely rather than specifying it. In particular,  help
100              buttons  (the  ones with id of wxID_HELP) under macOS can't dis‐
101              play any label at all and while  wxButton  will  detect  if  the
102              standard "Help" label is used and ignore it, using any other la‐
103              bel will prevent the button from correctly appearing as  a  help
104              button and so should be avoided.
105
106              In  addition  to  that,  the button will be decorated with stock
107              icons under GTK+ 2.
108
109              See: create/4, wxValidator (not implemented in wx)
110
111       create(This, Parent, Id) -> boolean()
112
113              Types:
114
115                 This = wxButton()
116                 Parent = wxWindow:wxWindow()
117                 Id = integer()
118
119       create(This, Parent, Id, Options :: [Option]) -> boolean()
120
121              Types:
122
123                 This = wxButton()
124                 Parent = wxWindow:wxWindow()
125                 Id = integer()
126                 Option =
127                     {label, unicode:chardata()} |
128                     {pos, {X :: integer(), Y :: integer()}} |
129                     {size, {W :: integer(), H :: integer()}} |
130                     {style, integer()} |
131                     {validator, wx:wx_object()}
132
133              Button creation function for two-step creation.
134
135              For more details, see new/3.
136
137       getDefaultSize() -> {W :: integer(), H :: integer()}
138
139              Returns the default size for the buttons.
140
141              It is advised to make all the dialog buttons of  the  same  size
142              and  this  function allows retrieving the (platform, and current
143              font dependent) size which should be the best suited for this.
144
145              The optional win argument is new since wxWidgets 3.1.3  and  al‐
146              lows to get a per-monitor DPI specific size.
147
148       getDefaultSize(Win) -> {W :: integer(), H :: integer()}
149
150              Types:
151
152                 Win = wxWindow:wxWindow()
153
154       setDefault(This) -> wxWindow:wxWindow()
155
156              Types:
157
158                 This = wxButton()
159
160              This  sets  the  button  to be the default item in its top-level
161              window (e.g.
162
163              the panel or the dialog box containing it).
164
165              As normal, pressing return causes the default button to  be  de‐
166              pressed when the return key is pressed.
167
168              See  also  wxWindow:setFocus/1 which sets the keyboard focus for
169              windows and text panel items, and  wxTopLevelWindow::SetDefault‐
170              Item() (not implemented in wx).
171
172              Remark:  Under  Windows, only dialog box buttons respond to this
173              function.
174
175              Return: the old default item (possibly NULL)
176
177       setLabel(This, Label) -> ok
178
179              Types:
180
181                 This = wxButton()
182                 Label = unicode:chardata()
183
184              Sets the string label for the button.
185
186       getBitmapDisabled(This) -> wxBitmap:wxBitmap()
187
188              Types:
189
190                 This = wxButton()
191
192              Returns the bitmap for the disabled state, which may be invalid.
193
194              See: setBitmapDisabled/2
195
196              Since: 2.9.1 (available in wxBitmapButton only in previous  ver‐
197              sions)
198
199       getBitmapFocus(This) -> wxBitmap:wxBitmap()
200
201              Types:
202
203                 This = wxButton()
204
205              Returns the bitmap for the focused state, which may be invalid.
206
207              See: setBitmapFocus/2
208
209              Since:  2.9.1 (available in wxBitmapButton only in previous ver‐
210              sions)
211
212       getBitmapLabel(This) -> wxBitmap:wxBitmap()
213
214              Types:
215
216                 This = wxButton()
217
218              Returns the bitmap for the normal state.
219
220              This is exactly the same as GetBitmap() (not implemented in  wx)
221              but uses a name backwards-compatible with wxBitmapButton.
222
223              See: SetBitmap() (not implemented in wx), setBitmapLabel/2
224
225              Since:  2.9.1 (available in wxBitmapButton only in previous ver‐
226              sions)
227
228       setBitmapDisabled(This, Bitmap) -> ok
229
230              Types:
231
232                 This = wxButton()
233                 Bitmap = wxBitmap:wxBitmap()
234
235              Sets the bitmap for the disabled button appearance.
236
237              If bitmap is invalid, the disabled bitmap is set to the automat‐
238              ically  generated  greyed out version of the normal bitmap, i.e.
239              the same bitmap as is used by default  if  this  method  is  not
240              called  at  all. Use SetBitmap() (not implemented in wx) with an
241              invalid bitmap to remove the bitmap completely (for all states).
242
243              See: getBitmapDisabled/1,  setBitmapLabel/2,  SetBitmapPressed()
244              (not implemented in wx), setBitmapFocus/2
245
246              Since:  2.9.1 (available in wxBitmapButton only in previous ver‐
247              sions)
248
249       setBitmapFocus(This, Bitmap) -> ok
250
251              Types:
252
253                 This = wxButton()
254                 Bitmap = wxBitmap:wxBitmap()
255
256              Sets the bitmap for the button appearance when it has  the  key‐
257              board focus.
258
259              If  bitmap is invalid, the normal bitmap will be used in the fo‐
260              cused state.
261
262              See: getBitmapFocus/1, setBitmapLabel/2, SetBitmapPressed() (not
263              implemented in wx), setBitmapDisabled/2
264
265              Since:  2.9.1 (available in wxBitmapButton only in previous ver‐
266              sions)
267
268       setBitmapLabel(This, Bitmap) -> ok
269
270              Types:
271
272                 This = wxButton()
273                 Bitmap = wxBitmap:wxBitmap()
274
275              Sets the bitmap label for the button.
276
277              Remark: This is the bitmap used for the  unselected  state,  and
278              for all other states if no other bitmaps are provided.
279
280              See: SetBitmap() (not implemented in wx), getBitmapLabel/1
281
282              Since:  2.9.1 (available in wxBitmapButton only in previous ver‐
283              sions)
284
285       destroy(This :: wxButton()) -> ok
286
287              Destroys the object.
288
289
290
291wxWidgets team.                    wx 2.1.4                        wxButton(3)
Impressum