3D PLM Enterprise Architecture

User Interface - Dialogs

CATDlgRadioItem

Sets an option among several mutually exclusive ones
Quick Reference

CATDialog
  |
  +---CATDlgMenuItem
        |
        +---CATDlgRadioItem

The Radio Item
CATDlgRadioItem.jpg (9356 bytes) Each item beside is a radio item instance. The radio items allow for selecting mutually exclusive options, that is one radio item is checked and all the others are unchecked. For example, the figure beside is a part of the View->Render Style submenu where you must choose the render style among six existing possibilities. In this example, Apply Customized view is selected, and the corresponding item is checked. The five other radio items are consequently unchecked. The checked radio item is depicted by the check sign. This is the default and can vary depending on the platform and on the CATIA User Interface Style used. Note that if another radio item were checked, such as ListRadioItem.jpg (2002 bytes), the associated icon would appear as pressed, providing the appropriate icons for both check and uncheck states were supplied.

Use radio items 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.


Styles
Name Description
default The default radio item style

[Top]


Events
Notification Method Sent when
CATDlgRadIModifyNotification GetRadIModifyNotification Whenever the radio item is checked or unchecked

[Top]


Programmer's Guide

A radio item never exists alone, but always belongs to a set of radio items grouped in the same container, such as a frame or a tabpage. All the radio items 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 item unchecks the one that was checked before.

A notification is sent whenever the user presses a radio item. This notification can be retrieved using the  GetRadBModifyNotification method. The radio item 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.

[Top]

Constructing a Radio Item

The radio item should have for parent either the menu, submenu, toolbar, or icon box in which it appears:

_pRadioItem = new CATDlgRadioItem(iParent, iName);

[Top]

Setting a Callback on a Radio Item

Set a callback on a radio item as follows:

AddAnalyseNotificationCB(
   _pRadioItem,                                  // radio item 
   _pRadioItem->GetRadIModifyNotification(),     // notification
   (CATCommand)&Container::MethodToExecute,      // method to execute 
   CATCommandClientData iUsefulData);            // useful data for this method 

[Top]

Retrieving or Setting the State of a Radio Item

When the end user checks a radio item,  this radio item sends a notification, instance of the CATDlgRadIModifyNotification class. This notification can be retrieved using the GetRadIModifyNotification method. If, in the same container, another radio item was checked, it is unchecked. and it also sends a CATDlgRadIModifyNotification notification. Since each radio item has usually its own callback method, each of them is executed. To help distinguish in such a callback method whether the radio item is checked or unchecked, use the GetState method that retrieves the state. The following example shows how to do this.

void Container::MethodToExecute(CATCommand           * iRadioItem,
                                CATNotification      * iNotification,
                                CATCommandClientData   iUsefulData)
{
  if (iRadioItem->GetState() == CATDlgCheck) // radio item is checked
  { // Do what's required when the radio item is checked }
  else                                          // radio item is unchecked
  { // Do what's required when the radio item is unchecked }
}

You can set the state of a radio item using the SetState method:

int iNotify = 1;
_pRadioItem->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.

[Top]

Setting a Title to a Radio Item

The radio item should be set by the resource file using a key built with the identifier you declare as the second parameter of the radio item constructor.

[Top]


History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.