Menu

#5 RadioButton cell

Evaluate
open
nobody
None
3
2006-11-15
2006-11-15
No

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.

Discussion

  • Davide Icardi

    Davide Icardi - 2006-11-15

    SourceGridRadioButtonCell.zip

     
  • Davide Icardi

    Davide Icardi - 2006-11-15

    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)
    {

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.