CurrentControl, DynamicCurrentControl, Sparse
These properties (together with the actual objects in the column) determine what control you see in any particular grid cell. If a column has more than one control specified, CurrentControl indicates which should appear, unless DynamicCurrentControl has a value. In that case, the expression specified for DynamicCurrentControl determines which control shows up. Sparse specifies whether the current control (whichever property determines it) appears all the time in every row for that column or only when that cell has focus.
Usage |
grcColumn.CurrentControl = cControl cControl = grcColumn.CurrentControl grcColumn.DynamicCurrentControl = cExpr cExpr = grcColumn.DynamicCurrentControl |
Example |
* Say a particular column has a ControlSource of nFld. You can * put a text box and a spinner in the column and show the user * the text box for odd values and the spinner for even values. * Why? Why not? ThisForm.grdMyGrid.grcNFld.DynamicCurrentControl= ; "IIF(MOD(nfld,2)=0,'spnNFld','txtNFld')" * If, on the other hand, we'd just like to have the user see the * spinner every time: ThisForm.grdMyGrid.grcNFld.CurrentControl = "spnNFld" |
Usage |
grcColumn.Sparse = lHideControl lHideControl = grcColumn.Sparse |
When CurrentControl for a cell is a check box bound to a logical field and Sparse is .T., nothing at all shows when the cell doesn't have focus. It's empty. Since check boxes aren't too ugly, your best bet is probably to set Sparse .F. for those columns. |
Example |
* In the same grid as above, here's the DynamicCurrentControl * expression to use the spinner when the cell has focus and the * text box the rest of the time: IIF(ThisForm.grdMyGrid.ActiveColumn = ; ThisForm.grdMyGrid.grcNFld.ColumnOrder AND ; ThisForm.grdMyGrid.ActiveRow = RECNO(),"spnNFld","txtNFld") * And, of course, we'll need: ThisForm.grdMyGrid.grcNFld.Sparse = .F. |