associated variables in structures [message #11206] |
Sat, 07 March 1998 00:00 |
Jacobus Koster
Messages: 3 Registered: February 1998
|
Junior Member |
|
|
Wizards,
I've run into a problem with structures and associated variables, and I
CANNOT be the first person to see this. Here's why :
I have a big datafile, consisting of 96 images, each 128x128 integers.
I'd like to have a widget event handler select an individual image. So
I'd like to store the image as an element of the well-known base-widget
user value, widely named 'info'. But, apparently IDL 5.0 will not let me
define an (anonymous) structure which has an associated variable in one
of the fields.
I realize that a pointer to this associated variable is most likely the
ultimate answer to this problem and a host of other ones. I haven't
tried this yet so I don't know about any problem I might encounter
there. I just want to expand my understanding of associated variables,
and also I'd like to see if there are other answers. ( I admit there's
only so much you can say about something as simple as associated
variables but they're so darn useful I wish RSI would devote a little
more than 4-6 pages per 6 manuals to this subject, even if they were
only filled with examples)
Here's a short program with output, just in case I've got this figured
totally wrong. If you remove the data:dat[0] line you get the same error
message.
And by the way, I just discovered I can't copy text from my status
window to another editor (running under Windows 95). Can you spell
"FEATURE REQUEST", RSI ? Please ? Program output is just about the most
useful information in debugging, and you don't want to read someone's
typos there, I think.
pro assoct
close,1
openr,1,'E:\myfile.img'
dat = ASSOC(1,INTARR(128,128),96)
help,dat,/st
info = {data:dat[0], $
images : dat }
close,1
end
DAT INT = File<E:\myfile.img> Array[128,128]
% File expression not allowed in this context: DAT
% Execution halted at: ASSOCT 7:\E:\RSI\IDL50\assoct.pro
% $MAIN$
|
|
|