home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!netsys!ukma!david
- From: david@ms.uky.edu (David Herron -- a slipped disk)
- Subject: Re: making a listbox wider
- References: <1992Dec22.174743.3736@twg.com>
- <1992Dec26.021200.8087@hawk.cs.ukans.edu>
- Message-ID: <1992Dec28.124745.1857@ms.uky.edu>
- Date: Mon, 28 Dec 1992 17:47:45 GMT
- Organization: University Of Kentucky, Dept. of Math Sciences
- Lines: 48
-
- In article <1992Dec26.021200.8087@hawk.cs.ukans.edu> shea@hawk.cs.ukans.edu (Gary Shea) writes:
- >In article <1992Dec22.174743.3736@twg.com> "David Herron" <david@twg.com> writes:
- >>> How can I make a listbox wider? Using horizontal scrollbars to get at the
- >>> last 5 or 6 chars in the text doesn't seem worth it. (Besides, the customer
- >>> wants all of the text visible.)
- ...
- >>This will make the listbox fill whatever space it's put into while keeping
- >>the scrollbar at a constant size. (bloated scrollbars are ugly)
- >>
- >>Also take a look at the -geometry argument ...
- >
- > I suspect the original question is yet unanswered, and it's
- > one I've been wondering about also. How can I get the listbox
- > to scale its width to the width of the text I put into it?
-
- Okay, you're probably right.
-
- Note: I've seen claims by HCI people that windows which resize themselves
- on their own whims are disconcerting to users. In my work, when I've
- made windows which resized themselves people have complained and we ended
- up making them either not change or change very little.
-
- At any rate this job requires some TCL and uses the -geometry
- argument. Listbox geometry is in terms of character widths so there
- isn't any groady calculations involving characters being so many pixels
- wide in the current font + n pixels of blank area. Instead It is
- simply a matter of occasionally inspecting the strings and
-
- $top.l -configure -geometry =widthxheight
-
- (or whatever the correct notation is. I'm nowhere near any tk manuals.)
-
- A convenient time would be when you add a new string to the listbox.
- One way is to surround the listbox with a module full of functions (my
- interp module should come in handy). In the add-string method you see
- if this string is longer than the previous maximum string and, if so,
- call the set-geometry method. The delete-string method must update
- the maximum length of course.
-
- >><- David Herron <david@twg.com> (work) <david@davids.mmdf.com> (home)
-
- To the above add:
-
- <- David Herron <david@ms.uky.edu> (vacation)
-
- --
- <- David Herron; an MMDF weenie <david@twg.com>
- <- ska: David le casse\*'
-