Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do we check for the existence of an object?
Message
From
15/07/1999 21:51:26
 
 
To
13/07/1999 15:39:15
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00240965
Message ID:
00242116
Views:
23
>If a grid doesn't already exist on a form, I want to add it along the lines of:
>
>if not (object_exist())
> addobject(mygrid)
>endif
>
>how do we do it in vfp?
>
>Thanks
>
>Harry




For me, I used PemStatus() instead of Type()

I agree that Type(...) = "O" is confident sure that it is a object,
whereas PemStatus() only detect if the property, procedure, object name exist!!

e.g.
* Suppose there is a "Button Form" do as menu to show other forms..

IF !PemStatus(ThisFormSet, "FrmABC1", 5)
    Thisformset.Addobject("FrmABC1", "FrmABC")
ENDIF

Thisformset.FrmABC1.visible = .T.  && Line 5
Thisformset.FrmABC1.Zorder(1)

* At this point, the post-condition will sure Thisformset.FrmABC1 will
* show and put the top of forms order!
* If prompt error because FrmABC1 not exit at Line 5
* Use Event handlier to capture the First Destroy() just behind Init()



Sometimes, pre-condition, post-condition is very good logical method to
decision on design!! ^_~
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform