Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Does form exists?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00394154
Message ID:
00394298
Vues:
20
>>>>Hi, all! Please answer which function can determinate does object (in my sample form) exists or not. Thank you. Andrew
>>>
>>>If you're checking on a object in a form, use the PEMSTATUS() function. If you want to know if a form exists, you can check the _SCREEN.FORMS collection.
>>
>>Also you can check if
>>
>>TYPE("thisform.myobject")= "O"
>>
>>and check for !ISNULL(thisform.myobject)
>
>I can see the need to check ISNULL() for an object variable pointing to an object that may have been destroyed. But how would THISFORM.myobject become .NULL. if it existed?

It may look excessive, and probably it is, but truly speaking thisform.myobject syntax by mistake may point to the form property which contained the object reference and was reset to .NULL.
Theoretical scenario: It is possible to remove the form object, then add the property with the same name, assign object to it and reset property to .NULL.

Now you have

TYPE("_screen.activeform.text1") = "O"
and _screen.activeform.text1 equals to .NULL.

Voila! :)

Oh, well, that may be an overkill... :)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform