cgWindow - what am I doing wrong that makes winID change values? [message #91219] |
Wed, 17 June 2015 14:54  |
BLesht
Messages: 89 Registered: March 2007
|
Member |
|
|
I clearly don't understand the winID feature of Coyote graphics. This keyword is supposed to make it possible to direct graphics commands to different previously opened windows (winid = [the identifier of the window you want]). I'm finding, however, that the act of directing a graphics command to a window seems to change its winID. Consider the following example (IDL8.2, MacOSX10.8.5, Coyote graphics revision 1540):
IDL> cgWindow, wTitle = 'Window 1' ; Open the first window
IDL> w1ID = cgQuery(/Current) ; Determine its ID number
IDL> PRINT, w1ID ; Yup, it's 32
32
IDL> cgWindow, wTitle = 'Window 2' ; Open another window
IDL> w2ID = cgQuery(/Current) ; Get its ID number
IDL> PRINT, w2ID ; This one is 33
33
IDL> PRINT, w1ID ; The first ID still is 32
32
IDL> cgWindow, 'cgPlot', [0,10], [0,10], winID=w1ID, /AddCmd ; Plot something
IDL> PRINT, w1ID ; Oops - what happened to w1ID?
0
IDL> cgWindow, 'cgPlot', [0,10], [0,10], winID=w2ID, /AddCmd ; Try window 2
IDL> PRINT, w2ID
1 ; Same problem
Could this have something to do with giving the window titles? Seems strange to me. Thanks for any insights.
Barry
|
|
|
|
Re: cgWindow - what am I doing wrong that makes winID change values? [message #91229 is a reply to message #91219] |
Thu, 18 June 2015 07:51   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Barry Lesht writes:
> I clearly don't understand the winID feature of Coyote graphics. This
keyword is supposed to make it possible to direct graphics commands to
different previously opened windows (winid = [the identifier of the
window you want]). I'm finding, however, that the act of directing a
graphics command to a window seems to change its winID. Consider the
following example (IDL8.2, MacOSX10.8.5, Coyote graphics revision 1540):
>
> IDL> cgWindow, wTitle = 'Window 1' ; Open the first window
> IDL> w1ID = cgQuery(/Current) ; Determine its ID number
> IDL> PRINT, w1ID ; Yup, it's 32
> 32
> IDL> cgWindow, wTitle = 'Window 2' ; Open another window
> IDL> w2ID = cgQuery(/Current) ; Get its ID number
> IDL> PRINT, w2ID ; This one is 33
> 33
> IDL> PRINT, w1ID ; The first ID still is 32
> 32
> IDL> cgWindow, 'cgPlot', [0,10], [0,10], winID=w1ID, /AddCmd ; Plot something
> IDL> PRINT, w1ID ; Oops - what happened to w1ID?
> 0
> IDL> cgWindow, 'cgPlot', [0,10], [0,10], winID=w2ID, /AddCmd ; Try window 2
> IDL> PRINT, w2ID
> 1 ; Same problem
>
> Could this have something to do with giving the window titles? Seems strange to me. Thanks for any insights.
You can find an updated and fixed version of this program here:
http://www.idlcoyote.com/programs/cgwindow.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|