Page 1 of 1

Select table row with checkBox

Posted: Tue Feb 24, 2015 8:43 pm
by wjstarck
I want to be able to select a row(s) in a table by having a checkBox in the first column of a table, similar to DataGridViewCheckBoxColumn for DataGrids. But the equivalent is not available in ODGridColumn, so no way to achieve this in OD (at least not with ODGrids), right?

Re: Select table row with checkBox

Posted: Wed Feb 25, 2015 7:04 am
by jsalmon
An example of how you can manually do such a thing is in FormSheetImport.cs The real magic of it all is in gridMain_CellClick() and the FillGrid().

Re: Select table row with checkBox

Posted: Wed Feb 25, 2015 7:08 am
by wjstarck
OK. Cool.

Thanks Jason

Re: Select table row with checkBox

Posted: Thu Mar 12, 2015 10:37 pm
by wjstarck
Well, I tried to do what you suggested, but either my question was not clear enough or I what I want can't be done with OD grids because I could not figure out a way to get checkboxes to appear in the first row of an OGrid to select a row from your explanation. I think what you're doing is different from what I want.

So I resorted to Windows DataGrids, but as they they say of Jake from State Farm "She looks hideous"

Image

Is there any way to duplicate what I've done in an ODGrid?

Re: Select table row with checkBox

Posted: Fri Mar 13, 2015 9:07 am
by jsalmon
wjstarck wrote:Is there any way to duplicate what I've done in an ODGrid?
Not currently. You would have to add a lot of functionality to the ODGrid to get a physical check box in the grid. Let me rephrase that, it would be EASY to get the check box in the grid, it would be HARD to associate the check box to the object (or simply the row). We have a text box (procedure code window, fee column) that you can look at for inspiration if your heart is set on having the physical check box within the grid.

Otherwise, the example I mentioned above makes a simple cell act like a check box (listens for click events inside a specific cell) and simply displays an 'X' when checked or blanks the cell out when not "checked". Then at the end, on OK click or something, it loops through all rows and takes action on any row (or object if using row.Tag) that has the 'X' present.

Re: Select table row with checkBox

Posted: Fri Mar 13, 2015 9:53 am
by wjstarck
Great that helps thanks as always Jason.