Re: widget_list() question [message #72448] |
Fri, 10 September 2010 06:16 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Spon writes:
> Did I miss the "I'm back!" post, or did you sneak in quietly while no-
> one was looking? :-)
I snuck back in. Unfortunately, the trail has the effect
of slowing everything way, way down, including one's
mental state. Life becomes very simple and deliberate.
It's a radical departure from real life.
So that (and a month's worth of e-mail) is making it
difficult to get back in the saddle. Plus, there is
the added pressure of people expecting interesting
stories to come out of this experience.
All I can tell you at the moment is that I am working
on it, but I am still struggling to get out of the
"Dick and Jane walked, and walked, and walked" mode
of storytelling. But, stayed tuned. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: widget_list() question [message #72449 is a reply to message #72448] |
Fri, 10 September 2010 04:02  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Sep 9, 8:47 pm, David Fanning <n...@dfanning.com> wrote:
> [...] you should write an "object-widget"
> Good luck! We will be happy to use it when you are
> finished with it. :-)
Me too please!
>
> Cheers,
>
> David
Welcome back, David!
How was Oregon?
Did I miss the "I'm back!" post, or did you sneak in quietly while no-
one was looking? :-)
Regards,
Chris
|
|
|
Re: widget_list() question [message #72458 is a reply to message #72449] |
Thu, 09 September 2010 12:47  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
> I am putting together a little display tool where I would like to keep track of datafiles I have been using/displaying.
> I want all the filenames for the session to be visible, as well as selectable so I can "flip" between files (all of the
> data from the files are kept in an IDL_Container object.)
>
> So what I want to be able to do is:
> 1) create an empty list widget.
> 2) append new filenames to the list as they are read in. (e.g. "widget_control, id, append_value = filename" type of thing)
> 3) retrieve the list of all the filenames, or just the currently selected one.
> 4) retrieve the position in the list of the currently selected entry (I think I know how to do that already).
>
> I thought I could use a regular old WIDGET_LIST() to do this but it appears to be quite difficult to concatenate values
> in an already existing list, to say nothing of retrieving the list of string values in the list. I gather I'll need to
> use the FUNC_GET_VALUE keyword, but how does one construct a function to retrieve the list contents? (The documentation
> didn't point to any examples that I could find)
These are call-back routines, meaning that they are called
(like the CLEANUP call-back routine) with the first positional
parameter being the ID of the widget whose value you are trying
to set.
PRO MySetValue, id, value
END
FUNCTION MyGetValue, id
RETURN, value
END
Naturally, you don't call them, IDL does, typically:
Widget_Control, myWidgetID, SET_VALUE=thisValue
Widget_Control, myWidgetID, GET_VALUE=someValue
You might get some sense of this by looking at CW_DrawColor:
http://www.dfanning.com/programs/cw_drawcolor.pro
> I guess the question I'm asking is if widget_list() can handle this sort of functionality, or do I need to construct my
> own compound widget to do the job?
>
> Alternatively, should I just keep track of stuff in my own (already existing) file_list container and simple recreate
> the list from scratch everytime something changes? (Seems a bit bull-in-a-china-shop'ish)
Uh, this is IDL we are talking about, right!? It's going
to be a bit bull-in-a-china-shop'ish. In fact, it's likely
to be a LOT more work than you were planning to do today. :-)
I think you are going to have to write some kind of a
compound widget, since list widgets don't (for some
inexplicable reason) actually *have* a value:
http://www.dfanning.com/widget_tips/listselection.html
Naturally, I think you should write an "object-widget"
since those are a great deal more flexible than a regular
compound widget (see the example above), but it's up to you.
It's a day's worth of programming, probably, in either case.
I think you are going to have to destroy and recreate
the list widget when you change its contents. Whether
you can do that in a non-intrusive way without a lot
of flashing going on depends on things that may be
outside of your control, although I would certainly
try to turn the UPDATE keyword on and off for the
TLB when you try to do these things. Occasionally,
I have been successful with this technique, although
not always.
Good luck! We will be happy to use it when you are
finished with it. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: widget_list() question [message #72459 is a reply to message #72458] |
Thu, 09 September 2010 12:32  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
I just read "Returning LIST widget values" on the Coyote website. That answers part of my question regarding retrieving
the values.
And the "dynamic_menus.pro" example of the same pretty much answers the rest.
Apologies for the noise....
cheers,
paulv
Paul van Delst wrote:
> Hello,
>
> I am putting together a little display tool where I would like to keep track of datafiles I have been using/displaying.
> I want all the filenames for the session to be visible, as well as selectable so I can "flip" between files (all of the
> data from the files are kept in an IDL_Container object.)
>
> So what I want to be able to do is:
> 1) create an empty list widget.
> 2) append new filenames to the list as they are read in. (e.g. "widget_control, id, append_value = filename" type of thing)
> 3) retrieve the list of all the filenames, or just the currently selected one.
> 4) retrieve the position in the list of the currently selected entry (I think I know how to do that already).
>
> I thought I could use a regular old WIDGET_LIST() to do this but it appears to be quite difficult to concatenate values
> in an already existing list, to say nothing of retrieving the list of string values in the list. I gather I'll need to
> use the FUNC_GET_VALUE keyword, but how does one construct a function to retrieve the list contents? (The documentation
> didn't point to any examples that I could find)
>
> I guess the question I'm asking is if widget_list() can handle this sort of functionality, or do I need to construct my
> own compound widget to do the job?
>
> Alternatively, should I just keep track of stuff in my own (already existing) file_list container and simple recreate
> the list from scratch everytime something changes? (Seems a bit bull-in-a-china-shop'ish)
>
> Any info/hints appreciated.
>
> cheers,
>
> paulv
|
|
|