Howto include Checkboxes

Sep 4, 2007 at 1:49 PM
Hi,
I was always looking for such a control and this one would almost meets al my requirements, except checkboxes.
How can I include checkboxes to select some of the Items?

Regards
Ben
Coordinator
Sep 4, 2007 at 8:54 PM

BenW wrote:
Hi,
I was always looking for such a control and this one would almost meets al my requirements, except checkboxes.
How can I include checkboxes to select some of the Items?

Regards
Ben


Well the Superlist doesn't currently support checkboxes, that's not to say it couldn't. How you'd go about implementing it depends on your requirements. If you we're willing to forgo keyboard cell navigation other than say space bar checking / unchecking of the checkbox on a row then it would be relatively simple to implement. You would need to override the SectionFactory and for a column that has the checkbox you'd need to return a SectionCell derived CheckBoxSectionCell. Of course you would need to implement a CheckBoxSectionCell class , that would need to draw the checkbox; you could either role with your own painting or call DrawFrameControl .

HTH
Lee
Sep 20, 2007 at 7:48 AM
Hi Lee,

first of all I want to thank you for this wonderful control.

I read this discussion started by Ben an implemented a new section class "CheckboxCellSection" to show the checkboxes and this works pretty good by now. But I have two major problems:
1.) I can check/uncheck the group items, but if I collapse and expand the group all checkbox states will be reset to "Unchecked". This is, I think, because the cell sections of a collapsed groups will be removed from the control and will be added again while expanding the group. So I think I have to save the checkbox state to the internal item list, but I don't know how. Any suggestions?
2.) I added a checkbox to the group section also, to check/uncheck all items of a group with one click. This checkbox should go to the "Mixed" state if the user manually check/uncheck some items of the group. So I need a function to count the checked and unchecked items of a group. I think this problem can be solved easily if problem 1.) is solved.

By the way: I removed all the DLL calls to GDI and so on from the project, so that your control works with .Net methods completely now.

Regards
Michael
Coordinator
Sep 26, 2007 at 4:55 PM
Hi Michael,

Glad you liked the control :-)

There were reasons that GDI was used in preference to GDI. Under GDI there were issues with "dancing characters" / odd looking word issues when sizing the columns caused by grid fitting etc... However I understand for some people they don't really care about this, so when I get time (or if someone is willing to do it I want to create drawing policies so you can choose which method you want.

Cheers
Lee
Sep 27, 2007 at 6:37 AM
Hi Lee,

right now it looks pretty good without calling the GDI routines, but I keep your answer in mind, when I maybe stumble into some displaying problems in the future.

Any ideas about how to store the checkbox values while collapsing a group?

Regards
Michael
Coordinator
Sep 27, 2007 at 9:12 AM
Hi Michael,

I'd store them with the row you added. The row should contain state, so if your adding a Person object for example then maybe you need to create an intermediate object for the row which contains the Person plus the checkbox state.

Cheers
Lee