Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Edit and no edit of fields
Message
De
23/06/1998 11:25:59
 
 
À
23/06/1998 10:52:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00110932
Message ID:
00110954
Vues:
34
Hi Ronald....

>I saw a trick on allowing a field to be edited or not edited by testing a user created property to see if it is .t. the field could not be edited if the user created property was .f. could some one please show me how this could be done. the field also did not change color as it does when the field is disabled. thanks for any help. ron

OK...This is one way to do it. There are others: Default the Enabled properties on each control to .F. In the Form I have a custom property called "Editing". It defaults to .F. When I want to edit, I change Form.Editing to .T. and do a Form.Refresh().

In the refresh event of each control (this works faster if you class the control and put the code in the class parent):

IF THISFORM.Editing
THIS.Enabled=.T.
ELSE
THIS.Enabled=.F.
ENDIF

OK? Each control changes it's state (Enabled or not) based upon the custom Editing property of the form. There are much cleaner ways to do this but this will get you started and it's the simplest.

As to not changing the color when disabled: Thats a matter of setting DisabledForeColor and DisabledBackColor to match ForeColor and BackColor properties.

Good luck!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform