Class TMenuItemRadioGroup

Unit

Declaration

type TMenuItemRadioGroup = class(specialize TObjectList<TMenuItemRadio>)

Description

A group of radio buttons.

An instance of this object is always created and destroyed automatically by TMenuItemRadio objects. All TMenuItemRadio within the same group share the same TMenuItemRadioGroup instance.

Never modify anything within this group using general TObjectList properties. Instead always use methods defined here. TODO: This should not descend from TObjectList<TMenuItemRadio> then, it should contain it privately.

Hierarchy

  • TObject
  • TList
  • TObjectList
  • TMenuItemRadioGroup

Overview

Methods

Public procedure Add(Item: TMenuItemRadio); reintroduce;
Public procedure Remove(Item: TMenuItemRadio);
Public function Previous(out Item: TMenuItemRadio; const Cycle: Boolean = false): Boolean;
Public function Next(out Item: TMenuItemRadio; const Cycle: Boolean = false): Boolean;

Properties

Public property Selected: TMenuItemRadio read FSelected write SetSelected;

Description

Methods

Public procedure Add(Item: TMenuItemRadio); reintroduce;

Adds an existing radio menu item to this group. After this, Item.Group will point to this group object.

Note that Item.Checked may be changed to False if there already is a selected item in this group. If the added item already has Item.Checked = False then for sure it will not be changed (SelectedIndex can be left as -1).

Public procedure Remove(Item: TMenuItemRadio);

This item has no description.

Public function Previous(out Item: TMenuItemRadio; const Cycle: Boolean = false): Boolean;

Return previous (from Selected) menu item in this group.

If there's no previous item:

  • When Cycle = True, return the last item.

  • When Cycle = False and there is no previous item, but still Selected <> nil, return Selected.

Only when there's no Selected item, returns False.

Public function Next(out Item: TMenuItemRadio; const Cycle: Boolean = false): Boolean;

Return next (from Selected) menu item in this group.

If there's no next item:

  • When Cycle = True, return the first item.

  • When Cycle = False and there is no next item, but still Selected <> nil, return Selected.

Only when there's no Selected item, returns False.

Properties

Public property Selected: TMenuItemRadio read FSelected write SetSelected;

This is the only currently Checked item.

It can be nil if no item is checked currently (this can happen if you added all initial items with Checked = False, or if you later removed the checked item from the group; we need a state to represent this situation, that's why it's allowed for radio group to have none radio item chosen).


Generated by PasDoc 0.16.0-snapshot.