Re: HELP! Annoying IDL glitches... [message #6225 is a reply to message #6224] |
Thu, 16 May 1996 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
deb <summa@lanl.gov> wrote:
> 2. Why does XLOADCT update color tables in real time on the Mac
> but not on the PC?
You probably are using a PC display driver with more than 256 colors.
The same thing happens on my SGI workstation when I run it in 24 bit mode.
Try the following commands on the PC immediately after you start IDL:
device, pseudo=8
window, 0, colors=256
print, d.n_colors
> 5. Can one open a single (large) graphics window with scroll bars?
> (Not the same as the SLIDE_IMAGE command, but along the lines of the
> scroll window which is incorporated into that)
base = widget_base()
xsize = 1024 & ysize = 1024 & x_scroll_size = 512 & y_scroll_size = 512
draw = widget_draw( base, xsize = xsize, ysize = ysize, $
x_scroll_size = x_scroll_size, y_scroll_size = y_scroll_size )
widget_control, base, /realize
widget_control, draw, get_value = window_id
> 6. Suppose one opens a datafile which contains an ascii header and then
> a bunch of binary junk which ends in an ascii-readable tag. Following
> the header is a bunch of binary data. I'd like to piece thru the file
> until i find the final ascii-readable tag which denotes the start of the
> actual data.
Try the following with your own ASCII string tags:
function findtag, file, string
; Return the start byte of the first occurence of
; a string within a file. Return value is -1 if
; the string is not found.
; read the entire data file as a byte array
openr, lun, file, /get_lun
info = fstat( lun )
data = bytarr( info.size )
readu, lun, data
free_lun, lun
; convert string to a byte tag
tag = byte( string )
tagsize = n_elements( tag )
if tagsize lt 1 then goto, finish
; find first occurence of tag within data
loc = where( data eq tag( 0 ), count )
start = -1
if count lt 1 then goto, finish
for i = 0, count - 1 do begin
byte1 = loc( i )
byte2 = byte1 + tagsize - 1
compare = data( byte1 : byte2 ) - tag
tmploc = where( compare eq 0B, null )
if null eq tagsize then begin
start = byte1
goto, finish
endif
endfor
finish:
return, start
end
|
|
|