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

Home » Public Forums » archive » Re: droplist items
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: droplist items [message #10189 is a reply to message #10181] Thu, 30 October 1997 00:00 Go to previous message
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On Thu, 30 Oct 1997, Matthew Hanson wrote:
> Does anyone know how I can have a droplist box display filenames that
> are in a given directory? An openfile dialog is not appropiate because
> the data files will always be in the same directory and i want it to be
> a simple interface where the user can choose which file to use. New
> data files may be added so when the program starts up i want it to check
> this directory and display the filenames.

On IDL 4 (and IDL 5, I would expect, but haven't really checked thoroughly)...

I use findfile('*.*') on Windows platforms and a spawned "ls" command on Unix
to get file listings into a STRARR. (The only reason I do things differently
for these two platforms is because on Unix, findfile() doesn't indicate whether
a name it returns is for a file or directory, while on Windows it has an '\'
at the end of each directory name.) I've never looked at how this might work
on VMS and Mac platforms.
If the files that your program is to select from have a specific extension
(or something like that) then you could use findfile() for both platforms.

Once you've got a STRARR of names, you can update a droplist simply by doing
WIDGET_CONTROL,droplist_id,SET_VAL=strarr_of_names

The only problem with this is that if you have quite a few names your droplist
will not fit on the screen (on Unix), and so not all files will be selectable.
I have a modified CW_BSELECTOR routine that is sort of like a droplist, with
some additions. (This from the days before IDL had droplists.) It lets
you change the names and number of entries, and can be made to put up a
scrolling list thing instead of a pop-up set of "menu-buttons", if there are
too many entries for the screen. I could send it to you if you like,
but I should have you know that it's a really ugly bunch of code.


Peter Mason
CSIRO division of Exploration and Mining
P.O Box 136, North Ryde, NSW, 2113, Australia
E-Mail: p.mason@syd.dem.csiro.au Tel: +61 2 9490-8883 Fax: 9490-8960/8921
Web: http://www.syd.dem.csiro.au/research/MMTG/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Linear Predictors in IDL?
Next Topic: Re: Preserving Variables

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

Current Time: Wed Oct 08 17:54:45 PDT 2025

Total time taken to generate the page: 0.00217 seconds