Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quickest way to copy several methods from one class
Message
 
 
To
18/05/2007 11:50:00
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01226347
Message ID:
01226818
Views:
33
>>>Hi Naomi,
>>>
>>>The control baseclass or the container would be candidates for such a behavior class, then put any control in it. Of course sounds simpler as it is.
>>>
>>>Bye, Olaf.
>>
>>I usually use custom class (or line) for functional objects. Don't remember ever using Control class.
>>
>>With the idea of container, do you mean you can have container based class for grid column's object? But if this is the case, perhaps, we can subclass Column class and add incremental search to the column class instead? I haven't thought of this.
>>
>>My particular problem is already resolved, but I'd like to learn all possible approaches here.
>>
>>Thanks again.
>
>I just thought it would be nice to have a base control having the functionality but not being a textbox or editbox, just a control, to programm the universal case and subclass it being special controls. The control base class is like that.
>
>I tried and Visually defined the following class (create class supresskeys as control in yourvcx.vcx, then add init and keypress code)
>
>
define class supresskeys as control
>   procedure init()
>      Bindevent(this.ocontrol,"keypress",this,"keypress")
>   endif
>   procedure keypress()
>      LPARAMETERS nKeyCode, nShiftAltCtrl
>      nodefault
>   endproc
>enddefine
>
>Then I put in a textbox and named it oControl. There would be a lot more to it, than just binding keypress, but what I found out - and have already dealt with that same problem earlier - the bindevent does not work, you need to make it from oControl.Init() and bind this to this.parent there, so you'd need code in any control you put inside as oControl, which makes that solution useless.
>
>Better forget about that suggestion, it makes more trouble than it solves.
>
>Bye, Olaf.

I see, thanks. Please check the whole thread and take a closer look at Gary's idea. It's different than control subclassing, it's passing functionality from base class to external behavior object. If we need a different behavior, we would not need to change our classes, only one external class. Or we can even use different behavior objects depending on behavior we want if we made it as property of our textbox/editbox/etc. classes.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform