Re: pack or grid (or the other way around)?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: pack or grid (or the other way around)?
De : heller (at) *nospam* deepsoft.com (Robert Heller)
Groupes : comp.lang.tcl
Date : 17. Jan 2025, 00:42:13
Autres entêtes
Organisation : Deepwoods Software
Message-ID : <vmc5gl$3ndsv$1@dont-email.me>
References : 1 2 3 4
User-Agent : TkNews 3.0 (1.2.18)
At Thu, 16 Jan 2025 20:52:50 -0000 (UTC) Rich <rich@example.invalid> wrote:

 
Luc <luc@sep.invalid> wrote:
On Thu, 16 Jan 2025 11:34:34 +0100, Ralf Fassel wrote:
 
In addition to what Rich wrote, here is what you *cant* do:
>
 frame .f
 label .f.l1
 label .f.l2
 
 pack .f.l1
 grid .f.l2
 => error: cannot use geometry manager grid inside .f which already has
slaves managed by pack 
>
 grid .f.l2
 pack .f.l1
 => error: cannot use geometry manager pack inside .f which already has
slaves managed by grid 
>
But .f itself can be managed by either grid or pack, regardless of what
you use to pack/grid widgets 'inside' .f
**************************
 
That is my concern.
 
.f itself can be managed by either grid or pack, regardless of what
you use to pack/grid widgets 'inside' .f
 
That's because .f is the parent.
 
Now suppose someone has an application that uses grid. Everything is
inside one big 'gridded' frame. And suppose my megawidget uses pack.
 
Or the other way around.
 
That is my concern.
 
Provided your megawidget exposes only one single top level widget
(usually a frame which holds all the internal widgets) to the user of
the megawidget it will make no difference.  The user of the megawidget
can do anything they like to the outer container as far as
pack/grid/placing it, zero impact on your bits and pieces inside that
container.

Important gotcha:  I *think* the OP is comtemplating packing (or gridding) his
megawidget.  That would be bad practice.  The widget (typically a frame)
should be returned unmanged.  The caller of the function that creates the
megawidget is responsible for setting its geometry management:

proc Create-Some-Wonderful-MegaWidget {w args} {
    # the frame for the MegaWidget
    frame $w -class Megawidget
    # pack an only child
    pack [button $w.b -text "Useless Button" -command [list puts "who cares: $args"]]
    # return the Megawidget
    return $w
}

toplevel .foo
set w [Create-Some-Wonderful-MegaWidget .foo.bar]
grid $w

 
 
                                                                       
 

--
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller@deepsoft.com       -- Webhosting Services

Date Sujet#  Auteur
16 Jan 25 * pack or grid (or the other way around)?6Luc
16 Jan 25 +- Re: pack or grid (or the other way around)?1Rich
16 Jan 25 `* Re: pack or grid (or the other way around)?4Ralf Fassel
16 Jan 25  `* Re: pack or grid (or the other way around)?3Luc
16 Jan 25   `* Re: pack or grid (or the other way around)?2Rich
17 Jan 25    `- Re: pack or grid (or the other way around)?1Robert Heller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal