Skip to content

HowTo : Widgets

Martin Corino edited this page May 8, 2024 · 1 revision
     About      FAQ      User Guide      Reference documentation

wxRuby Widgets

This wxRuby guide describes the common properties of Wx::Control derived widgets.

Common widget methods

A list of useful methods which can be used with all widgets (derived from Wx::Control).

Method Description
set_label(string) Sets the control’s label taking mnemonic notations (& prefixed characters) into account.
get_label Returns the control’s label, as it was passed to #set_label.
set_label_text(string) Sets the control’s label to exactly the given string (no mnemonics handling).
get_label_text Returns the control’s label without mnemonics. Note that because of the stripping of the mnemonics the returned string may differ from the string which was passed to #set_label but should always be the same which was passed to #set_label_text.
set_label_markup(string) Sets the controls label to a string using markup. Simple markup supported by this function can be used to apply different fonts or colours to different parts of the control label when supported. If markup is not supported by the control or platform, it is simply stripped and #set_label is used with the resulting string.

Common widget events

A list of event connector methods which can be used for all widgets (derived from Wx::Control).

Event connector Description
evt_text_copy Connects handler for Wx::EVT_TEXT_COPY event which occurs when some or all of the widgets content was copied to the clipboard.
evt_text_cut Connects handler for Wx::EVT_TEXT_CUT event which occurs when some or all of the widgets content was cut (i.e. copied and deleted).
evt_text_paste Connects handler for Wx::EVT_TEXT_PASTE event which occurs when clipboard content was pasted into the widget.

NOTE The described events will only be generated for widgets with selectable content which currently is only the case for text entry widgets (Wx::TextCtrl, Wx::ComboBox without Wx::CB_READONLY and such).

Clone this wiki locally