Re: tablelist: possible to have embedded window that grows with the column?



Bryan Oakley schrieb:
Is it possible to embed a window in a tablelist cell and have that widget grow and shrink as the column is resized either dynamically or as a column is automatically stretched? I've tried a few obvious things such as binding to <Configure> but whatever width I set my widget to, it always snaps back to the original width.

It seems I can adjust the width of both the widget and the parent to the window, but that depends on the internal state of the tablelist, which I'd rather not do. I'm wondering if I'm just missing something in the sea of options available to me.

Here's code that illustrates the problem. What I desire is to have the red and blue frames grow and shrink as you resize the window but they do not.

package require Tk
package require Tablelist
proc main {} {
label .status -bd 1 -relief raised
pack .status -side bottom -fill x
tablelist::tablelist .t \
-columns {-32 "" left 0 Stretchable left -32 "" left} \
-stretch 1
.t insert end {{} {}}
.t cellconfigure end,1 -window {createWindow red}
.t insert end {{} {}}
.t cellconfigure end,1 -window {createWindow blue}
pack .t -side top -fill both -expand true

bind .t <Configure> resize
}

proc resize {} {
set width [.t columnwidth 1 -total]
.status configure -text "resetting width to $width"
foreach row {0 1} {
set window [.t windowpath $row,1]
$window configure -width $width
}
}

proc createWindow {color t row col path} {
set width [.t columnwidth 1 -total]
frame $path -width $width -height 8 -background $color
}

main


Bryan,

Currently Tablelist doesn't support embedded widgets of dynamic width. You are not the first person asking for this feature, which is one of the many items on my ever-growing TODO list. Unfortunately, I have been awfully busy for several months now, and I don't see any chance to get the necessary leisure time before February 2008. :-(

--
Csaba Nemethi http://www.nemethi.de mailto:csaba.nemethi@xxxxxxxxxxx
.



Relevant Pages

  • Re: How to create some text widgets like text editor in VC++?
    ... I am not sure what you mean by the "notebook widget", ... This will instruct to resize its child widgets that you ... the window gets resized. ...
    (comp.lang.tcl)
  • Re: Resizing widgets in text windows
    ... I realize that the pack manager usually handles all of the resize ... but I've found an arrangement that the pack manager fails for. ... if one embeds a canvas into a window created inside a text ... widget, then resize the text widget, the canvas and ...
    (comp.lang.python)
  • tablelist: possible to have embedded window that grows with the column?
    ... I've tried a few obvious things such as binding to but whatever width I set my widget to, it always snaps back to the original width. ... It seems I can adjust the width of both the widget and the parent to the window, but that depends on the internal state of the tablelist, which I'd rather not do. ... What I desire is to have the red and blue frames grow and shrink as you resize the window but they do not. ...
    (comp.lang.tcl)
  • Re: Files dragged onto desktop dont show up
    ... inward to a new window size. ... I just used the resize to shrink it, ... disappear. ...
    (Fedora)
  • Re: Resizing a widget to be smaller when window corner is dragged
    ... > How do I configure a widget to resize when the window corner is dragged? ... > will disappear. ...
    (comp.lang.perl.tk)