Reference for the Mosaic class WidgetSet::RadioButton

WidgetSet::RadioButton
Appearance
Icon
IconFrame
IconOffFrame
IconOffFrameActive
IconOffFrameDefault
IconOffFrameDisabled
IconOffFrameFocused
IconOnFrame
IconOnFrameActive
IconOnFrameDefault
IconOnFrameDisabled
IconOnFrameFocused
Label
LabelOff
LabelOn
OnEnter
OnLeave
OnPress
OnRelease
OnSelect
Outlet
OutletSelector
ResignAfterHorizontalWipe
ResignAfterVerticalWipe
Selected
Core::Group
AlphaBlended
Buffered
Embedded
Enabled
Focus
Opacity
Visible
Add()
AddBehind()
BroadcastEvent()
BroadcastEventAtPosition()
CountDialogs()
CountViews()
DismissDialog()
DispatchEvent()
FadeGroup()
FindActiveDialogByClass()
FindCurrentDialog()
FindDialogByClass()
FindNextView()
FindPrevView()
FindSiblingView()
FindViewAtPosition()
FindViewInDirection()
FindViewWithinArea()
GetContentArea()
GetDialogAtIndex()
GetIndexOfDialog()
GetIndexOfView()
GetViewAtIndex()
GlobalPosition()
HasViewState()
Init()
InvalidateArea()
InvalidateViewState()
IsActiveDialog()
IsCurrentDialog()
IsDialog()
LocalPosition()
ObtainFocus()
PresentDialog()
Remove()
RemoveAll()
Restack()
RestackBack()
RestackBehind()
RestackTop()
SwitchToDialog()
UpdateLayout()
UpdateViewState()
Core::RectView
Bounds
Core::View
Layout
Owner
StackingPriority
ArrangeView()
ChangeViewState()
CursorHitTest()
Draw()
GetExtent()
GetRoot()
HandleEvent()
MoveView()

SEE ALSO

Using and customizing the Radio Button widget.

This class implements a bistable 'radio button' widget. When the user taps the button, the current state of the button represented by the boolean property Selected is set and signal is sent to the slot method stored in the property OnSelect. Once selected, the radio button remains in this state until the property Selected is set to the value 'false' (e.g. in reaction to another radio button selection). By connecting further slot methods to the properties OnPress, OnRelease, OnEnter and OnLeave you can react to other events triggered while the user interacts with the button.

Alternatively the property Outlet can refer to any other 'int32' property the widget should remain synchronized with. When the user selects the radio button, the affected property is automatically set to the value OutletSelector. On the other hand, when the referred property is modified by another one, the radio button is automatically notified to remain in sync with the property.

This approach follows the Mode-View-Controller (MVC) programming paradigm. Here the radio button represents the 'View' and the 'Controller' and the property referred via 'Outlet' can be seen as a part of the 'Model'.

During its lifetime the button remains always in one of the four states: 'disabled', 'default', 'focused' and 'active'. The state 'disabled' is true for every not available button (the property Enabled of the button is 'false'). Such buttons will ignore all user inputs. The state 'default' determines a button, which is ready to be touched by the user or ready to become focused. As soon as the button becomes focused, it switches in the state 'focused'. In this state the user can activate the button by pressing a key on the keyboard. Finally, the state 'active' is true, if the user actually interacts with the button (the button is pressed).

The exact look and feel of the radio button is determined by the 'Radio Button Configuration' object assigned to the property Appearance. The configuration object provides bitmaps, colors, fonts and other configuration parameters needed to construct and display the radio button. Usually, you will manage in your project your own configuration objects and customize the radio buttons according to your design expectations. Depending on the information provided in the associated configuration object, the radio button will be composed of following views:

In particular application cases you can instruct the button to automatically resign and retarget the actual touch interaction to another touch handler (e.g. another widget) after the user has performed a horizontal wipe gesture (ResignAfterHorizontalWipe) or vertical wipe gesture (ResignAfterVerticalWipe). Using these properties several widgets can cooperate during an active user interaction even if these handler overlap each other.

