I have a grid on a form with a column based on a logical field in a table. The column has the standard textbox plus a check box in it. The CurrentControl for the column is set to the check box. The ControlSource for the column is set to a UDF which will return "X" if the field is .T. and " " if .F. for the text box to display when the cell is not the active grid cell. The ControlSource for the check box is set to the logical field in the table. Sparse is set to .T., Bound for the column is set to .F..
In the init of the grid the DynamicCurrentControl of the column is set as follows:
THIS.COLUMN2.DYNAMICCURRENTCONTROL = "IIF( ( THIS.ACTIVECOLUMN = 2 AND RECNO() = THISFORM.LastRow ), 'Check1', 'TEXT1' )"
THISFORM.LastRow is updated in the AfterRowColChange event of the grid.
The effect I'm trying to get, of course, is when the cell is the active cell, the user sees the check box, otherwise the user sees the text box with an "X" or " " reflecting the logical contents of the field.
This works well except for one problem, if the user tabs into the cell while on the same record, the check box displays correcly. But if the user moves into the cell from another record, the check box does not display and the field is always blank even if the field is .T.. If the user then tabs out of the field and back in while remaining on the same record, the check box correctly displays.
What am I missing? This is in VFP5.0a.
Thanks, BillWilliam A. Caton III Software Engineer 2020 Company Atlanta, Ga.
|