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

Home » Public Forums » archive » How to pick a window?
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
How to pick a window? [message #23502] Thu, 25 January 2001 14:17 Go to next message
AM is currently offline  AM
Messages: 1
Registered: January 2001
Junior Member
Hi,
I am trying to find out which idl window I clicked on (ie, selected) if
I have a number of them on the screen. I want to feed that back into a
routine that then goes and does something depending on which window I
click on. I am using the "old fashioned" windows created with 'window',
rather than these new fangled "widget windows". Is here a solution or do
I have to use widgets? I am using idl 5.4 in a unix environment. Maybe I
can get the window manager to say something to idl?

Any ideas?
Thanks,
Andrew


Sent via Deja.com
http://www.deja.com/
Re: HOW [message #23516 is a reply to message #23502] Thu, 25 January 2001 08:50 Go to previous messageGo to next message
Todd Clements is currently offline  Todd Clements
Messages: 23
Registered: January 2001
Junior Member
davidf@dfanning.com (David Fanning) wrote:
>> I have 5.4 and am using 5.3 because of this gif problem. For the time
>> being
>> I don't need to use this trick but don't mind knowing more
> [snip...]
> I think even with my meager computer skills I could
> figure out how to move a file from the IDL 5.3 distribution
> over to the IDL 5.4 distribution. But I still think it
> is easier to switch to JPEG files. And, as an added bonus,
> the colors will be better and device-independent when you
> publish them on the web. :-)

Or, even better, switch to .png graphics. Unlike JPEGs, which will lose
information every time you open and save them, .png graphics, which IDL
supports in 5.4 (I don't know when they started support...) are like
GIFs, but without the copyright issues that forced RSI/Kodak to remove
gif support from IDL 5.4. And as for publishing them on the web, they
aren't as wide-spread as JPEG files, but the major browsers version 3.0
and over support them, which is >95% of your audience (and yes, I know
that some out there will say "what about that <5%, they deserve to be
recognized", but at some point, you have to go to the better standard
and hope people catch up).

Another interesting idea that I use is to write some scripts that will
use ghostscript to automatically convert a .ps file into, say, a PDF
which you can post on the web. This way you can still get vectorized
graphics (for simple plots), and you can produce it "directly" from IDL.

Todd
Re: How to pick a window? [message #23567 is a reply to message #23502] Tue, 30 January 2001 12:48 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
All I have to say is, a "smart" widget direct graphics window is very
simple to achieve.
The following "two-line" code easily sets the "pseudo"-DG window to have
focus. Since Andrew's windows will be created from some other code, it
is very easy to store instructions for plotting windows at the time of
their creation.
The basic idea of the example below is to make a window *act* when
clicked on, and keep it looking and behaving *exactly* as a standard DG
IDL window, to keep William happy and unaware :-) In my example, they
set focus to themselves and allow resizing. Just use "smart_w" instead
of "window, /free". That's it. Then use Plot, Oplot, Xyouts, Contour - whatever.

;********************
pro smart_w_event, event
widget_control, event.top, get_uvalue=win_id
wset, win_id
if tag_names(event, /STRUCTURE_NAME) EQ 'WIDGET_BASE' then $
widget_control, widget_info(event.id, /child), $
draw_xsize=event.x, draw_ysize=event.y
end
;********************
pro smart_w
top_base = widget_base(/kbrd_focus_event, /tlb_size_event)
draw = widget_draw(top_base, xsize=600, ysize=400, retain=2)
widget_control, top_base, /realize
widget_control, draw, get_value=win_id
widget_control, top_base, set_uvalue=win_id, $
tlb_set_title='IDL '+strcompress(win_id, /rem)
xmanager, 'smart_w', top_base, /no_block
end
;********************

Anyway, don't let the word "widget" scare you out of using IDL. Wait
till you get to objects :-)
Cheers,
Pavel

William Thompson wrote:
>
> Let me just say that if IDL were written as an environment where everything
> *had* to be done as a widget program, we probably would *not* be using IDL
> today. We'd be using something else more forgiving. And I say this as someone
> who's written a fair number of widget programs in his time.
>
> William Thompsonn
Re: How to pick a window? [message #23570 is a reply to message #23502] Tue, 30 January 2001 11:22 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
William Thompson (thompson@achilles.nascom.nasa.gov) writes:

> Let me just say that if IDL were written as an environment where everything
> *had* to be done as a widget program, we probably would *not* be using IDL
> today. We'd be using something else more forgiving. And I say this as someone
> who's written a fair number of widget programs in his time.

I wasn't trying to run down the general usefulness
of IDL as a programming language. I was just pointing
out that most of the graphics windows I get on my
display (from any number of applications) are
just a *tad* bit more intelligent than the
general run-of-the-mill IDL graphics window!

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: How to pick a window? [message #23616 is a reply to message #23502] Mon, 29 January 2001 00:20 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David Fanning wrote:
>
> Reimar Bauer (r.bauer@fz-juelich.de) writes:
>
>> ;+
>> ; NAME:
>> ; savesysvar
>> ;
>> ; PURPOSE:
>> ; saves the settings of the !p, !x, !y, !z system
>> ; variables in a structure
>
> I'd add the !Map system variable too, if I wanted
> a completely general solution. :-)
>
> Cheers,
>
> David
>

That's right,

thanks for the hint.

Reimar


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de

=============================================
a IDL library at ForschungsZentrum J�lich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: window menu / context menu
Next Topic: Re: COMMON block question

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

Current Time: Sat Oct 11 02:38:17 PDT 2025

Total time taken to generate the page: 0.16524 seconds