Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set everything on form as readonly
Message
From
07/12/2005 06:43:53
 
 
To
06/12/2005 11:56:49
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01075376
Message ID:
01075645
Views:
17
for security purpose when certain group of users log in, i want to set everything on all forms as readonly.

I agree with Alex that the proper way to do this is to make each control responsible for its own state in response to a change of condition on the form.

i am thinking of creating a custom class and put it on the form. now in the init of this class, i will loops through each and every control on th form and mark them as readonly or enable=.f. . the code has to be recursive so that if there is a pageframe or container object on form , it goes and loops through all objects on pageframe/container too.

Although a recursive algorithm is not really suitable for what you want to do here, it is handy to have one available, so here it is:
LPARAMETERS toObject
LOCAL loObject

*** If we have a container, drill down
IF INLIST( LOWER( ALLTRIM( toObject.BaseClass ) ), ;
  [form], [pageframe], [page], [container], [grid], [column] )
  FOR EACH loObject IN toObject.Objects
    Thisform.DrillDown( loObject )
  ENDFOR
ELSE
  *** Do whatever you want to do with the control
  *** It is not a container
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform