I have a virtual data grid (I''m not sure if the virtualness makes a difference -- basically it''s not a databound grid) and one of the columns has a checkbox style.
If I click the mouse in the cell but not on the actual checkbox control everything is fine -- the check status toggles just fine (as long as I ConfirmChanges() on the current cell).
However, if I click on the actual checkbox control then I get strange behavior. Sometimes the right thing happens, but other times the previously active cell gets toggled. I also see the following two messages appear in the console window:
catched at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) in :line 0
catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0
Exactly what control are you using, a GridDataBoundGrid or a GridControl?
The default checkbox behavior is not to toggle the check box value unless you click on the checkbox itself. You can see this in the Grid\Samples\Quick Start\CellTypes sample that we ship. Are you doing something to try to change the check value if you just click on the cell as opposed to clicking on the checkbox? If so, if you remove this code do things work better?
TWThomas W. BrownSeptember 3, 2004 01:51 PM UTC
>Exactly what control are you using, a
>GridDataBoundGrid or a GridControl?
GridControl -- although I am displaying ADO.NET based DataTables, they are quite large and the time it takes to bind to a GridDataBoundGrid is unacceptable so I''m implementing a virtual data grid.
>The default checkbox behavior is not to toggle
>the check box value unless you click on the
>checkbox itself. You can see this in the
>Grid\Samples\Quick Start\CellTypes sample that
>we ship. Are you doing something to try to
>change the check value if you just click on the
>cell as opposed to clicking on the checkbox? If
>so, if you remove this code do things work
In QueryCellInfo I set the CellType to "CheckBox" for boolean typed fields.
If I do nothing else then I never get the checkbox to toggle on a click, no matter what. So I override OnMouseUp and, if the current cell type is "CheckBox" I make sure the cell is active, in edit mode, and I go ahead and toggle the cell. Again, this works well for clicks in the cell but not on the checkbox control itself.
So, no, removing the special handling I have to toggle on a cell click does *not* improve things it actually makes things worse.
Perhaps I''m missing something here because of the virtual nature of my data grid? Do I have to bind the checkbox control to something?
AdministratorSeptember 3, 2004 02:09 PM UTC
Here is a little sample that virtually binds a DataTable with a checkbox column to a GridControl. The main things is to make sure the CheckBoxOptions get set to match what is in your datatable. Otherwise, the cell does not know how to display/change the checkbox.