Re: bug in idl5.03 [message #11405] |
Tue, 07 April 1998 00:00 |
Harald Frey
Messages: 41 Registered: March 1997
|
Member |
|
|
R. Bauer wrote:
> Hi
>
> I found a new bug in idl5.03 especially for aix
>
> IDL> help,!version,/str
> ** Structure !VERSION, 5 tags, length=40:
> ARCH STRING 'ibmr2'
> OS STRING 'AIX'
> OS_FAMILY STRING 'unix'
> RELEASE STRING '5.0.3'
> BUILD_DATE STRING 'Nov 3 1997'
>
> The error occurs by creating of a defined window size
>
> window,xsize=32,ysize=32
> size=tvrd()
> % X windows protocol error: BadMatch (invalid parameter attributes).
> help,size
> size BYTE = Array[92, 32]
>
> on a pc/win idl5.03 version this size is [32,32]
>
>
I would never name a variable "size" because this is an intrinsic IDL
command.
Harald Frey
SSL
UC Berkeley
>
|
|
|
Re: bug in idl5.03 [message #11418 is a reply to message #11405] |
Mon, 06 April 1998 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
R. Bauer wrote:
>
> Hi
>
> I found a new bug in idl5.03 especially for aix
>
> IDL> help,!version,/str
> ** Structure !VERSION, 5 tags, length=40:
> ARCH STRING 'ibmr2'
> OS STRING 'AIX'
> OS_FAMILY STRING 'unix'
> RELEASE STRING '5.0.3'
> BUILD_DATE STRING 'Nov 3 1997'
>
> The error occurs by creating of a defined window size
>
> window,xsize=32,ysize=32
> size=tvrd()
> % X windows protocol error: BadMatch (invalid parameter attributes).
> help,size
> size BYTE = Array[92, 32]
>
I get this same error only if I iconify the window first. You can
avoid this error (at least in our configuration) by using the
DEVICE, COPY=[] function to read from a window into a pixmap first,
and then calling TVRD() to read from the pixmap. I have written
SAFE_TVRD.PRO which does just this. Obviously it will be a bit
slower than TVRD, but it works! This is actually a very old bug!
IDL> help, !version, /struct
** Structure !VERSION, 5 tags, length=40:
ARCH STRING 'sparc'
OS STRING 'sunos'
OS_FAMILY STRING 'unix'
RELEASE STRING '5.0.3'
BUILD_DATE STRING 'Nov 3 1997'
Below is SAFE_TVRD.PRO. Watch for wrapping!
Dave
---------- SAFE_TVRD.PRO ---------------------------------------------
; SAFE_TVRD.PRO 6-11-97 DSFoster
;
; This function is a safer version of IDL's TVRD() function. First,
; there was a bug related to the reading from a scrollable draw. Also,
; the TVRD() function uses an X routine that has problems if the
; window is obscured or iconified. This routine uses the DEVICE, COPY=
; command to first copy the window contents to a new window pixmap,
; and then reads from this pixmap into the array.
;
; Usage: Array = SAFE_TVRD( Draw_widget )
;
; Modifications
;
; 6-11-97 DSF Check validity of draw widget.
FUNCTION safe_tvrd, draw_widget, xsize, ysize
on_error, 2
if (widget_info(draw_widget, /valid_id) eq 0) then begin
return, -1
endif else if (widget_info(draw_widget, /name) ne 'DRAW') then begin
return, -1
endif else begin
old_window = !d.window
window, xsize=xsize, ysize=ysize, /free, /pixmap ; Create
new window
widget_control, draw_widget, get_value=window
device, copy=[0,0, xsize,ysize, 0,0, window] ; Copy into
new window
image = tvrd() ; Read into
array
wdelete, !d.window
if (old_window ne -1) then wset, old_window
return, image
endelse
END
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|