Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to manage controls init processes?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01096110
Message ID:
01096664
Vues:
11
Hi Giedrius,

>I need that custom object Init method would run first of all. How to do it?

Mike provided a solution for you immediate problem. However, the underlying problem is a design issue.

In the Init event, the only objects that are available are the object itself and all contained objects. Any reference to THIS.PARENT or THISFORM should best be avoided. Sometimes it works, because the object is there, but often it doesn't work and finally leads to crashes. The reason for that is that VFP creates objects beginning with the innermost object. All other references on the form either do not yet exist or are class objects. Class objects are blue prints for object instances that are maintained in memory like real objects but should be accessed by VFP itself. In the current versions of VFP you get an error message when you attempt to store a reference to a class object somewhere, in older versions you can cause dangling references with them.

Instead you should move the code that depends on external objects into a separate procedure. Then call this procedure when you know that all objects are initialized. A good place for that is the form's Init event.
--
Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform