Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing if an object has a property or method
Message
From
11/02/1999 19:28:57
 
 
To
11/02/1999 15:35:25
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00186691
Message ID:
00186866
Views:
19
>>Is there a simple way to test if an object has a property or a method? I could use amembers then check the array, but I was wondering if there is a VFP command that alread does this.
>
>Evan,
>
>llHasProperty = PEMSTATUS("cObjectName","cPEMName",5) is the normal way of testing for a property/event/method.
>
>Beware the traps, though. For example PEMSTATUS("cLablename","TabStop",5) where cLabel is derived from the label class will return true -- even though a label does not have an exposed tabstop property.
>
>Generally, PEMSTATUS() will tell you whether the object has a property, but does not tell you if it is actually available to use. It may be hidden, protected or out of scope.
>
>regards,

James,
You might want to look at the other options of PEMSTATUS, in particular PEMSTATUS("cObjectName", "cPEMName", 2) will return .T. if the property is protected.
I haven't relied on this function that much as I have heard that it is somewhat buggy, GPF prone, but I can't remember where I heard it.
Hopefully, someone else will chime in if I am mistaken on this point.
HTH,

Ned Ames
Ned

Reality is.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform