Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing objects
Message
From
05/01/1998 11:52:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00069346
Message ID:
00069543
Views:
50
>How does one find which objects within a form which have certain properties?
>For example If I wish to write a generic routine changing all disabled properties from .f. to .t.
>
>for a = 1 to (what function)
> if (what array?).disabled = .f.
> (what array).disabled = .t.
> endif
> a = a + 1
>endfor
>
>How do I reference objects withn a form generically?
>Thanks for your help
>Spencer Fried
>sfried3@ix.netcom.com

You would recursively check controls (and containers' controls) and if they have disabled property defined and !readonly, protected etc would make them true. Sounds easy ? Well I'll try to write one to do job (since we are gonna deal only with enabled property no need to check for readonly, protected) :
* Custom Method SetallEnabled2Disabled (as far as I know property enabled exists for all type of objects but not disabled)

Function SetallEnabled2Disabled
lparameters oContainer
with oContainer
for ix=1 to .controlcount
    .controls(ix).enabled = .f.
    if .controls(ix).baseclass = "Container"
       =SetAllEnabled2Disabled(.controls(ix))
    endif
endfor
I think this would set everything to disabled but haven't tried, wrote here. I would call it SetallEnabled2Disabled(thisform) then immediately set a control to enabled for a safeguard.
cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform