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

Home » Public Forums » archive » Re: Displaying a list of 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
Re: Displaying a list of filenames [message #78891] Tue, 03 January 2012 10:02
Vincent Sarago is currently offline  Vincent Sarago
Messages: 34
Registered: September 2011
Member
Hi Percy,

Maybe I'm wrong but maybe you can create a new array (list of filename) with the 'filename + the path on the right'.

the use will see directly the filename and can still see the fullpath (using the scroll bar)


after you just have to pass both arrays (normal list and modified list) to the event handler ...

Pro test_idea

uList = dialog_pickfile(/Multiple) ; List of full File Name
if (n_elements(uList) eq 0) then return

; Create a new List " base + ' ' + 'directory'
arrList = strarr(n_elements(uList))
for ii = 0, n_elements(uList) - 1 do $
arrList[ii] = string((file_basename(uList))[ii],(file_dirname(uList))[ii], format='(a,4x,a)')

base = Widget_Base(UNAME = 'widget', TITLE='test')

wlist = widget_list(base, $
UNAME = 'wlist', $
/SENSITIVE, $
YSIZE = n_elements(arrList), $
VALUE = arrList, $
/MULTIPLE)

Widget_Control, /REALIZE, base

End

(Hope this time I'm not wrong :D)

vincent
Re: Displaying a list of filenames [message #78892 is a reply to message #78891] Tue, 03 January 2012 09:03 Go to previous message
Percy Pugwash is currently offline  Percy Pugwash
Messages: 12
Registered: January 2012
Junior Member
On Jan 3, 4:25 pm, David Fanning <n...@dfanning.com> wrote:
> Percy Pugwash writes:
>> Thanks very much. While I can see that cgPickfile offers some useful
>> options not present in dialog_pickfile, I'm not sure if it's quite
>> suitable for my purpose. The idea here is the the files have already
>> been selected, and the selected files are displayed in a list of some
>> kind, such that the user can highlight any given one of those files in
>> order to tweak the processing steps for that file (with options given
>> in the widget application). As such, I think it's quite important that
>> the list would be embedded directly into the top-level base of the
>> application. The files themselves might not all be in the same
>> directory.
>
>> Another slightly less satisfactory route I was considering exploring
>> would be to use widget_list, but truncate the displayed paths so that
>> the rightmost portion of the path is visible. However, this requires a
>> way to calculate how much of the string will exactly fit in the
>> available space. I suppose I could set the list to be a set width in
>> characters, and then at least be sure that if I truncate each string
>> to be equal to that width, they would fit in the box. I think it'd be
>> quite unattractive though.
>
> Oh, attractive. I think you might have to wait until
> the New Widgets are introduced in IDL 10.0 and actually work
> in IDL 10.4. :-)
>
> Cheers,
>
> David
>
> P.S. All I'm saying is that *all* of the options
> available to you are less than perfect. "Get used
> to disappointment," as my favorite line from the
> Princess Bride reminds us. This is probably the
> dark side of having to write widgets that work
> across platforms.
>
> --
> 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.")

Doug,

Thanks, but the problem with this approach is that in general the
strings will be too long to make fitting the widget width to the
string sizes a practical proposition.

David,

Having seen some of your earlier posts on related subjects, I
suspected this might be the case!

P
Re: Displaying a list of filenames [message #78893 is a reply to message #78892] Tue, 03 January 2012 08:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Percy Pugwash writes:

> Thanks very much. While I can see that cgPickfile offers some useful
> options not present in dialog_pickfile, I'm not sure if it's quite
> suitable for my purpose. The idea here is the the files have already
> been selected, and the selected files are displayed in a list of some
> kind, such that the user can highlight any given one of those files in
> order to tweak the processing steps for that file (with options given
> in the widget application). As such, I think it's quite important that
> the list would be embedded directly into the top-level base of the
> application. The files themselves might not all be in the same
> directory.
>
> Another slightly less satisfactory route I was considering exploring
> would be to use widget_list, but truncate the displayed paths so that
> the rightmost portion of the path is visible. However, this requires a
> way to calculate how much of the string will exactly fit in the
> available space. I suppose I could set the list to be a set width in
> characters, and then at least be sure that if I truncate each string
> to be equal to that width, they would fit in the box. I think it'd be
> quite unattractive though.

Oh, attractive. I think you might have to wait until
the New Widgets are introduced in IDL 10.0 and actually work
in IDL 10.4. :-)

Cheers,

David

P.S. All I'm saying is that *all* of the options
available to you are less than perfect. "Get used
to disappointment," as my favorite line from the
Princess Bride reminds us. This is probably the
dark side of having to write widgets that work
across platforms.


--
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.")
Re: Displaying a list of filenames [message #78894 is a reply to message #78893] Tue, 03 January 2012 08:20 Go to previous message
Doug Edmundson is currently offline  Doug Edmundson
Messages: 58
Registered: November 2005
Member
On 1/3/12 8:45 AM, Percy Pugwash wrote:
> On Jan 3, 3:11 pm, David Fanning<n...@dfanning.com> wrote:
>> Percy Pugwash writes:
>>> I would like to display a list of filenames in an widget application.
>>> I have so far been unable to find a satisfactory way of doing this,
>>> since I would like the user to be able to:
>>
>>> 1) Select one or several of the filenames in the list
>>> 2) View the whole filepath, right-aligned so that the name at the end
>>> is clear
>>
>>> I can't seem to right-align a list widget, and a text widget won't let
>>> me select an item in the list in a straightforward way. I think I can
>>> make it work with a table widget, but that seems to have irritating
>>> and unnecessary scroll bars.
>>
>>> Does anyone have a solution?
>>
>> My solution, after years of frustration trying to do just
>> this, was to retreat to a smarter version of Dialog_Pickfile,
>> which can remember the directory (and file, if I want) that
>> I previously selected. It's made my life easier and I no
>> longer wake up in terror at night thinking about table widgets. :-)
>>
>> http://www.idlcoyote.com/idldoc/cg/cgpickfile.html
>>
>> Cheers,
>>
>> David
>>
>> P.S. Set the MULTIPLE keyword if you want to select
>> multiple files.
>>
>> --
>> 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.")
>
> David,
>
> Thanks very much. While I can see that cgPickfile offers some useful
> options not present in dialog_pickfile, I'm not sure if it's quite
> suitable for my purpose. The idea here is the the files have already
> been selected, and the selected files are displayed in a list of some
> kind, such that the user can highlight any given one of those files in
> order to tweak the processing steps for that file (with options given
> in the widget application). As such, I think it's quite important that
> the list would be embedded directly into the top-level base of the
> application. The files themselves might not all be in the same
> directory.
>
> Another slightly less satisfactory route I was considering exploring
> would be to use widget_list, but truncate the displayed paths so that
> the rightmost portion of the path is visible. However, this requires a
> way to calculate how much of the string will exactly fit in the
> available space. I suppose I could set the list to be a set width in
> characters, and then at least be sure that if I truncate each string
> to be equal to that width, they would fit in the box. I think it'd be
> quite unattractive though.
>
> P

