[Xotcl] Re: [Xotcl] Re: [Xotcl] Widgets

Catherine Letondal letondal at pasteur.fr
Tue Feb 6 10:16:57 CET 2001


Gustaf Neumann wrote:
> RH> Or wrap every tk command in my xotcl object.
> 
>   Sometimes, this is a straight forward solution to keeps the
>   XOTcl objects and the tk widget in separate trees. Architecturally,
>   this is not a beauty.

How do you then implement the composite pattern for widgets trees as
explained in:

G. Neumann, U. Zdun: Filters as a Language Support for Design Patterns in Object-Oriented
                          Scripting Languages, in: Proceedings of COOTS, San Diego, California, USA, May, 1999.

In my application, every Tk widget creation is wrapped in a method:

    widgets build ${frame}::widgets::panel {
	frame $path.panel 
    }

where widgets is of class Object.

Then you may store informations concerning the widget, in order to be able to
save it, clone it, or whatever.

The composite pattern is very convenient indeed for tk widgets. I use it to
make recursive Tk bindings, or to build a graphical attribute editor for all the
widget tree.

--
Catherine Letondal -- Pasteur Institute Computing Center




More information about the Xotcl mailing list