AndrewMozley
Programmer
There is a grid; the RecordSource is cursor tDetails. The user can navigate up and down, but he may only enter a value into Column6 (tdetail.tQty). This is handled by setting the enabled property for columns 1-5 to be False.
This works fine and as I navigate up and down the cell in Column 6 is highlighted (blue background).
I would now like to restrict the entry into Column 6 (the tQty field), so that entry is only allowed when the line item is still outstanding.
To do that, I first coded the grid’s AfterRowColChange() method to set the MyGrid.AllowCellSelection property. This worked up to a point, but the effect was that on an ineligible row, the whole row was highlighted, and this was not what I wanted.
I then coded the grid’s AfterRowColChange() method to set MyGrid.Column6.enabled property accordingly.
This also works up to a point, but I am finding that, when positioned on an eligible cell, the background is still white and I cannot enter a number. Only when I attempt to move out of the cell (with {LEFTARROW}) does the cell become highlighted and blue. So I have tried including KEYBOARD ’{LEFTARROW}’ and this is how I have left the code at present.
But if there is a better way of achieving the result, I would like to know.
Thanks. Andrew
This works fine and as I navigate up and down the cell in Column 6 is highlighted (blue background).
I would now like to restrict the entry into Column 6 (the tQty field), so that entry is only allowed when the line item is still outstanding.
To do that, I first coded the grid’s AfterRowColChange() method to set the MyGrid.AllowCellSelection property. This worked up to a point, but the effect was that on an ineligible row, the whole row was highlighted, and this was not what I wanted.
I then coded the grid’s AfterRowColChange() method to set MyGrid.Column6.enabled property accordingly.
This also works up to a point, but I am finding that, when positioned on an eligible cell, the background is still white and I cannot enter a number. Only when I attempt to move out of the cell (with {LEFTARROW}) does the cell become highlighted and blue. So I have tried including KEYBOARD ’{LEFTARROW}’ and this is how I have left the code at present.
Code:
LPARAMETERS nColIndex
*!* IF tDetail.tStatus = "C"
*!* This.AllowCellSelection = .F.
*!* ELSE
*!* This.AllowCellSelection = .T.
*!* ENDIF
IF tDetail.tStatus = "C"
This.Column6.enabled = .F.
ELSE
This.Column6.enabled = .T.
KEYBOARD '{LEFTARROW}'
ENDIF
But if there is a better way of achieving the result, I would like to know.
Thanks. Andrew