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

Home » Public Forums » archive » WIDGETS
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
WIDGETS [message #2717] Tue, 30 August 1994 10:23 Go to next message
mallozzi is currently offline  mallozzi
Messages: 60
Registered: August 1994
Member
I recently began to use IDL WIDGETS (on DEC ALPHA) and I have a minor problem: I created a base WIDGET with multiple editable text children to be used as
an editable menu. I invoke the WIDGET and register it with XMANAGER, with
the keyword JUST_REG. When I want control of the WIDGET, I type XMANAGER,widget_id. The problem is as follows: I want to be able to desensitize some of the children, so the user can only alter a single menu entry (I am running a complicated IDL code concurrently). I thought I could destroy the WIDGET and rebuild it with only one child sensitive. Is this possible, or is there a more appropriate method? Thanks -Bob
Re: Widgets [message #2754 is a reply to message #2717] Thu, 22 September 1994 21:05 Go to previous messageGo to next message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <35ia3e$iku@hammer.msfc.nasa.gov> mallozzi@ssl.msfc.nasa.gov writes:
> Does anyone know how to insert large blocks of text into a text widget?
> Specifically, I want to make a help option for a widget driven program,
> and the IDL help widget is exactly like what I want. I tried setting the
> value of WIDGET_TEXT to be a *large* string array, but I got compilation
> errors (too many elements to concatenate...). Also, the widget didn't
> seem to know the correct size to make itself, and setting the size explicitly
> produced unexpected results (for example, setting XSIZE to be
> 0.5 * CURRENT_SCREEN(0) made the widget much larger than the screen).

A good place to look for answers to questions of this type is the IDL
source files provided with the widget examples. Many of those examples
have large help files and I am sure the solution to your question is to
be found there.



--
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave.
Re: Widgets [message #2777 is a reply to message #2717] Sun, 18 September 1994 23:50 Go to previous messageGo to next message
rouse is currently offline  rouse
Messages: 17
Registered: July 1994
Junior Member
Try using a widget_list instead. It's value would be your help text
stored as a string array - one line per array element. If the number
of lines exceeds your default YSIZE then you get a scroll bar automatically.

- Roger
Re: WIDGETS [message #2888 is a reply to message #2717] Thu, 01 September 1994 14:03 Go to previous messageGo to next message
peter is currently offline  peter
Messages: 80
Registered: February 1994
Member
Joseph M Zawodny (zawodny@arbd0.larc.nasa.gov) wrote:
: No, no, no! You should avoid using common blocks in widget programming. I
: sense and desense widgets of all sorts routinely. My personal preference
: is to create a structure with one of the fields set to be a long integer
: array and I store the widget id's of the widgets I need to manipulate or
: (de)sensitize in this array (the structure is required only if you need to
: pass other data besides the widget id's). That way a simple

: widget_control,event.id,get_uvalue=array

But how do you sensitize/desensitize a widget that you didn't get an
event from? Suppose I perform an action that requires, say, the fields
in another base widget to change. I have to have their widget IDs, so
I need a common block, unless I store all of them in the uvalue of
every widget that might require them to change (which seems a little hard to
maintain (ah, the quick and dirty programming thread again!)).

: statement gets the info I need without using common blocks. The problem is
: that you might have multiple versions of the same widget running
: concurrently. If you do and use common blocks to pass data between
: widgets, the common blocks can (and do) get scrambled.

This is a problem -- I've only ever written applications where unique
instances of widgets are allowed, in which case a common block to hold
widget IDs, and another one to hold the panel state (i.e. the values of
variables that affect that panel) seems to work very well indeed.

Peter
Re: WIDGETS [message #2895 is a reply to message #2717] Thu, 01 September 1994 10:30 Go to previous messageGo to next message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <344g63$b8r@sun4.bham.ac.uk> sjt@xun8.sr.bham.ac.uk (James Tappin) writes:
> mallozzi@ssl.msfc.nasa.gov wrote:
> : I recently began to use IDL WIDGETS (on DEC ALPHA) and I have a minor
> : problem: I created a base WIDGET with multiple editable text children
> : to be used as
> : an editable menu. I invoke the WIDGET and register it with XMANAGER, with
> : the keyword JUST_REG. When I want control of the WIDGET, I type
> : XMANAGER, widget_id. The problem is as follows: I want to be able to
> : desensitize some of the children, so the user can only alter a single
> : menu entry (I am running a complicated IDL code
> : concurrently). I thought I could destroy the WIDGET and rebuild it with
> : only one child sensitive. Is this possible, or is there a more
> : appropriate method? Thanks -Bob
>
> If you save the ID's of the widgets which you want to change in a common
> block, then you can just use WIDGET_CONTROL, SENSITIVE=1 (or 0) to
> (de)sensitize the relevant widgets.
>
> --
> James Tappin,

No, no, no! You should avoid using common blocks in widget programming. I
sense and desense widgets of all sorts routinely. My personal preference
is to create a structure with one of the fields set to be a long integer
array and I store the widget id's of the widgets I need to manipulate or
(de)sensitize in this array (the structure is required only if you need to
pass other data besides the widget id's). That way a simple

widget_control,event.id,get_uvalue=array

statement gets the info I need without using common blocks. The problem is
that you might have multiple versions of the same widget running
concurrently. If you do and use common blocks to pass data between
widgets, the common blocks can (and do) get scrambled.

--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: zawodny@arbd0.larc.nasa.gov MS-475, Hampton VA, 23681-0001
TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa
Re: WIDGETS [message #2899 is a reply to message #2717] Thu, 01 September 1994 05:07 Go to previous messageGo to next message
sjt is currently offline  sjt
Messages: 72
Registered: November 1993
Member
mallozzi@ssl.msfc.nasa.gov wrote:
: I recently began to use IDL WIDGETS (on DEC ALPHA) and I have a minor
: problem: I created a base WIDGET with multiple editable text children
: to be used as
: an editable menu. I invoke the WIDGET and register it with XMANAGER, with
: the keyword JUST_REG. When I want control of the WIDGET, I type
: XMANAGER, widget_id. The problem is as follows: I want to be able to
: desensitize some of the children, so the user can only alter a single
: menu entry (I am running a complicated IDL code
: concurrently). I thought I could destroy the WIDGET and rebuild it with
: only one child sensitive. Is this possible, or is there a more
: appropriate method? Thanks -Bob

If you save the ID's of the widgets which you want to change in a common
block, then you can just use WIDGET_CONTROL, SENSITIVE=1 (or 0) to
(de)sensitize the relevant widgets.

--
James Tappin, School of Physics & Space Research
University of Birmingham
sjt@xun8.sr.bham.ac.uk
"If all else fails--read the instructions!"

O__
-- \/`
Re: Widgets [message #5706 is a reply to message #2717] Wed, 07 February 1996 00:00 Go to previous messageGo to next message
offenbrg is currently offline  offenbrg
Messages: 31
Registered: August 1993
Member
Thierry <thierrya@so.estec.esa.nl> writes:

> Would anyone of you have a widget that allows to look at
> a graph interactively (Such for Igor Pro or Kaleida graph).

> I come from the Mac environment and although I found IDL
> extremly elegant, the building blocks looks more like Lego
> bricks than usable Lego construction, i.e. it is a pain
> to write widgets...


I wrote a widget routine called "pubplot" many moons ago that
would do some of what you want...

It is available by anonymous ftp from idlastro.gsfc.nasa.gov in
/pub/contrib/offenberg.

Also, there is an IDL routine called PWIDGET in the user library which
does some of this as well.

Good luck!

Joel
--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ ----------
| Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov |
| Hughes STX, NASA/GSFC/LASP | I get paid to stare into space. |
Re: Widgets [message #5707 is a reply to message #2717] Wed, 07 February 1996 00:00 Go to previous messageGo to next message
todd is currently offline  todd
Messages: 25
Registered: February 1994
Junior Member
I don't know exactly how interactive it is, but the new version of
PV-WAVE (6.0 I believe) has a widget-based interface that lets you
do point and click type manipulations to plots (axes, labels, ticks,
etc), images and other stuff. We haven't installed it yet so I can't
vouch for its usefulness but I have seen it demo-ed at a conference and
it looks promising.

--

Todd Ratcliff | (310)825-3118
UCLA Geodynamics Research Group | todd@artemis.ess.ucla.edu
Dept. of Earth & Space Sciences | http://artemis.ess.ucla.edu/~todd/home.html
Re: Widgets [message #17279 is a reply to message #2717] Sun, 03 October 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Robert LeeJoice (leejoice@msn.com) writes:

> Question for Widget Gurus: Can I put Widget creation items in an event
> procedure? I want to be able to able to have a menu item open a new window
> that consists of a table to display some data. I have put the following in
> and it seems to work, but I'm concerned about how xmanager sees/doesn't see
> this since the widget statements are not in the "Widget Definition file".
> Is it okay and prudent to do this? I assume as long as there are no
> event_procedures in the code?

It is perfectly acceptable to do this. No need to worry
about XMANAGER if this widget won't be generating any
events and you have made sure it gets destroyed when
the program that calls it gets destroyed by making
it a member of the group.

No need for any Hail Marys in this case. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Widgets [message #17285 is a reply to message #2717] Fri, 01 October 1999 00:00 Go to previous messageGo to next message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Robert LeeJoice wrote:
> Question for Widget Gurus: Can I put Widget creation items in an event
> procedure? I want to be able to able to have a menu item open a new window
> that consists of a table to display some data. I have put the following in
> and it seems to work, but I'm concerned about how xmanager sees/doesn't see
> this since the widget statements are not in the "Widget Definition file".
> Is it okay and prudent to do this? I assume as long as there are no
> event_procedures in the code?

Robert,

Anytime you create a new window, the best approach is to create a
separate program to create the widgets in the window and manage events.
For example:

Main program
- Create widgets
- Manage events
- If new window is requested, call new window program

New window program
- Create widgets
- Manage events

Here's an example which creates a simple launcher for XLOADCT, which is
a separate program (see the lib directory in your IDL installation):

;---cut here---
PRO TEST_EVENT, EVENT

;- Get user value from the widget which caused the event

widget_control, event.id, get_uvalue=uvalue

;- Act on the user value

case uvalue of
'Color Table' : xloadct
else : print, 'Unrecognized widget event'
endcase

END

PRO TEST

;- Create widgets

base = widget_base(/column)
butt = widget_button(base, value='Color Table', uvalue='Color Table')
widget_control, base, /realize

;- Manage events

xmanager, 'test', base

END
;---cut here---

In the event handler procedure TEST_EVENT, XLOADCT is called if an event
is received from the 'Color Table' button. XLOADCT is written as a
separate main program so that it can be called from different modes,
such as the command line, or from within a widget program.

Even when you are creating a utility widget which is specific to your
application, it is still much better to code it as a separate IDL
program (like XLOADCT), because you can code and test it as a unit,
separate from the main program.

Cheers,
Liam.
Re: Widgets [message #17345 is a reply to message #2717] Thu, 07 October 1999 00:00 Go to previous messageGo to next message
Richard G. French is currently offline  Richard G. French
Messages: 65
Registered: June 1997
Member
> I got stuck on a couple legacy projects
> ^^^^^^^^^^^^^^^
I love that euphemism, 'legacy projects'! I have an ancient program I
wrote
in C about 15 years ago that I can't successfully port to a 64-bit
machine,
so I have to keep an old clunker decstation around just to be able to
run
that program! Anyone else out there ever have this kind of problem?
Kills
me. Today, I'd write the thing in IDL instead, but that would take
months.

Dick French
Re: Widgets [message #17363 is a reply to message #2717] Wed, 06 October 1999 00:00 Go to previous messageGo to next message
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article <OsNWZQBE$GA.242@cpmsnbbsa03>, "Robert LeeJoice"
<leejoice@msn.com> wrote:

> Thanks for the help! Arrgghh, there is so much IDL to know!
>
> Great book. I keep rereading the chapters. Guess I shouldn't feel to bad,
> I see that you started with IDL in 1987; I've been at it for a year!

Don't feel bad, Rob. I got stuck on a couple legacy projects in IDL and
missed the latest and greatest stuff with objects and graphics last year.
I'm sort of relearning IDL after using it since 1992. It's kind of like
being a cobol programmer who comes out of retirement to see all the new
ideas. Frustrating and exciting at the same time.

> David Fanning <davidf@dfanning.com> wrote in message
> news:MPG.12616db792faeb0498990c@news.frii.com...
>> Robert LeeJoice (leejoice@msn.com) writes:
>>
>>> Question for Widget Gurus: Can I put Widget creation items in an event
...
>>
>> It is perfectly acceptable to do this. No need to worry
...

--
Mike Schienle Interactive Visuals, Inc.
mgs@ivsoftware.com Remote Sensing and Image Processing
http://www.ivsoftware.com/ Analysis and Application Development
Re: Widgets [message #17365 is a reply to message #2717] Wed, 06 October 1999 00:00 Go to previous messageGo to next message
Robert LeeJoice is currently offline  Robert LeeJoice
Messages: 3
Registered: September 1999
Junior Member
Thanks for the help! Arrgghh, there is so much IDL to know!

Great book. I keep rereading the chapters. Guess I shouldn't feel to bad,
I see that you started with IDL in 1987; I've been at it for a year!

Rob LeeJoice


David Fanning <davidf@dfanning.com> wrote in message
news:MPG.12616db792faeb0498990c@news.frii.com...
> Robert LeeJoice (leejoice@msn.com) writes:
>
>> Question for Widget Gurus: Can I put Widget creation items in an event
>> procedure? I want to be able to able to have a menu item open a new
window
>> that consists of a table to display some data. I have put the following
in
>> and it seems to work, but I'm concerned about how xmanager sees/doesn't
see
>> this since the widget statements are not in the "Widget Definition
file".
>> Is it okay and prudent to do this? I assume as long as there are no
>> event_procedures in the code?
>
> It is perfectly acceptable to do this. No need to worry
> about XMANAGER if this widget won't be generating any
> events and you have made sure it gets destroyed when
> the program that calls it gets destroyed by making
> it a member of the group.
>
> No need for any Hail Marys in this case. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
Re: Widgets [message #17419 is a reply to message #2717] Sun, 10 October 1999 00:00 Go to previous messageGo to next message
Richard G. French is currently offline  Richard G. French
Messages: 65
Registered: June 1997
Member
David Fanning wrote:
>

> I think Dick is confusing IDL with the Interface Definition Language.
> I can't imagine it would ever take "months" to write a program
> in the IDL language usually referred to in this newsgroup. :-)
>
Thanks, David - just what I need is another project on my plate! That
old program was written using the 'curses' library in C - well-named, by
the way - and all of the plotting was done in tektronix mode. Oh, if
only there had been a mouse in those days! It took forever to write, but
we tested the devil out of it, and I can't stand the thought of going
through all that work again. SO much of the effort went into things we
don't care about now:
- limited memory (had to be done using overlays in 64 Kbyte chunks)
- limited disk space (had to run on total of 5 Mbytes)
- slow execution time
The result is that to handle all of those things, the computations had
to be
done in pieces and in a non-intuitive order. Going back to the drawing
board
and rewriting things would mean a complete overhaul, not just
translation of
loops into simple IDL statements. I'd be better off dropping the
workstation
off of a tall building and starting from scratch. If I break my leg and
am in
a body cast for six months, maybe I will do that!

Dick
Re: Widgets [message #17427 is a reply to message #2717] Sat, 09 October 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Richard G. French (rfrench@wellesley.edu) writes:

> I love that euphemism, 'legacy projects'! I have an ancient program I
> wrote in C about 15 years ago that I can't successfully port to a 64-bit
> machine, so I have to keep an old clunker decstation around just to
> be able to run that program! Anyone else out there ever have this
> kind of problem?

> Today, I'd write the thing in IDL instead, but that would take
> months.

I think Dick is confusing IDL with the Interface Definition Language.
I can't imagine it would ever take "months" to write a program
in the IDL language usually referred to in this newsgroup. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: widgets [message #21374 is a reply to message #2717] Fri, 18 August 2000 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Stuart Colley (src@star.ucl.ac.uk) writes:

> I've not really used widgets before, any suggestions on how the following
> task might be tackled would be appreciated. What I'd like to do is
> display an image, stored in an array size x by y, using say tvscl, then
> click on part of the image with the mouse and get x, y, and the value of
> the array at that location.
>
> Are there any routine(s) suited to this sort of task?

You can find a routine that does this associated with
this article on my web page:

http://www.dfanning.com/tips/read_pixel.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Widgets [message #30993 is a reply to message #2717] Thu, 30 May 2002 08:11 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Kenneth Mankoff" <mankoff@snoe.colorado.edu> wrote

> tabbed draw windows. I can see how this could be done quite easily
> with one WIDGET_DRAW (or multiple, each implementation has its own
> pros/cons), and a WIDGET_BUTTON with bitmap for each tab. But maybe
> this exists somewhere and I do not have to write it...

Ronn Kling has his "IDL widget Tab Base" for sale at:

http://www.kilvarock.com/software/softwareforsale.htm


-Rick
Re: Widgets [message #31000 is a reply to message #2717] Wed, 29 May 2002 11:24 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kenneth Mankoff (mankoff@snoe.colorado.edu) writes:

> I am wondering if some widgets exist beyond what I can find in the
> standard IDL library distribution. I would like to add the following
> functionality to my program:
>
> tabbed draw windows. I can see how this could be done quite easily
> with one WIDGET_DRAW (or multiple, each implementation has its own
> pros/cons), and a WIDGET_BUTTON with bitmap for each tab. But maybe
> this exists somewhere and I do not have to write it...

I've seen tabbed draw widgets in an application written by
one of RSI's crack IDL programmers (he might even contact
you privately if they haven't put that code under lock
and key). I guess it wouldn't be impossible to implement
if you have time on your hands and you don't have to worry
about paying the mortgage. Otherwise, I think there are
easier ways to implement multiple window functionality. :-)

> Another widget that would be nice is floating menus (i.e. right-click,
> or shift-click, or whatever anywhere in a WIDGET_DRAW window, and have
> a menu, with sub menus, etc. pop up).

These are called "shortcut" menu widgets and are available
in IDL 5.5.

> Also, I am planning on doing this: Creating hyper-link functionality
> in a WIDGET_TABLE.

Oh. Good luck!

> I am just getting into widget programming.

Well, you will *love* the table widget, then. :-)

> I understand all of the IDL
> widgets, but they are fairly basic. I know of lots of IDL
> libraries. I am looking for a library of compound widgets that I do
> not yet know about. The Coyote library has 4 or 5 (I am using 2), and
> the rest seem to be "widget program examples" more than usable
> "compound widgets"

Teach a man to fish... etc.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: widgets [message #45225 is a reply to message #2717] Fri, 19 August 2005 08:02 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
hernan writes:

> Como puedo hacer un widget que sume dos valores?

Como esto:

pro widget_sum_event, event

widget_control, event.top, get_uvalue = info
widget_control, info.text1, get_value=value1
widget_control, info.text2, get_value=value2
value = Float(value1[0]) + Float(value2[0])
widget_control, info.text, set_value = StrTrim(string(value),2)

end

pro widget_sum

;* Ingresamos la base de trabajo.
;* Creamos la primera entrada de datos
base_suma = widget_base(xsize = 300, ysize = 200)
eti1 = widget_label(base_suma, value = 'Ingrese el valor de a: ', $
xsize = 100, xoffset = 20, yoffset = 20)
text1 = widget_text(base_suma, value = '1', uvalue = 'uno', $
xoffset = 120, yoffset = 20, /editable)
;* Creamos la segunda entrada de datos
eti2 = widget_label(base_suma, value = 'Ingrese el valor de b: ', $
xsize = 100, xoffset = 20, yoffset = 60)
text2 = widget_text(base_suma, value = '1', uvalue = 'dos', $
xoffset = 120, yoffset = 60, /editable)
;* Creamos la salida de los datos
eti = widget_label(base_suma, value = 'La suma es: ', $
xsize = 100, xoffset = 20, yoffset = 100)
text = widget_text(base_suma, value = '1', $
xoffset = 120, yoffset = 100, /editable)
widget_control, base_suma, set_uvalue = 'text'
info = {text1:text1, text2:text2, text:text}
widget_control, base_suma, /realize, set_uvalue=info
xmanager, 'widget_sum', base_suma, /no_block
end

Salut,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: widgets
Next Topic: Sort without loops

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

Current Time: Wed Oct 08 13:46:25 PDT 2025

Total time taken to generate the page: 0.00901 seconds