If the button is actually focused, it can also be activated by pressing the keyboard key Core::KeyCode.Enter. In the configuration object you can specify another key code, if desired. To prevent the button from being able to be focused, specify in the configuration object the Core::KeyCode.NoKey as the code to activate the button.

For more details regarding the customization of the button see the description of WidgetSet::RadioButtonConfig class.

property WidgetSet::RadioButtonConfig Appearance = null;

The property 'Appearance' refers to a 'Radio Button Config' object containing bitmaps, colors, fonts and further configuration attributes to customize this radio button widget. By assigning a configuration object to the property 'Appearance', the radio button automatically assumes the look and feel as determined in the properties of the configuration object.

If there is no configuration object associated to the radio button (the property 'Appearance' is 'null') the radio button limits to display the bitmap specified in the property Icon.

Please note, configuration objects can be shared among multiple radio button widgets. When the properties of the configuration object change, all radio buttons (connected actually to it) are notified and updated to assume the new appearance.

property Resources::Bitmap Icon = null;

The property 'Icon' refers to the bitmap object to display as icon in this radio button widget. If the bitmap consists of more than one frame, the desired frame number can be determined by using the property IconFrame or individually for every button state by using the properties IconOffFrame, IconOnFrame, IconOffFrameDefault, IconOffFrameFocused, IconOffFrameActive, IconOffFrameDisabled, IconOnFrameDefault, IconOnFrameFocused, IconOnFrameActive and IconOnFrameDisabled.

If the bitmap is animated and the property IconOffFrameDefault, IconOffFrameFocused, IconOffFrameActive, IconOffFrameDisabled, IconOnFrameDefault, IconOnFrameFocused, IconOnFrameActive or IconOnFrameDisabled is initialized with the value -1, the animation will start automatically as soon as the button enters the corresponding state.

Per default, the icon is displayed centered within the radio button area. You can modify the alignment of the icon, its margins, its opacity as well as its colors (if the specified bitmap is Alpha8) in the configuration object assigned to the property Appearance.

property int32 IconFrame = -1;

The property 'IconFrame' determines the frame number within the bitmap Icon to be displayed. Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

This property determines the icon frame number to be used regardless of the actual state of the button. By using the properties IconOffFrame, IconOffFrameActive, IconOffFrameDefault, IconOffFrameDisabled, IconOffFrameFocused, IconOnFrame, IconOnFrameActive, IconOnFrameDefault, IconOnFrameDisabled and IconOnFrameFocused you can specify different frame number for every button state.

property int32 IconOffFrame = -1;

