Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How filling a property with an objectreference at design
Message
 
 
À
18/12/1998 11:12:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00168392
Message ID:
00168940
Vues:
25
Cetin,

You are quite right. This behavior has changed at some point between VFP3 and now. VFP5a and VFP6 both seem to be putting in objects accessible via this.parent so that they are all visible during the Init() of each contained control. The property values the objects contain are as assigned on the property sheet.

I just hacked this code out in the Init() of 5 textboxes:

this.parent.WhoIsHere( this )
local i, lcName

this.Left = this.Left + 100

for i = 1 to 5
lcName = "this.parent.text" + padl( i, 1 )
loObject = eval( lcName )
debugout lcName + " " + type( (lcName) ) + str( loObject.Top ) + str( loObject.Left )
endfor

and the Form.WhoIsHere():

lparameter roWho

debugout "From " + roWho.Name
for each loControl in this.Controls
debugout loControl.Name
endfor


I expected that WhoIsHere would print longer lists as each object, but they were all there from the first call to it. I added the code then to check the properties and it showed that until the object itself Inits what the other ojbects see are the proper sheet values.

This is a rather nice addition. There are still some potential instantiation order issues if code in the Init() affects things, but it's not nearly as bad a problem as it used to be.

Thanks for pointing this out!

>For a similar situation I also thought order of instantiation should be a problem and sought a way to be sure my custom object was the one last inited (just before form). To my surprise it was not the case. Whenever it instantiates (first or last) it had access to all form objects :) Here is a very simplified version of its custom method :
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