Sujet : Re: How do I pack a megawidget?
De : saitology9 (at) *nospam* gmail.com (saito)
Groupes : comp.lang.tclDate : 03. Jul 2024, 18:37:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6428m$29ksi$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 7/3/2024 12:59 PM, Luc wrote:
I know y'all gonna hate this question because I'm not showing much code,
but I am really more interested in concepts than code.
I made a package. It's supposed to be a megawidget. I haven't snitted it
yet. I can't snit it without understanding where I am supposed to go
with it. So here is the problem.
package require giggles
set of $::w.outerframe
frame $of -height 100
pack $of -fill both -expand 1
set gg $of.giggles
::giggles::giggles $gg -guifont "Arial 14" -geometry pack
pack $gg -fill both -expand 1
And it works. The prototype megawidget is inserted into my test parent
application.
The problem is, commenting out the last 'pack' line makes no difference.
The megawidget still shows. (Also, funny that apparently it's redundant
but nothing clashes.) And of course that is not standard widget behavior.
The reason giggles gets displayed automatically is because it has no layering between gg and its internal widgets. I think you can easily solve this by including an additional frame containing your megawidget with all of its sub widgets packed as you want. Then you let the user of your megawidget do the final packing. This way they giggles instances won't automatically show and your users remain in charge of their visibility.