[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to select best from a long list?

Michael Spranger (q4668057@bonsai.fernuni-hagen.de) writes:

> Another newbie question:

Well, unlike most newbie questions, this one appears
to have a possible solution. :-)

> I have a long list (about 16,000 entries) of cities names (downloaded
> from NIMA), plus according Longs and Lats. 
> I'd like to realize a functionality similar to the "index help". 
> Explicitly: while entering the first letters of the name, I'd like to
> see a scrolling list showing the entries of my list with the same
> beginning as typed in. 
> In the end I'd like to select one entry and give back name, long, lat
> to the main program.
> Anybody who realizes a similar functionality? Could that be realized
> with widget_list? Or is there a better way?

This is the *perfect* time to learn how to build
a compound widget, because that is exactly what
you want here. You want a text widget for typing,
a list widget for presenting the user with choices,
a "Done" button, and some way to get the choices
back to the main routine (probably as the event
coming from your compound widget).

And if you *really* want to learn something about
IDL, you might even want to write this this
example as an object widget. Now *that* would
impress the jaded experts around here! :-)

I put a couple of examples up on my web page recently,
although I still haven't gotten around to writing the
articles that explain them in detail. But you can find
a compound widget consisting of a label widget next 
to a text widget here:


And the same program functionality, written this time as an object
widget here:


It strikes me that this might be an even better example
for the web page, however. I'm teaching an advanced IDL
programming class next week. Perhaps we will see what
people can come up with in a programming exercise. :-)


David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155