Class: Wx::PersistentRadioButton
- Inherits:
-
PersistentWindow
- Object
- Wx::PersistentRadioButton
- Defined in:
- lib/wx/doc/gen/persistent_window.rb
Overview
Persistence adapter for RadioButton controls.
This adapter saves and restores the index of the selected RadioButton in a group of radio buttons, to allow to retain the selection across program executions. Example of using it:
// Assume that all these controls are added to some sizer elsewhere.
auto* label = new wxStaticText(this, wxID_ANY, "Play with:");
auto* black = new wxRadioButton(this, wxID_ANY, "&Black",
wxDefaultPosition,
wxDefaultSize,
wxRB_GROUP);
auto* white = new wxRadioButton(this, wxID_ANY, "&White");
// We register the first radio button here, but all radio buttons in the
// same group are potentially affected by this call.
wxPersistentRegisterAndRestore(black);
During the first program execution, black colour will be selected, but if the user selects white pieces, this selection will be restored during the subsequent run.
Instance Method Summary collapse
-
#initialize(radiobutton) ⇒ Wx::PersistentRadioButton
constructor
Constructor.
-
#restore ⇒ Boolean
Restore the previously saved selection.
-
#save ⇒ void
Save the currently selected button index.
Constructor Details
#initialize(radiobutton) ⇒ Wx::PersistentRadioButton
224 |
# File 'lib/wx/doc/gen/persistent_window.rb', line 224 def initialize() end |
Instance Method Details
#restore ⇒ Boolean
Restore the previously saved selection.
If the saved index is valid, i.e. is positive and less than the number of radio buttons in the group, the radio button with the corresponding index will be selected.
236 |
# File 'lib/wx/doc/gen/persistent_window.rb', line 236 def restore; end |
#save ⇒ void
This method returns an undefined value.
Save the currently selected button index.
The 0-based index of the selected radio button in the group is saved as radio button value.
230 |
# File 'lib/wx/doc/gen/persistent_window.rb', line 230 def save; end |