Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Explorer like for
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00181210
Message ID:
00181620
Vues:
7
Philippe,

You could visually design the container and AddObject() it the first time you need it. Another way would be to use a custom property like mcControlSource, to hold the what the control should be bound to and use that property to set the ControlSource, but if you do that at Init() time the control source needs to be available anyway so you may as well do a container class. There is the potential problem of classes inside the container should you want to sublcass the container.

>I'm creating an explorer like form. I use for this a treeview. When I NODECLICK on it, a specific container according to the clicked node is instantiated or added, as the right pane of the explorer. The name of this specific container is stored in the treeview.nodes(i).Tag: on NODECLICK, add this container to the form in the classic way, and I pass a reference to the node to the container to create(the container will read the node.key to read in it some informations relative to the wanted record, such as the Id):
>
>METHOD NodeClick()
>LPARA oNode
>myctrClass = oNode.Tag
>Thisform.newObject(myctrClass,myctrClass,,,oNode))
>
>Within the container, there are some controls, bound to a cursor, which is QUERYed also according to the clicked node.
>
>Problem:
>The cursor is QUERYed in the container INIT method: but the contained controls are instantiated before the container Init: so, they cannot find the data they're bound to, and the container doesn't instantiate.
>
>I cannot add to the container an object that would do the job before instantiating the other controls, because it wouldn't receive the 'oNode'parameter: Only myctrClass.Init() receives it and it's too late.
>
>I think of 2 solutions:
>1- BINDing the controls to their CONTROLSOURCE after the Init Event of the container, but it seems heavy.
>2- INSTANTIATing a 'pilot' class, such as a custom control,instead of the container directly, from the TreeView Nodeclick event, this pilot class being in charge of QUERYing the cursor, then of Instantiating the container when it's done. But this supposes to create one pilot plass per kind of container. It makes a lot of classes, and I don't find thet system very smart, even if it is in OOP philosophia.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform