| Re: Opening variable files [message #8049 is a reply to message #7951] |
Thu, 30 January 1997 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Chris Crabtree" <cecrabtr@artsci.wustl.edu> writes:
> I am currently trying to write a widget based application
> and I ran into a problem. I want the user to be able to open a file of
> his or her choosing, but when I try to use the statement
>
> openr, 1, filename
>
> where filename is a string (variable) I get a message saying that a scalar
> value is expected. Is there any way to allow the user to enter in the new
> file name without exiting the application and recompiling the program with
> the new 'filename' inserted.
Chris, you probably got this filename from a text widget. When you
get the value of a text widget, you always are returned a string
*array*, even if there is only one "thing" in your text widget.
You can make your program work by typing this:
openr, 1, filename(0)
But this is lousy code. :-)
I'd use this:
OPENR, lun, filename(0), /GET_LUN
This will save you some headaches down the road debugging
your programs. Tell your advisor you need a copy of "Building
Graphical User Interfaces in IDL", too. You can get it from RSI.
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
|
|
|
|