In the attached file you can see a sample implementation of a Radio Button cell.
Thanks very much to Steve Driessens for the code!
Steve Driessens
Resort Software Pty. Ltd.
http://www.resortsoftware.com
Some note:
There are two (VS2005) projects in the attached zip file.
- SourceGrid.RadioButtonCell is a C# assembly that implements the radio
button grid cell.
- SourceGrid.RadioButtonCell.TestApp is a C# test application that shows
how to use the radio button cell.
Basically, all I have done is copied your source code for the CheckBox cell
to the classes
for the RadioButton cell and added a new controller class called
RadioButtonGroupController.
It's this controller class that makes sure that only one radio button cell
in a group is ever checked.
Comments in the main form class in the test app shows how to implement the
radio button cells, but
basically all you need to do is construct a RadioButtonGroupController and
assign it to each radio
button cell in a group.
SourceGridRadioButtonCell.zip
Logged In: YES
user_id=1515232
Originator: YES
Fix for the previous code:
In the UIChangeChecked member of the
SourceGrid.Cells.Controllers.RadioButton class,
insert the following code
// If this button is already checked we retain it's checked status as it
// can only lose it's checked staus if another button has been checked.
if (checkStatus.Checked)
return;
Between these existing lines of code:-
Models.RadioButtonStatus checkStatus =
l_Check.GetRadioButtonStatus(sender);
--> Insert code here!
if (checkStatus.CheckEnable)
{