Select table row with checkBox

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Select table row with checkBox

Post by wjstarck » Tue Feb 24, 2015 8:43 pm

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?
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Select table row with checkBox

Post by jsalmon » Wed Feb 25, 2015 7:04 am

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().
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Select table row with checkBox

Post by wjstarck » Wed Feb 25, 2015 7:08 am

OK. Cool.

Thanks Jason
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Select table row with checkBox

Post by wjstarck » Thu Mar 12, 2015 10:37 pm

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?
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Select table row with checkBox

Post by jsalmon » Fri Mar 13, 2015 9:07 am

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.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

User avatar
wjstarck
Posts: 935
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Select table row with checkBox

Post by wjstarck » Fri Mar 13, 2015 9:53 am

Great that helps thanks as always Jason.
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

Post Reply