Board index » delphi » Help: How to link TDBCheckBox in TDBCtrlGrids to act as RadioGroup

Help: How to link TDBCheckBox in TDBCtrlGrids to act as RadioGroup

I use a TDBCtrlGrid to Enter/Edit/Display a persons different addresses. The
Grid has a TDBCheckBox, used to indicate the "Active" address. What I would
want to achieve is to "link" the CheckBoxes in all rows so that they work
like TDBRadioGroup. Checking one would automatically uncheck all the other
records, so there can only be one "Active" address. Anybody know how to do
this? Any help appreciated.

Kai (MarSoft)

 

Re:Help: How to link TDBCheckBox in TDBCtrlGrids to act as RadioGroup


Perhaps you can write an OnClick event handler for the checkbox which scans
the table and sets the value of the field to False for all other records.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:Help: How to link TDBCheckBox in TDBCtrlGrids to act as RadioGroup


Quote
>I use a TDBCtrlGrid to Enter/Edit/Display a persons different addresses. The
>Grid has a TDBCheckBox, used to indicate the "Active" address. What I would
>want to achieve is to "link" the CheckBoxes in all rows so that they work
>like TDBRadioGroup. Checking one would automatically uncheck all the other
>records, so there can only be one "Active" address. Anybody know how to do
>this? Any help appreciated.

Try using a second table to access the other records.  Use SetRange to restrict
the second table to the master linking key then itterate through the table
change the value of the field the check box uses to the unchecked value in  any
record except the current record.  Call refresh on the first table to make sure
it updates.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Help: How to link TDBCheckBox in TDBCtrlGrids to act as RadioGroup


Thanks Brian,

I'd plain forgotten that I have to use a separate TTable. Now it works as I
intended it to.

Kai (MarSoft)

Other Threads