8

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?

Kromster
  • 7,181
  • 7
  • 63
  • 111
Alister
  • 6,527
  • 4
  • 46
  • 70

3 Answers3

7

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:

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

TLama
  • 75,147
  • 17
  • 214
  • 392
  • 1
    I'd pretty much gotten this far myself, but TLama might as well get the rep as this is the most complete answer. I think that with gboGroupStyle it's best to think of the TButtonGroup as a TRadioGroup, in that it has a single selected item. – Alister Feb 23 '12 at 06:27
3

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.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130
  • 2
    I don't think this is correct as there is no concept of "down" for a TButtonGroup. It looks like gboGroupStyle influences how the ItemIndex property works. – Alister Feb 22 '12 at 10:30
  • Yes, the "down" was actually meant as a metaphor with regard the TSpeedButton reference. The idea is to specify one selected button, however that may be visualized (e.g. in OnBeforeDrawButton). – Uwe Raabe Feb 22 '12 at 12:08
2

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.

Alister
  • 6,527
  • 4
  • 46
  • 70