Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to disable all controls with TAG property = 'X'
Message
From
16/05/2002 15:12:05
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
16/05/2002 14:18:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00657662
Message ID:
00657707
Views:
29
>I'd like to disable all controls in a form if its tag property = 'X'. Is there an easy way to do this? Thank you all!

You can write a method (I've named it RecurseForTagX here) which would take a container object (form, pageframe etc) as a parameter and call it recursively:
lParam toObj
do case
  case pemstatus(toObj,"Tag",5) and toObj.Tag="X"
{do what you need with it}
  case inlist(toObj.Class,"Pageframe","Page","Grid", ;
      "Commandgroup","Optiongroup","Form","Toolbar", "Container")
   for each loObj in toObj.controls
     this.RecurseForTagX(loObj)
   endfor
endcase
If you're using VFP6, then you'd have to have the second case broken down for button groups (which didn't have .controls, but only .buttons back then), pageframes (.pages), grids (.columns), and I think the rest would go as having .controls collection.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform