|Think about Loose Coupling|
Re^3: Perl/Tk Odditiesby TomKane (Beadle)
|on Jul 23, 2008 at 09:33 UTC||Need Help??|
Thanks for the feedback, Zentara. You led me indirectly to the answer that I was looking for.
As I was formerly a C++ programmer, I am familiar with the concept of overriding functionality. I just hadn't done it in Perl and had been hesitant to start digging down to that level when it came to base functionality of the language. But I started looking into some of the DialogBox.pm code and then discovered XDialogBox.pm. As I was looking at that bunch I discovered that whenever I used an XDialogBox widget, it always resulted in having an extra icon at the bottom of the screen, which is exactly what I've been trying to avoid. Then I saw that there were a couple of commented out lines of code and tried uncommenting them. It turns out that the Toplevel->transient() function was one of them and when I turned it back on, voila, no icon.
So, the quick and simple answer to my long search was there all along. Even in "Mastering Perl/Tk", Lidie doesn't mention that particular functionality (the index has the wrong page number, it's really p. 246) for making a new Toplevel appear as a part of the main. That is, the new Toplevel is a "transient" but detached widget within the "master" module that opened the new Toplevel.
Now the fun begins, however, because if I use a Toplevel as a dialog box, then I have to have a button or something that will "close" the dialog -- which is done really with the withdraw() function. But this doesn't tell the "master" module that it's closed. As long as the "master" is itself a module and can have a function accessible to the transient Toplevel, the latter can call the former with the message that it (the transient Toplevel) has "closed".
I better look into the grab() methods now.