By the way, this is an interesting conceptual question. Because couple of times I���ve encountered this problem that I had to extend different entities with the same methods, which results in duplication.

Uko

On 27 Oct 2014, at 11:31, Max Leske <maxleske@gmail.com> wrote:


On 27.10.2014, at 11:27, phil@highoctane.be wrote:

On Mon, Oct 27, 2014 at 11:18 AM, Max Leske <maxleske@gmail.com> wrote:

> On 27.10.2014, at 11:16, phil@highoctane.be wrote:
>
> I have a TCXTBSButton trait that I want to add to a couple of WA classes.
>
> Now, I do not want to touch the WA classes as it would mean that I have to maintain them on my own, which isn't good.
>
> So, how do I add a trait to a class without changing its code?
> Programmatically adding a trait to a class on package/configuration load.
>
> For methods, I can do a *myownpackage so that things will be saved there.
>
> But for traits, I do not know how.
>
> Help :-)

I don���t think there���s any other option than doing a postload and recompiling those classes. Obviously, the packages of those classes will become dirty.

Annoying. I do not want them dirty.

In the meantime, I have subclassed the TagBrush I need and added the trait there.
But that's a pain for all other features that do use the superclass as such.

Phil

If you���re adventurous you could maybe copy the methods from the trait to the classes and classify them as extensions of your package. Then at least only your package would be dirty���

But yeah, not very nice...

 

>
> Phil