Hi,

You should be able to use WIDGET_INFO( STRING_SIZE ) to compute the
string dimensions, in pixels. Find the longest string, set the widget
width, prepend with spaces, etc. Bit of a hack, but hope it works well.

Cheers,
Doug
Exelis VIS
Re: Displaying a list of filenames [message #78895 is a reply to message #78894] Tue, 03 January 2012 07:45 Go to previous message
Percy Pugwash is currently offline  Percy Pugwash
Messages: 12
Registered: January 2012
Junior Member
On Jan 3, 3:11 pm, David Fanning <n...@dfanning.com> wrote:
> Percy Pugwash writes:
>> I would like to display a list of filenames in an widget application.
>> I have so far been unable to find a satisfactory way of doing this,
>> since I would like the user to be able to:
>
>> 1) Select one or several of the filenames in the list
>> 2) View the whole filepath, right-aligned so that the name at the end
>> is clear
>
>> I can't seem to right-align a list widget, and a text widget won't let
>> me select an item in the list in a straightforward way. I think I can
>> make it work with a table widget, but that seems to have irritating
>> and unnecessary scroll bars.
>
>> Does anyone have a solution?
>
> My solution, after years of frustration trying to do just
> this, was to retreat to a smarter version of Dialog_Pickfile,
> which can remember the directory (and file, if I want) that
> I previously selected. It's made my life easier and I no
> longer wake up in terror at night thinking about table widgets. :-)
>
>   http://www.idlcoyote.com/idldoc/cg/cgpickfile.html
>
> Cheers,
>
> David
>
> P.S. Set the MULTIPLE keyword if you want to select
> multiple files.
>
> --
> 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.")

David,

Thanks very much. While I can see that cgPickfile offers some useful
options not present in dialog_pickfile, I'm not sure if it's quite
suitable for my purpose. The idea here is the the files have already
been selected, and the selected files are displayed in a list of some
kind, such that the user can highlight any given one of those files in
order to tweak the processing steps for that file (with options given
in the widget application). As such, I think it's quite important that
the list would be embedded directly into the top-level base of the
application. The files themselves might not all be in the same
directory.

Another slightly less satisfactory route I was considering exploring
would be to use widget_list, but truncate the displayed paths so that
the rightmost portion of the path is visible. However, this requires a
way to calculate how much of the string will exactly fit in the
available space. I suppose I could set the list to be a set width in
characters, and then at least be sure that if I truncate each string
to be equal to that width, they would fit in the box. I think it'd be
quite unattractive though.

P
Re: Displaying a list of filenames [message #78896 is a reply to message #78895] Tue, 03 January 2012 07:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Percy Pugwash writes:

> I would like to display a list of filenames in an widget application.
> I have so far been unable to find a satisfactory way of doing this,
> since I would like the user to be able to:
>
> 1) Select one or several of the filenames in the list
> 2) View the whole filepath, right-aligned so that the name at the end
> is clear
>
> I can't seem to right-align a list widget, and a text widget won't let
> me select an item in the list in a straightforward way. I think I can
> make it work with a table widget, but that seems to have irritating
> and unnecessary scroll bars.
>
> Does anyone have a solution?

My solution, after years of frustration trying to do just
this, was to retreat to a smarter version of Dialog_Pickfile,
which can remember the directory (and file, if I want) that
I previously selected. It's made my life easier and I no
longer wake up in terror at night thinking about table widgets. :-)

http://www.idlcoyote.com/idldoc/cg/cgpickfile.html

Cheers,

David

P.S. Set the MULTIPLE keyword if you want to select
multiple files.



--
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: Displaying a list of filenames
Next Topic: running IDL as a 'sleeping' process

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

Current Time: Wed Oct 08 15:07:47 PDT 2025

Total time taken to generate the page: 0.00624 seconds