radio-buttonsplittertgridpaneldelphi-10.4.2

How in Delphi 10.4.2 show vertical separator lines in a TGridPanel that has a group of TRadioButton in its columns


enter image description here

I have a TGridPanel that has 6 columns (as an example). In each column there is a TRadiobutton. All five TradioButtons from a group. In this way the five TRadioButtons work as expected, and at the same time only one of them can be checked. To add vertical separator between columns, before adding the TRadioButtons, I have added four TPanels (in real code TStackPanel) and then I have inserted to each TPanels one TRadioButton, and then configured the panels's BevelEdges appropriately, to show the vertical lines. But now, as expected, each TRadioButton act separately, as their parents has changed from one unique TGridPanel to 5 separate TPanels.

Help me to have both vertical separators (in TGridPanel), and also make the TRadioButtons to act as a group.


Solution

  • You can do the following for each vertical separator:

    1. Add a column to GridPanel.ColumnCollection with Properties SizeStyle=ssAbsolute and Value=5 (column width in pixels).

    2. Insert a TPanel into this new column with Properties Align=alClient, Row=0, RowSpan=2, Color=clBtnShadow and BevelOuter=bvNone.