>Hi folks:
>
>I am trying to control user-access to a combo-box in a grid.
>
>I have a grid with a column "COMPANY". It contains a Combo-Box, since there are only a few Companies allowed in this field. The field may or may not be filled. There is also an ADD button on the form, so the row may be brand new. The whole form has a SAVE button (it does a TableUpdate()) and an UNDO button (it does a TableRevert()).
>
>Once the User has filled this field and saved it, I want to prevent them from changing it.
>
>I tried testing for the value in the datafile ( if len(trim(GRIDDATA.Company))>0 ) in the Grid1.Column1.Combo1.GotFocus()and setting the combo-box's ENABLED property, but once a field is DISABLED I cannot ENABLE it again.
>
>I also tried doing the same test in the Combo-Box's WHEN method (Return .T. or .F. to control access), but thisseems to only get run the first time the grid is CLICKed. When I click on what should be an editable row, the debugger suggests that it fires the WHEN for the first row and THEN fires the WHEN for the CLICKed row. But it seems to ignore the second WHEN.
>
>
>Can you set access to a field in a grid on a row-by-row basis? If so, how?
>
>Thomas Hirschman
Thomas,
You can't re-enable the combo box because once it's disabled you can't get to the GotFocus() event. I'd use empty(...) rather than len(trim(...))=0, just because it's simpler code, easier to debug.
Finally, I've done similar things using WHEN, I think in the combo box.
Barbara