Prev: Timing TCL code
Next: ttk::combobox and Win7 artefact
From: Will Duquette on 24 May 2010 13:00 I'm wanting to create a tablelist widget whose requested width derives from the columns defined in the widget. This is not the normal way to use tablelist; the -width option is the width in characters of the - font. I don't see any obvious way to make it happen. Any ideas?
From: Csaba Nemethi on 24 May 2010 13:59 Am 24.05.2010 19:00, schrieb Will Duquette: > I'm wanting to create a tablelist widget whose requested width derives > from the columns defined in the widget. This is not the normal way to > use tablelist; the -width option is the width in characters of the - > font. I don't see any obvious way to make it happen. Any ideas? You can get the requested width in pixels of every column by using <pathName> columnwidth <columnIndex> -requested Sum up the requested column widths, and you will have the requested widget width in pixels. The rest is a common pixels-to-characters transformation problem, which is usually solved with the aid of the font command, by getting the width of the '0' character when using the widget's font. -- Csaba Nemethi http://www.nemethi.de mailto:csaba.nemethi(a)t-online.de
From: Will Duquette on 24 May 2010 14:58 On May 24, 10:59 am, Csaba Nemethi <csaba.neme...(a)t-online.de> wrote: > Am 24.05.2010 19:00, schrieb Will Duquette: > > > I'm wanting to create a tablelist widget whose requested width derives > > from the columns defined in the widget. This is not the normal way to > > use tablelist; the -width option is the width in characters of the - > > font. I don't see any obvious way to make it happen. Any ideas? > > You can get the requested width in pixels of every column by using > > <pathName> columnwidth <columnIndex> -requested > > Sum up the requested column widths, and you will have the requested > widget width in pixels. The rest is a common pixels-to-characters > transformation problem, which is usually solved with the aid of the font > command, by getting the width of the '0' character when using the > widget's font. > > -- > Csaba Nemethi http://www.nemethi.de mailto:csaba.neme...(a)t-online.de Thanks much!
From: Csaba Nemethi on 24 May 2010 17:23 Am 24.05.2010 20:58, schrieb Will Duquette: > On May 24, 10:59 am, Csaba Nemethi <csaba.neme...(a)t-online.de> wrote: >> Am 24.05.2010 19:00, schrieb Will Duquette: >> >>> I'm wanting to create a tablelist widget whose requested width derives >>> from the columns defined in the widget. This is not the normal way to >>> use tablelist; the -width option is the width in characters of the - >>> font. I don't see any obvious way to make it happen. Any ideas? >> >> You can get the requested width in pixels of every column by using >> >> <pathName> columnwidth <columnIndex> -requested >> >> Sum up the requested column widths, and you will have the requested >> widget width in pixels. The rest is a common pixels-to-characters >> transformation problem, which is usually solved with the aid of the font >> command, by getting the width of the '0' character when using the >> widget's font. >> >> -- >> Csaba Nemethi http://www.nemethi.de mailto:csaba.neme...(a)t-online.de > > Thanks much! I nearly forgot a much simpler way: Set the widget's -width option to 0 (see the reference manual). Most of the Tablelist demo-scripts make use of this method. -- Csaba Nemethi http://www.nemethi.de mailto:csaba.nemethi(a)t-online.de
From: Will Duquette on 24 May 2010 20:14
On May 24, 2:23 pm, Csaba Nemethi <csaba.neme...(a)t-online.de> wrote: > Am 24.05.2010 20:58, schrieb Will Duquette: > > > > > > > On May 24, 10:59 am, Csaba Nemethi <csaba.neme...(a)t-online.de> wrote: > >> Am 24.05.2010 19:00, schrieb Will Duquette: > > >>> I'm wanting to create a tablelist widget whose requested width derives > >>> from the columns defined in the widget. This is not the normal way to > >>> use tablelist; the -width option is the width in characters of the - > >>> font. I don't see any obvious way to make it happen. Any ideas? > > >> You can get the requested width in pixels of every column by using > > >> <pathName> columnwidth <columnIndex> -requested > > >> Sum up the requested column widths, and you will have the requested > >> widget width in pixels. The rest is a common pixels-to-characters > >> transformation problem, which is usually solved with the aid of the font > >> command, by getting the width of the '0' character when using the > >> widget's font. > > >> -- > >> Csaba Nemethi http://www.nemethi.de mailto:csaba.neme...(a)t-online..de > > > Thanks much! > > I nearly forgot a much simpler way: Set the widget's -width option to 0 > (see the reference manual). Most of the Tablelist demo-scripts make use > of this method. > > -- > Csaba Nemethi http://www.nemethi.de mailto:csaba.neme...(a)t-online.de Oh, very cool. I tried not setting -width, but I didn't try setting it to 0. Thanks! |