comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to select best from a long list?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to select best from a long list? [message #18204] Sun, 12 December 1999 00:00
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
Algorithm for this I see as follows:

list = define_list(Source) ; This is your importation procedure for 16000
list. ; Make sure /ALL_EVENTS, /EDITABLE are set for the text widget.

; The following will be in the event handler for text widget Edit events.
begin
widget_control, Ev.ID, get_value= Search_str
scroll_list = list[where(strpos(list, search_str) ne -1)]
widget_control, scroll_window, set_value=scroll_list
end

Of course, as David recommends, you need at least a widget or compound widget
interface, or maybe even a obget (widject) interface. Although I think those
are worth the time investment if you do more than occasional per-project
programming and will definitely re- use widjects. Cheers, Pavel


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: How to select best from a long list? [message #18207 is a reply to message #18204] Fri, 10 December 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
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:

http://www.dfanning.com/programs/coyote_field.pro

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

http://www.dfanning.com/programs/fsc_inputfield__define.pro

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. :-)

Cheers,

David
--
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Segmentation Fault
Next Topic: LMFIT -- stay away from it!

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:09:29 PDT 2025

Total time taken to generate the page: 0.39950 seconds