3D PLM Enterprise Architecture |
User Interface - Dialogs |
CATDlgRadioButtonSets an option among several mutually exclusive ones |
Quick Reference |
CATDialog | +---CATDlgControl | +---CATDlgRadioButton
Each circle and its related title is a radio button instance. The radio buttons allow for selecting mutually exclusive options, that is one radio button is checked and all the others are unchecked. For example, the figure beside is a part of the Print dialog box where you must choose the page orientation among three existing possibilities. In this example, Portrait is selected, and the corresponding button is checked. The two other radio buttons are consequently unchecked. The checked radio button is depicted by the specific color and shading. This can vary depending on the platform and on the CATIA User Interface Style used. |
Use radio buttons whenever you propose to the end user a choice among several mutually exclusive options, that is when one option only can be selected among all the options proposed.
Name | Description |
---|---|
default | The title is placed at the right of the button |
Notification | Method | Sent when |
---|---|---|
CATDlgRadBModifyNotification | GetRadBModifyNotification |
Whenever the radio button is checked or unchecked |
A radio button never exists alone, but always belongs to a set of radio buttons grouped in the same container, such as a frame or a tabpage. All the radio buttons of the same container are automatically bound together in such a way that only one among all can be checked while the others are unchecked. Checking a given radio button unchecks the one that was checked before.
A notification is sent whenever the user presses a radio button. This
notification can be retrieved using the GetRadBModifyNotification
method. The radio button state can be CATDlgCheck
when it is
checked, and CATDlgUncheck
when it is not. You can have to test
this state using the method GetState
, or to set it using the method
SetState
.
A radio button has no style parameter. Construct it as follows:
_pRadioButton = new CATDlgRadioButton(iParent, iName); |
When the end user checks a radio button, this radio button sends a
notification, instance of the CATDlgRadBModifyNotification class. This
notification can be retrieved using the GetRadBModifyNotification
method. If, in the same container, another radio button was checked, it is
unchecked. and it also sends a CATDlgRadBModifyNotification notification. Since
each radio button has usually its own callback method, each of them is executed.
To help distinguish in such a callback method whether the radio button is
checked or unchecked, use the GetState method that retrieves the state. The
following example shows how to do this.
void Container::MethodToExecute(CATCommand * iRadioButton, CATNotification * iNotification, CATCommandClientData iUsefulData) { if (iRadioButton->GetState() == CATDlgCheck) // radio button is checked { // Do what's required when the radio button is checked } else // radio button is unchecked { // Do what's required when the radio button is unchecked } } |
You can set the state of a radio button using the SetState
method:
int iNotify = 1; _pRadioButton->SetState(CATDlgUncheck, iNotify); |
Set the first parameter to the state you require, and the parameter iNotify
to a non null value if you want that the corresponding notification is sent.
Otherwise set to 0, no notification is sent.
Set a callback on a radio button as follows:
AddAnalyseNotificationCB( _pRadioButton, // radio button _pRadioButton->GetRadBModifyNotification(), // notification (CATCommand)&Container::MethodToExecute, // method to execute CATCommandClientData iUsefulData); // useful data for this method |
The radio button title should be set by the resource file using a key built with the identifier you declare as the second parameter of the radio button constructor.
[Top]
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.