The property 'IconOffFrame' determines the frame number within the bitmap Icon to be displayed when the button is actually switched-off (property Selected is 'false'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

This property determines the icon frame number to be used when the button is actually switched-off (property Selected is 'false') regardless of other button states. By using the properties IconOffFrameActive, IconOffFrameDefault, IconOffFrameDisabled, IconOffFrameFocused, IconOnFrame, IconOnFrameActive, IconOnFrameDefault, IconOnFrameDisabled and IconOnFrameFocused you can specify different frame number for every button state.

property int32 IconOffFrameActive = -1;

The property 'IconOffFrameActive' determines the frame number within the bitmap Icon to be displayed when the button is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the radio button should react on) and it is actually switched-off (property Selected is 'false'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'active/switched-off' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOffFrameDefault = -1;

The property 'IconOffFrameDefault' determines the frame number within the bitmap Icon to be displayed when the button is in the 'default' state and it is actually switched-off (property Selected is 'false'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'default/switched-off' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOffFrameDisabled = -1;

The property 'IconOffFrameDisabled' determines the frame number within the bitmap Icon to be displayed when the button is in the 'disabled' state (its property Enabled is 'false') and it is actually switched-off (property Selected is 'false'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'disabled/switched-off' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOffFrameFocused = -1;

The property 'IconOffFrameFocused' determines the frame number within the bitmap Icon to be displayed when the button is in the 'focused' state (the button can react to keyboard events) and it is actually switched-off (property Selected is 'false'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'focused/switched-off' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOnFrame = -1;

The property 'IconOnFrame' determines the frame number within the bitmap Icon to be displayed when the button is actually switched-on (property Selected is 'true'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

This property determines the icon frame number to be used when the button is actually switched-on (property Selected is 'true') regardless of other button states. By using the properties IconOffFrame, IconOffFrameActive, IconOffFrameDefault, IconOffFrameDisabled, IconOffFrameFocused, IconOnFrameActive, IconOnFrameDefault, IconOnFrameDisabled and IconOnFrameFocused you can specify different frame number for every button state.

property int32 IconOnFrameActive = -1;

The property 'IconOnFrameActive' determines the frame number within the bitmap Icon to be displayed when the button is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the radio button should react on) and it is actually switched-on (property Selected is 'true'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'active/switched-on' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOnFrameDefault = -1;

The property 'IconOnFrameDefault' determines the frame number within the bitmap Icon to be displayed when the button is in the 'default' state and it is actually switched-on (property Selected is 'true'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'default/switched-on' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOnFrameDisabled = -1;

The property 'IconOnFrameDisabled' determines the frame number within the bitmap Icon to be displayed when the button is in the 'disabled' state (its property Enabled is 'false') and it is actually switched-on (property Selected is 'true'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'disabled/switched-on' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 IconOnFrameFocused = -1;

The property 'IconOnFrameFocused' determines the frame number within the bitmap Icon to be displayed when the button is in the 'focused' state (the button can react to keyboard events) and it is actually switched-on (property Selected is 'true'). Thus this property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no icon is shown.

If the property is initialized with the value -1 and the Icon bitmap is animated, the animation is automatically started as soon as the button enters the 'focused/switched-on' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property string Label = "";

The property 'Label' specifies the text to display as label in this radio button widget. The desired font as well as the colors for all individual button states have to be specified in the configuration object assigned to the property Appearance. If there is no configuration object associated to this radio button widget (the property Appearance is 'null'), no label is displayed.

Per default, the label is displayed centered within the radio button area. You can modify the alignment of the label as well as its margins by specifying them in the configuration object.

This property determines the label to be used regardless of the actual state of the button. By using the properties LabelOff and LabelOn you can specify different labels for every button state.

property string LabelOff = "";

The property 'LabelOff' specifies the text to display as label in this radio button widget when it is in the switched-off state (property Selected is 'false'). The desired font as well as the colors for all individual button states have to be specified in the configuration object assigned to the property Appearance. If there is no configuration object associated to this radio button widget (the property Appearance is 'null'), no label is displayed.

Per default, the label is displayed centered within the radio button area. You can modify the alignment of the label as well as its margins by specifying them in the configuration object.

property string LabelOn = "";

The property 'LabelOn' specifies the text to display as label in this radio button widget when it is in the switched-on state (property Selected is 'true'). The desired font as well as the colors for all individual button states have to be specified in the configuration object assigned to the property Appearance. If there is no configuration object associated to this radio button widget (the property Appearance is 'null'), no label is displayed.

Per default, the label is displayed centered within the radio button area. You can modify the alignment of the label as well as its margins by specifying them in the configuration object.

property slot OnEnter = null;

The property 'OnEnter' can refer to a slot method, which will receive signals when while pressing the radio button the user drags the finger so it leaves and enters the button area. Accordingly, the button assumes the 'active' state again (it is 'armed' now). In the associated slot method the implementation can handle the event.

This event is also triggered, if the button is focused and the user presses the key on the keyboard to activate the button.

property slot OnLeave = null;

The property 'OnLeave' can refer to a slot method, which will receive signals when while pressing the radio button the user drags the finger so it leaves the button area. Accordingly, the button assumes the 'default' or 'focused' state again (it is not 'armed' anymore). In the associated slot method the implementation can handle the event.

This event is also triggered, if the button is focused and the user (after pressing a key on the keyboard to activate the button) releases this key again terminating so the interaction.

property slot OnPress = null;

The property 'OnPress' can refer to a slot method, which will receive a signal as soon as the user touches the radio button or, if the button is focused, presses the key on the keyboard to activate the radio button. Thereupon the method's logic will be executed.

In other words, this event is triggered at the beginning of the interaction between user and the button.

property slot OnRelease = null;

The property 'OnRelease' can refer to a slot method, which will receive a signal as soon as the user lifts the finger from the radio button or, if the button was activated by preceding keyboard event, the user releases the key again. Thereupon the method's logic will be executed.

In other words, this event is triggered at the end of the interaction between user and the button.

property slot OnSelect = null;

The property 'OnSelect' can refer to a slot method, which will receive a signal as soon as the user has activated the button causing the button to change its state from switched-off to switched-on. Thereupon the method's logic will be executed. In the associated slot method you can evaluate the property Selected as reflecting the current switched-off/on state of the button.

The button is activated when the user (after touching the button) releases the button again while the finger was still within the button area. If the radio button is controlled by keyboard events, the button is activated when the user (after pressing the corresponding key) releases it again.

Please note, once in the switched-on state, the user can't toggle the radio button in the switched-off state. To change the state, you have to set the property Selected to the value 'false'. Alternatively, you can group several radio buttons by connecting them to the same Outlet property. In this case the actually selected button is automatically switched-off when the user selects another one.

property ^int32 Outlet = null;

The property 'Outlet' can refer to any other 'int32' property the widget should remain synchronized with. When the user selects the radio button, the affected property is automatically updated to the value found in the property OutletSelector. On the other hand, when the referred property is modified by another one, the radio button is automatically notified to remain in sync with the property. The button appears selected (switched-on), when the referred property has the value equal to OutletSelector.

This approach follows the Mode-View-Controller (MVC) programming paradigm. Here the radio button represents the 'View' and the 'Controller' and the property referred via 'Outlet' can be seen as a part of the 'Model'.

property int32 OutletSelector = 0;

The property 'OutletSelector' contains a value identifying the radio button within a group of radio buttons. At the runtime, the button compares this value with the value of the property referred by Outlet and if both are equal, the radio button assumes the 'selected' (switched-on) state (its property Selected is 'true'). If the values are different, the radio button appears not selected (switched-off). This selector is useful to build a group of radio buttons that refers to the same outlet. Different selectors for each radio button manages automatically the group of radio buttons.

property bool ResignAfterHorizontalWipe = false;

The property 'ResignAfterHorizontalWipe' determines whether while interacting with the radio button, the button may automatically resign and deflect the current processing of touch events (the current grab cycle) to another touch handler.

If this property is 'true' and the user performs a horizontal wipe gesture within the button area, the button searches for another touch handler (e.g. another widget) willing to take over the further event processing of the actual interaction. In other words, you use this property to specify that the radio button is NOT interested to process the horizontal wipe gestures and thus other handler should take over.

property bool ResignAfterVerticalWipe = false;

The property 'ResignAfterVerticalWipe' determines whether while interacting with the radio button, the button may automatically resign and deflect the current processing of touch events (the current grab cycle) to another touch handler.

If this property is 'true' and the user performs a vertical wipe gesture within the button area, the button searches for another touch handler (e.g. another widget) willing to take over the further event processing of the actual interaction. In other words, you use this property to specify that the radio button is NOT interested to process the vertical wipe gestures and thus other handler should take over.

property bool Selected = false;

The property 'Selected' stores the current state of the radio button. As long as the property is 'false', the widget is in switched-off (not selected) state. In turn, initializing the property with the value 'true' causes the button to change in the switched-on (selected) state.