os_input_radio
|
 |
An input radio button within a
form.
An os_input_radio
presents a choice that can either be checked or unchecked within an os_form
. An os_input_radio is rendered as a radio button
icon. An os_input_radio is initially unchecked by
default. This default can be changed to initially checked through either a
constructor or the check() member function.
Each os_input_radio
has a name, a value, and a marker, which are specified in a constructor and can
be modified through the name() , value()
, and marker() member functions. The same name can
be specified for more than one os_input_radio
button to indicate that all represent choices within the same category.
If an os_input_radio
is checked when the containing os_form is
submitted, the name and value are transmitted. os_input_radio
allows only one selection within a category. All os_input_radio
elements with the same name are part of the same category. Checking one os_input_radio
button unchecks the previously checked button. If you want to permit multiple
choices for a category, use the class os_input_checkbox
instead.
By default, a marker that labels
the choice is positioned on the right of the icon. The position of the marker
can be specified through either a constructor or through the position()
member function.
An os_input_radio
need not specify a name if it is to be inserted into an os_radio_group
. Upon insertion, the os_input_radio assumes both
the name and marker position specified in the os_radio_group
.
Declaration
#include <ospace/web/inradio.h>
class os_input_radio : public os_element
Enums
enum os_input_radio::marker_position
{
marker_right, // Places the marker to the right of the radio button.
marker_left // Places the marker to the left of the radio button.
};
enum os_input_radio::check_type
{
not_checked, // Sets the radio button to the unselected state.
checked // Sets the radio button to the selected state.
};
Interface
Constructor
os_input_radio(
const string& name ,
const string& value ,
const os_element& element ,
check_type check ,
marker_position position )
Constructs an input radio
button with name attribute set to name , value
attribute set to value , and surrounding element
at position (default marker_right
). Starts in the check (default not_checked
) state.
Constructor
os_input_radio(
const string& name ,
const string& value ,
const string& text ,
check_type check ,
marker_position position )
Constructs an input radio
button with name attribute set to name , value
attribute set to value , and surrounding text
at position (default marker_right
). Starts in the check (default not_checked
) state.
Constructor
os_input_radio(
const string& value ,
const os_element& element ,
check_type check ,
marker_position position )
Constructs a radio button
with name "radio_button", value value ,
and surrounding element at position
(default marker_right ). Starts in the check
(default not_checked ) state.
Constructor
os_input_radio(
const string& value ,
const string& text ,
check_type check ,
marker_position position )
Constructs a radio button
with name "radio_button", value value ,
and surrounding text at
position (default marker_right ). Starts
in the check (default not_checked
) state.
Constructor
os_input_radio(
const os_input_radio& rhs )
Constructs an input radio
button to be a copy of rhs .
Destructor
/*
virtual */ ~os_input_radio()
Destroys the input radio
button.
=
os_input_radio&
operator=( const os_input_radio& rhs )
Replaces the input radio
button contents with a copy of rhs and returns a
reference to the input radio button.
check
int
check() const
Returns the initial check
state.
check
os_input_radio&
check( check_type check )
Sets the check status to check
and returns a reference to the input radio button.
clone
/*
virtual */ os_element* clone() const
Returns a base class
pointer to a heap-based deep copy of the input radio button.
marker
os_input_radio&
marker( const os_element& element )
Sets the display marker to
a copy of element and returns a reference to the
input radio button.
marker
os_element*
marker() const
Returns a pointer to the
display marker.
marker
os_input_radio&
marker( const string& text )
Sets the display marker to
an os_text element created from text
and returns a reference to the input radio button.
name
string
name() const
Returns the name.
name
os_input_radio&
name( const string& name )
Sets the name to name
and returns a reference to the input radio button.
position
os_input_radio&
position( marker_position position )
Sets the position of the
display marker to position and returns a reference
to the input radio button.
position
int
position() const
Returns the display marker
position.
print
void
print( ostream& os )
const
Prints the input radio
button to os .
value
os_input_radio&
value( const string& value )
Sets the value to value
and returns a reference to the input radio button.
value
string
value() const
Returns the value.
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved