Re: droplist items [message #10184 is a reply to message #10181] |
Fri, 31 October 1997 00:00   |
R. Bauer
Messages: 137 Registered: November 1996
|
Senior Member |
|
|
Peter Mason wrote:
> 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.
I am using findfile on both platforms. What's the reason for you using ls?
> (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.
That's the explainmentation why I' am using it on both platforms.
if strupcase(!version.os) eq 'WIN32' or strupcase(!version.os) eq 'WIN' then delim
= '*.*' ELSE delim='-Fd *'
files_and_dirs=findfile(delim)
All directories will have a / at the end of the string
You can submit to findfile on a unix platform all commands are used by ls.
> 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/
--
R.Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
|
|
|