Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create drop down lists/menus

0 views
Skip to first unread message

Hal Manuel

unread,
Aug 28, 1998, 3:00:00 AM8/28/98
to
I'm trying to figure out a good way to do a drop down list/menu.

What I'm looking to do is have a field with a small button next to it
(such as an arrow pointing down) that when you click on the button,
a scrolled list is "dropped down" from the field displaying a list of
available selections. Whatever selection the user picks would
be inserted into the field and set into a variable. This much I kind of

have from some examples in a book I have, but there are 2 things I
don't like about the implementation:

1) The scrolled list is created as a toplevel window, this has some
"interesting" side effects.
2) If you click on the arrow to get the drop-down list, you MUST select

an item in the list; you cannot click on the button again and get the
list to collapse.
I would really like for the arrow to invert (point up) when the list is
pulled down so that you can collapse it without selecting something
from the list (leave whatever is selected alone).

ANY help would be greatly appreciated!

Thanks,

Hal
man...@nima.mil


Martin Herve

unread,
Aug 28, 1998, 3:00:00 AM8/28/98
to Hal Manuel
Hal Manuel wrote:
>
> I'm trying to figure out a good way to do a drop down list/menu.
>
> What I'm looking to do is have a field with a small button next to it
> (such as an arrow pointing down) that when you click on the button,
> a scrolled list is "dropped down" from the field displaying a list of
> available selections. Whatever selection the user picks would
> be inserted into the field and set into a variable. This much I kind of
>

You can try megawidget. Look for files:

61219 Aug 26 1997 widget.tar.gz
This code works for Tk4.2+ (tested through 8.0b2), but uses a
simpler, less functional system.
80816 Jun 26 01:46 widget-0.9.tar.gz
This code works for Tk8+ with namespaces and lots more spiffy
stuff, but is 0.9 because of lack of docs. The widgets are actually more
refined than the
above ones though.

The web page is:
http://www.cs.uoregon.edu/research/tcl/script/widget/

Bye.

Xavier
--
xout...@caramail.com

jeff_...@my-dejanews.com

unread,
Aug 28, 1998, 3:00:00 AM8/28/98
to man...@nima.mil
In article <35E62FA3...@erols.com>,

Hal Manuel <h...@erols.com> wrote:
> I'm trying to figure out a good way to do a drop down list/menu.

There are several implementations mentioned in the FAQs. One is:
http://oprs.mchh.siemens.de/tcl/script/widget/

--
jeff.hobbs at acm.org

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

Bryan Oakley

unread,
Aug 28, 1998, 3:00:00 AM8/28/98
to Hal Manuel
Hal Manuel wrote:
>
> I'm trying to figure out a good way to do a drop down list/menu.
>
> What I'm looking to do is have a field with a small button next to it
> (such as an arrow pointing down) that when you click on the button,
> a scrolled list is "dropped down" from the field displaying a list of
> available selections. Whatever selection the user picks would
> be inserted into the field and set into a variable. This much I kind of
>
> have from some examples in a book I have, but there are 2 things I
> don't like about the implementation:
>
> 1) The scrolled list is created as a toplevel window, this has some
> "interesting" side effects.
> 2) If you click on the arrow to get the drop-down list, you MUST select
>
> an item in the list; you cannot click on the button again and get the
> list to collapse.
> I would really like for the arrow to invert (point up) when the list is
> pulled down so that you can collapse it without selecting something
> from the list (leave whatever is selected alone).
>
> ANY help would be greatly appreciated!

Ok, along with the chorus of "try mine!", I'll throw in my own pitch. My
combobox is at
http://www1.clearlight.com/~oakley/tcl/combobox/index.html (whew!). With
it you are not forced to make a selection, though the image on the
button doesn't change. Clicking on the button or outside the list will
collapse the list. And, since the source is free for you do do whatever
you want, it would be easy to modify the code to behave the way you
want.

As for why the dropdown is implemented as a toplevel, well, that's the
only mechanism in tk that will allow for a popup window that can embed
another window (eg: the scrollable list). The only other choice is a
menu item, which can't be scrolled.

BTW: version 1.06 will be released soon, probably today if I can find a
few minutes to run it through some tests and then upload it to the web
server.


--
Bryan Oakley
ChannelPoint, Inc.

0 new messages