Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Edit and no edit of fields
Message
From
23/06/1998 11:25:59
 
 
To
23/06/1998 10:52:37
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00110932
Message ID:
00110954
Views:
33
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform