DI_RADIOBUTTON

Far Manager

DI_RADIOBUTTON

The DI_RADIOBUTTON dialog item describes a Radio Button control. It is also known as the "button with dependent fixation". It acts like a Check Box, except that if the first radio button item in a group of several consequent radio button items have the DIF_GROUP flag set, they become mutually exclusive — if one of them has been switched on all others will be switched off.
struct FarDialogItem
{
  int Type          = DI_RADIOBUTTON
  int X1            = X
  int Y1            = Y
  int X2            = 0 (not used in Dialog API 1.0)
  int Y2            = Y (equals to Y1)
  int Focus         = Focus
  int Selected      = Selected
  DWORD Flags       = Flags
  int DefaultButton = DefaultButton
  char Data[512]    = Radio button caption
};

Attention! Attention!

  • This is an exemplary structure; read full description here.

Focus

Keyboard focus flag.

Selected

The field reflects current state of the radio button control: is it switched on or off.

Flags

There are several flags applicable to the DI_RADIOBUTTON control:
FlagDescription
DIF_SETCOLOR The low byte of Flags will be used as the item's color.
DIF_GROUP This flag should be set for the first radio button item in a group.
DIF_MOVESELECT Change selection in a radio button group when focus is moved. Radio buttons with this flag set are also drawn without parentheses around the selection mark (example: FAR color selection dialog).
DIF_CENTERGROUP Sequential items with this flag set and equal vertical coordinates will be horizontally centered in the dialog. Their X1 and X2 coordinates are ignored.
DIF_DISABLE Disables user access to the control.
DIF_NOFOCUS The dialog item cannot receive keyboard focus, but can handle other user events.
DIF_SHOWAMPERSAND Show ampersand symbol in caption instead of using it for defining hotkeys.

Events

EventDescription
DN_DRAWDLGITEM This event is sent to the dialog callback function before the control is drawn.
DN_CTLCOLORDLGITEM Plugin should pass the color attributes of the control when this event comes. Param2 parameter (foreground+background):
LoWord LoByte - color of the caption
                (COL_WARNDIALOGBUTTON or
                 COL_DIALOGTEXT)
LoWord HiByte - color of highlighted text
                (COL_WARNDIALOGHIGHLIGHTTEXT or
                 COL_DIALOGHIGHLIGHTTEXT)
HiWord LoByte - 0
HiWord HiByte - 0
If a special attribute is used (DIF_SETCOLOR flag), the caption (LoWord LoByte) will be drawn according to the parameters.
DN_HOTKEY Hotkey was pressed (Alt-<letter>).
DN_BTNCLICK State of the radiobutton was changed.
DN_KEY This event comes after the user has pressed a key in the dialog.
DN_MOUSECLICK This event comes after the user has clicked one of the dialog items or outside the dialog with the mouse button.
DN_KILLFOCUS This event is sent just before the button loses focus, if the flag DIF_NOFOCUS was not used.
DN_GOTFOCUS This event is sent after the button has received keyboard focus, if the flag DIF_NOFOCUS was not used.

Remarks

It is strongly recommended to set correct values for X2 and Y2 fields, although they aren't used in Dialog API 1.0.
See also: