tspeich
2017-08-02T16:18:12Z
I have a grid with several columns that re check boxes. Currently the user can select an area of the cell outside the check box and enter text. I need to be able to prevent this form happening.
I have been playing with the various events that are triggered, RequestEdit, DblClick etc and have had no success in preventing this from happening yet.

Any suggestions would be greatly appreciated.
we are currently using the 5.0 version of iGrid.
Igor/10Tec
2017-08-03T14:46:58Z
The RequestEdit event controls only the "traditional" text editing, and the check box state change is not a part of this process. Setting bCancel to True in RequestEdit should be enough to disable only the text editing in a cell containing check box:

Private Sub iGrid1_RequestEdit(ByVal lRow As Long, ByVal lCol As Long, ByVal lCharCode As Long, bCancel As Boolean, sText As String, lMaxLength As Long, eTextEditOpt As iGrid650_10Tec.ETextEditFlags)

   bCancel = True

End Sub

This works because - at least, in the v6.5 of iGrid OCX.

BTW, you can enable/disable cell check box state change with the CellCheckChange event.
tspeich
2017-08-03T20:55:14Z
ReqEditCancelCode.jpg

Click to View Image42 View(s)

CheckwText.jpg

Click to View Image37 View(s)



That was what I tried the first time, long before creating the post.
The attachments show my code and the resulting behavior in the iGrid.

for the time being I am using the AfterCommitEdit event to set the cell value back to an empty string.
Igor/10Tec
2017-08-04T11:05:50Z
There should be no difference in the behavior for iGrid 5.0. Just in case, I have just checked this. All works as expected.

Can it be a problem of your specific development environment? For instance, I do not see parameter types and the ByVal/ByRef modifiers in the parameter list of your RequestEdit handler. The bCancel parameter must be passed ByRef and its type must be Boolean. Perhaps, you dev env "thinks" its a Variant parameter and/or it is passed by value.

Try to reproduce the problem with your version of iGrid in another VB-runtime based environment - say, in MS Office Excel VBA.