Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How filling a property with an objectreference at design
Message
De
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:
00168875
Vues:
23
Hidy David,
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 :
* Custom Listcontrols
lparameters toContainer
for each oControl in toContainer.controls
  ? sys(1272,oControl)
  if oControl.baseclass = "Container" && For simplicity just container type here
     this.listcontrols(oControl)
  endif
endfor
It never mattered when my custom object inited and :
* Custom object init
activate screen
this.Listcontrols
printed out all form objects down to do innermost container.
In this regard I think eval(this.boundobj) would work. Even BoundObj could be released (init returned .f. maybe), but still it would work (would be .NULL. as expected so still provides the obj referencing).
Of course BoundObj related with addobject, removeobject occuring in code are out of scope.
Cetin
>Thomas,
>
>Let me ask what you are trying to achieve, we may be able to offer other ideas.
>
>You can run into problems with instantiation order here, if the TextBox doesn't exist before the Label.Init() occurs and you attempt to eval(this.BoundObj). You should put the code in a custom method that gets called from the container Init. By that point in time you are assured that both the label and the textbox will exist.
>
>Another approach you can use is to make the label smart enough to find the other control with the same name. Assuming VFP5-6 which creates decent names when you drag/drop fields you can just have a custom method FindMyControl() that searches for another object using substr( this.parent.controls[].Name, 4 )
>
>Another option would be to group these label and the textbox in their own container, but this carries it's own set of problems when trying to subclass.
>
>>I've created a property for my subclassed label thats called 'boundto'. This property shall reference to a textbox. However I don't know how to insert an object-reference into this property at designtime. Is this possible at all or do I have to continue with using macro-substitution?
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform