Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checkbox in grid
Message
 
À
01/07/1997 09:27:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00038226
Message ID:
00038308
Vues:
31
> 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. As previously asked, why not just a checkbox all the time? If the contents of the field are more appripriate in a textbox, then you might want to use a textbox all the time instead and trap the Click and KeyPress events of it, to control the presence of the "X". To simplify everything, though, you may want to set the Sparse property to be .T. /Paul
Paul Russell
EMail: prussell@fox.nstn.ca
Phone: (902) 499-5043
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform