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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: droplist items [message #10181] Fri, 31 October 1997 00:00
David Foster is currently offline  David Foster
Messages: 341
Registered: January 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.
>

I would suggest using a scrollable list widget. You can easily use
the event structure to determine which item is selected. You can
also implement double-clicking.

If you want to see an example of this, you can look at my LHELP
program that allows the user to view all the *.doc (and *.pro)
files within IDL's !PATH:

ftp://bial8.ucsd.edu pub/software/idl/share

It will show you how to create and fill the list widget, and how
to process the events.

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: droplist items [message #10184 is a reply to message #10181] Fri, 31 October 1997 00:00 Go to previous message
R. Bauer is currently offline  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
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/
  Switch to threaded view of this topic Create a new topic Submit Reply
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 11:35:18 PDT 2025

Total time taken to generate the page: 0.00591 seconds