Tk Source Code

View Ticket
Login
Ticket UUID: 659218
Title: make column/row configure easier
Type: RFE Version: None
Submitter: davidw Created on: 2002-12-28 00:49:45
Subsystem: 49. [grid] Assigned To: pspjuth
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2008-12-11 22:04:13
Resolution: Accepted Closed By: pspjuth
    Closed on: 2003-09-18 18:26:08
Description:
When I use the grid tool, I don't care about what
columns or rows get certain options.  I care about the
widgets.  It would make my life easier to let Tk figure
things out for me.  This is what I had in mind, more or
less:

grid columnconfigure .foo.bar -weight 1

where .foo.bar is a widget, not a 'master'.

Maybe there is another way to do it that is cleaner.

Thankyou,
Dave
User Comments: pspjuth added on 2003-09-19 01:26:08:
Logged In: YES 
user_id=98900

TIP#147 added to 8.5a.

pspjuth added on 2003-08-07 20:33:25:
Logged In: YES 
user_id=98900

This is now part of TIP#147.
http://www.tcl.tk/cgi-bin/tct/tip/147.html

davidw added on 2003-02-20 00:30:42:
Logged In: YES 
user_id=240

I've found a nice hack to get around this limitation, which
might be useful to people in the mean time.

namespace eval gridinfo {
    namespace export row column
}

proc gridinfo::row {w} {
    array set info [grid info $w]
    return $info(-row)
}

proc gridinfo::column {w} {
    array set info [grid info $w]
    return $info(-column)
}

Then, I use these procedures like so:

    grid columnconfigure . [column $m] -weight 1
    grid rowconfigure . [row $m] -weight 1
    grid rowconfigure $m [row $im] -weight 4
    grid rowconfigure $m [row $fi] -weight 1
    grid columnconfigure $m [column $mf] -weight 1

dkf added on 2003-02-19 20:35:50:
Logged In: YES 
user_id=79902

I agree that's a far more feasable suggestion.

pspjuth added on 2003-02-19 06:12:55:
Logged In: YES 
user_id=98900

I think this could work and be very useful if the
syntax is e.g.:

grid columnconfigure .foo .foo.bar -weight 1
grid columnconfigure . {.c1 .c2} -weight 1

That is, allow a slave where the column number should
be and define it to affect the column(s) currently
occupied by that slave.

Should be simple to implement, and backwards compatible.

dkf added on 2003-01-07 16:57:53:
Logged In: YES 
user_id=79902

This is very incompatible with the existing syntax of [grid]
(contained widgets may themselves be gridded containers.) 
Instead, we should add weights (etc.) in each direction to
the grid's options on a widget, and have a special setting
of the column and row weights that says "work out the
maximum weight of the widgets in the column/row and use
that".  Indeed, with suitable defaults, this could even be
done virtually compatably!