>I have a grid control that I want to disable when the user is editing a record. I also want the grid to have a list box field, without the ability to select a cell. When I set the AllowCellSelection to False, the user can still change the row of the grid when the grid Enable is set to .F. When AllowCellSelection is set to True, disabling the grid works fine, and doesn't allow the user to change the row. I tried numerous things via the Before and After row change methods but cant seem to get what I want. Any ideas would be appreciated.
>
Peter,
In VFP9 setting the AllowCellSelection to False and the grid Enabled to False disables rows changing. In VFP8 you can put transparent shape over the grid to achive the same. Something like
IF NOT Thisform.grid1.AllowCellSelection
Thisform.grid1.Enabled = .F.
Thisform.AddObject("oShape", "Shape")
Thisform.oShape.Top = Thisform.grid1.Top
Thisform.oShape.Left = Thisform.grid1.Left
Thisform.oShape.Width = Thisform.grid1.Width
Thisform.oShape.Height = Thisform.grid1.Height
Thisform.oShape.Zorder(0)
Thisform.oShape.Visible = .T.
Thisform.oShape.BackStyle = 0
Thisform.oShape.BorderStyle = 0
ELSE
Thisform.grid1.Enabled = .T.
Thisform.RemoveObject("oShape")
ENDIF
--sb--