Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Relative Control Referencing
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00103404
Message ID:
00103447
Vues:
18
Hi Bill,

You are going through a lot of unneccessary work here. With regard to a relative reference, one does not exist. You either have a reference to an object or you do not. The relative part comes from how you choose to negotiate the levels of containership. Your best bet is to call your method like this:

With ThisForm
.BuildNode(.pageframe1.page3.cttree)
EndWith

This is the great thing about objects. You can access them directly, or you can use relative referencing.FWIW, I find relative referencing best when I am inside the container. For example. if I am in Page 4 and I need to reference something in Page 3. In that case, I would do something like:

This.Parent.Parent.Page3 && and I have a reference to page 3

Why do I do this? Because if I ever decide to mode my pageframe to another container, the code does not break. If you always go from the form and burrow down the containership hierachy, your code will have to continually change to reflect the new containership hierachy.

Hmmmm... Perhaps my solution is not best after all. Of course it isn't because of the previous paragraph.

If the buildtree method operates on the treeview, then your BEST BET is to create a subclass of the Treeview control and add a BuildTree Method to that subclass - along with the code. If it accepts parameters, don't forgot those as well. This is really a design issue - but it is one that I think you may like.

So, our call could be reduced to:


Thisform.pageframe1.page3.cttree.BuildNode()


Well, we are still assuming things about the containerhip here. At this point, this may be OK - unless of course throughout the form, the code is peppered with the call to buildnode. In that case, I would probably opt for a custom member of the form that points to Thisform.pageframe1.page3.cttree - and that would get set in the Init() of the form. Now, if the containership changes, I only have one like of code that has to change.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform