Having created a fork of Tkx to play with, I'm starting to experiment
with duplicating some of the functionality that Perl/Tk has in Tk::mega.
The first item on my list is support for class initialization. The
Tk::mega documentation says that

    ClassInit is called once for each MainWindow just before the
    first widget instance of a class is created in the widget tree
    of MainWindow.

As Perl/Tk supports multiple mainwindows, ClassInit could be called more
than once.

Does Tkx (or perhaps it would be Tcl.pm) support multiple mainwindows?
This doesn't complain, but even though $x and $y have different
addresses they refer to the same Tk widget.

    my $x = Tkx::widget->new('.');
    my $y = Tkx::widget->new('.');

That's not surprising since they have the same name. Methods like
_parent() and _kid() exploit this to "retrieve" the widget reference
from the Tcl name. Giving $x and $y different Tcl names doesn't appear
to be an option, either. Most of my attempts ended in "bad window path
name" errors. While there are lots of examples of using '.' as the name
of the root window and it appears to be a requirement, the documentation
never actually explains it.

It looks like multiple mainwindows are not possible, in which case I can
safely ignore that aspect of the Tk behavior. Is this true?

-mjc

Reply via email to