I have RadioGroup with many buttons. Now when I add an item, they become smaller and smaller. How is it possible to make them scrollable?
2 Answers
TRadioGroup does not natively support scrolling. However, what you can do instead is the following:
place a
TGroupBoxon your UI.place a
TScrollBoxonto theTGroupBox, set itsAlignproperty toalClient, and itsBorderStyleproperty tobsNone.place a
TRadioGrouponto theTScrollBox, clear itsCaptionproperty, and set itsLeftproperty to-2and itsTopproperty to-15(or whatever theTRadioGroup.Fontis set to plus a few extra pixels). This positioning is needed because you cannot turn off theTRadioGroup's borders or the space reserved for itsCaption.Tweak the
TScrollBox.HorzScrollBar.RangeandTScrollBox.VertScrollBar.Rangeproperties so they do not scroll far enough to see theTRadioGroup's right and bottom borders.
This way, the buttons appear as if they are part of the TGroupBox, but with the added scrollbar(s).

RadioGroup->Items->CountTRadioGroupcomponent doesn't have an embedded scrollbar, but you can put the radio group on aTScrollBoxfor a similar effect.You can use the
Buttonscollection to refer each button, e.g.RadioGroup->Buttons[0]->Height = 5; RadioGroup->Buttons[1]->Top = RadioGroup->Buttons[0]->Top + 10;Anyway a
TComboBoxcould also be a good choice.