Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making fields readonly thru loop construct
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00349474
Message ID:
00349486
Views:
25
>Is there a way to make all the fields on a screen readonly thru loop construct rather naming each field and then setting its readonly properties (for example: x.readonly = .t., y.readonly = .t. etc...)
>
for each oControl in THISFORM.Controls
   if pemstatus(oControl,"ReadOnly",5) then
      oControl.ReadOnly = .T.
   endif
endfor
This is very easy for me because in my container classes (e.g. forms, option groups, containers), I have code in a ReadOnly_Assign method that if the ReadOnly property of the container is being set to .T., then it propagates that to its members. Otherwise, you have to check for the existence of the Controls or Buttons property and go through these.

*Note*
For those classes that are are containers and don't have a ReadOnly property, I added a custom property with that name.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform