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

Home » Public Forums » archive » Dialog_Pickfile Clipping Filenames
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
Dialog_Pickfile Clipping Filenames [message #79353] Sat, 25 February 2012 07:45
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

I've recently discovered that one of my long-standing
pet peeves about IDL has a simple solution.

I am referring to the fact that Dialog_Pickfile will
cut off the initial file name when it first appears
on the display. (This may be a Windows only thing,
I'm not sure.) Consider, for example, this file name:

fn = '1234567890abcdefg.txt'

If I put this into a Dialog_Pickfile like this:

file = Dialog_Pickfile(FILE=fn)

Then, on Windows, the first six characters in the file
name are cut off. They are there, the user just doesn't
see them!

This has annoyed me for a long time because it makes
it virtually impossible to produce graphical user
interfaces for programs that look, well, professional.
I've complained about it to the technical support people
so much that they will no longer take my calls about it.

Finally, in desperation, I decided to file a bug report
for the IDL 8.2 beta about it. In the process of doing
so, I accidentally discovered a simple work-around.

It turns out that if you set the WRITE keyword, then
Dialog_Pickfile knows perfectly well how to put the
filename in the dialog! This code displays the file
name perfectly:

file = Dialog_Pickfile(FILE=fn, /WRITE)

Of course, setting the WRITE keyword changes the text on
the main window of the dialog from "Please Select a File"
to "Please Select a File For Writing", but this is
easily overcome by using the TITLE keyword to select
any title you like:

file = Dialog_Pickfile(FILE=fn, /WRITE, $
TITLE ='Woohoo, Problem solved!!!')

I'm off to put this fix into cgPickfile, which is the
way I normally call Dialog_Pickfile right now! :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: GRIB Webinar
Next Topic: Capturing Ctrl+c

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

Current Time: Wed Oct 08 18:52:54 PDT 2025

Total time taken to generate the page: 0.00376 seconds