Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In TButtonGroup.ButtonOptions what does adding gboGroupStyle do?

The help indicates that adding gboGroupStyle to the ButtonOptions on a TButtonGroup "Specifies that the buttons should inherit the group style that is set on the container." But this explanation still leaves me lost - any ideas?

like image 425
Alister Avatar asked Feb 21 '12 22:02

Alister


3 Answers

The gboGroupStyle option in the TButtonGroup.ButtonOptions property has nothing to do with GroupIndex as it's known e.g. from TSpeedButton.

Setting of the gboGroupStyle option to True allows you to:

  • set the TButtonGroup.ItemIndex property, so you can predefine which button will be focused as default, nothing cool
  • click the buttons with ENTER or SPACE keys, what will fire the TGrpButtonItem.OnClick event of the button item (if assigned), perform its action, or fire the TButtonGroup.OnButtonClicked event

I agree the name of this is quite misleading, but that's what I found in the source code from Delphi-XE2.

like image 110
TLama Avatar answered Sep 28 '22 23:09

TLama


gboGroupStyle makes the TButtonGroup act as a group - that means, one and only one button is selected at a given time. It is similar to grouping several TSpeedButtons with the GroupIndex, where only one button inside that group is selected at any time. The currently selected button can be read and written via the ItemIndex property of TButtonGroup. To visualize the selected button one can implement an OnBeforeDrawButton or OnDrawButton handler.

like image 34
Uwe Raabe Avatar answered Sep 28 '22 23:09

Uwe Raabe


From my experimentation it looks like if gboGroupStyle is used then the ItemIndex property can be set to something other than -1, so that the TButtonGroup remembers the last button that was pressed.

like image 45
Alister Avatar answered Sep 29 '22 00:09

Alister