On Wed, 19 May 2010, Derrell Lipman wrote:
> On Wed, May 19, 2010 at 14:19, Fritz Zaucker <[email protected]> wrote:
>
>> On Wed, 19 May 2010, Derrell Lipman wrote:
>>
>>> On Wed, May 19, 2010 at 14:00, Fritz Zaucker <[email protected]> wrote:
>>>
>>>> P.S.: I don't understand mixin's well enough, so this might be a silly
>>>> question: if I use it in my application, then the method is added
>>>> to every object in my application? Or could a mixin just have a
>>>> "local" effect on the objects of a specific class (e.g., only in
>>>> those classes, where I have a need for bind())?
>>>
>>> A mixin has an effect on every object of the class to which it is "mixed
>>> in", including every object which descends from that class. Since nearly
>>> every class in qooxdoo descends from qx.core.Object, any methods mixed
>>> in to qx.core.Object are included in nearly every qooxdoo object. That's
>>> why Fabian's point has merit.
>>
>> That I understand. What I am wondering is, if I could in own of my own
>> class files (e.g. extending qx.ui.toolbar.Toolbar) instead of
>>
>> qx.Class.include(qx.core.Object, custom.MObject);
>>
>> use
>>
>> qx.Class.include(qx.ui.toolbar.Toolbar, custom.MObject);
>>
>> and thus only add the bindto() method to objects descending of Toolbar. If
>> this could be done with the same (or somehow generic) mixin, it would give
>> me all control about where to use this convenience method (without
>> explicitely defining it myself in each class I want to use it in, which I
>> could, I guess?).
>
> Absolutely. If you only need it with a small number of classes, that's a
> good way to go.
Cool.
Now, if this would also be possible ....
qx.Class.define("my.classA", {
extend : qx.ui.window.Window,
construct : function() {
this.base(arguments);
qx.Class.include(my.classA, my.UtilMixin);
... I'd have a generic "include" mechanism for my own classes. But I fear
that my.classA would first have to be completely defined, before the mixin
can happen?
Cheers,
Fritz (just dreaming a bit)
--
Oetiker+Partner AG tel: +41 62 775 9903 (direct)
Fritz Zaucker +41 62 775 9900 (switch board)
Aarweg 15 +41 79 675 0630 (mobile)
CH-4600 Olten fax: +41 62 775 9905
Schweiz web: www.oetiker.ch
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel