>As you had probably hoped, you CAN do this in VFP. You can do almost anything in this wonderful language and by god, this too is doable.
>
>Here is what you do:
>
>1. Create a custom class with the properties and methods you would like to have added to all your controls. We will call this your "Decorator" class.
>
>2. In each of your base control classes, add the following to your init event:
>
>this.addproperty("decorator", createobject("myDecorator"))
>
>3. In each of your base control classes, add the following method and call it THIS_ACCESS.
>
>PROCEDURE THIS_ACCESS
>Lparameters MemberName
>
>If !PEMSTATUS(this, m.MemberName, 5)
> Return this.decorator
>Endif
>
>Return this
>ENDPROC
>
>I hope this helps. You can now use the methods and properties as if they are part of the control class. If there is a conflicting member name (e.g. init) then the original control class method/property is used. You can change this behavior by using more IF PEMSTATUS statements in THIS_ACCESS.
I'm not sure I follow. Which classes are you describing in step 2? -- the VFP base classes (Textbox, Grid, etc.) or user-defined classes derived from them? You cannot modify the VFP base classes so I don't understand how you can make them inherit from a universal base class, as Matt asked.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only