Hi!
Variable should be private. You cannot do this using parameters in the Init. Because object when loaded binds method code during object loading *before* Init, object reference should be assigned to object's property just when loading object. You can use function there or "&MyVar" to use different objects to hook.
The approach is described first time by Fred Taylor in Thread #
503869 Message #
503953. I experimented with it more and figured out that it limited to VFP native objects only, and cannot define the _Assign/_Access methods (exactly: it can define, but they will not be called by VFP when appropriate; existing _Assign/_Access methods could be used to alter code).
>Vlad,
>
>I don't understand your example. How does the oHook object that you add via Addobject() make the 'link' with your loMyObject textbox? Does your technique depend on loMyObject being a private vs. local variable? Why not pass the object reference loMyObject to an Init method in MyClass via another parm in your AddObject() call?
>
>I understand your code was an example only so I am not being critical of your code. I'm just trying to understand your technique.
>
>Thanks!
>Malcolm
>
>
>set procedure to MyHooks.PRG
>loMyObject = thisform.TextBox1
>thisform.AddObject("oHook","MyClass")
>
>* MyHooks.PRG:
>DEFINE CLASS MyClass AS Custom
>oMyObject = loMyObject
>procedure oMyObject.Valid
>= messagebox("Something")
>endproc
>ENDDEFINE
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.