class CGXRadioButton: public CGXControl

The CGXRadioButton class implements a control with a group of radio buttons which can be used in grid cells. When constructing a CGXRadioButton you can choose between 3d-look and old MS Windows 3.x look.

You can specify the radio buttons’ text with CGXStyle::SetChoiceList,where different choices are separated with a newline character (‘\n’).The user can change this style setting through the CGXStyleSheet dialog (“control”-page).

The state of the radio buttons is passed through the style object’s value-attribute (CGXStyle::SetValue). If the value is 0, the first choice is selected. If it is 1, the second choice is selected, and so on. If the value is empty, no choice is selected.

Other style attributes which specify the appearance of the radio buttons are:

·Text color with SetColor.
·Background color with SetInterior.
·Cell frame 3d-effect (raised, inset, normal) with SetDraw3dFrame.
·Borders with SetBorder.
·Font with SetFont.

When the user clicks one of the radio buttons, the control hit-tests the mouse click and selects the hit choice. After changing the value, the OnClickedButton method is called. The default behavior of OnClickedButton is to call CGXGridCore::OnClickedButtonRowCol.

To process this event, you can either subclass CGXRadioButton and override the control’s OnClickedButton method or simply override OnClickedButtonRowCol in your CGXGridCore-derived class.

The default ids for CGXRadioButton controls are:
·GX_IDS_CTRL_RADIOBTN with old Windows 3.x look
·GX_IDS_CTRL_RADIOBTN3D with newer 3d-look.

You can apply radio buttons to cells with

   SetStyleRange(range,
      CGXStyle()
         .SetControl(GX_IDS_CTRL_RADIOBTN3D)
         .SetChoiceList("choice one\nchoice two\nchoice three\n")
         .SetValue("0") // select first choice
      );

#include <gxall.h>

See Also

 CGXGridCore::RegisterControl  CGXStyle::SetControl  CGXControl::OnClickedButton  CGXGridCore::OnClickedButtonRowCol  CGXStyle

CGXRadioButton

 Class Members