| Re: associated variables in structures [message #11205 is a reply to message #11192] |
Sat, 07 March 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Jacobus Koster (nosuch@ix.netcom.com) writes:
> Wizards,
Reminds me of the Lord of the Rings trilogy I took a year
to read to my oldest son... :-)
> I've run into a problem with structures and associated variables, and I
> CANNOT be the first person to see this.
> {snip]
> But, apparently IDL 5.0 will not let me
> define an (anonymous) structure which has an associated variable in one
> of the fields.
No, indeed. An associated variable is not really, ...well, a
variable. It is more of a mapping than a variable. It maps
some kind of an organization onto a file in a way that makes
it *appear* to be a variable.
It would be hard to stick something like this into a field
of a structure, because a structure, after all, has to know
something about what is inside it. Or, in other words, it has
to know how BIG something is. And an associated variable isn't
big at all (although the file it maps may be big). I'm sure
there must be some incantation somewhere to tell you what an
associated variable is (internally, I mean), but I doubt you
and I would be privy to it.
In any case, you don't need it. You can conjure your way
around it.
What you want to carry around in your info structure is the
logical unit number of the file that is mapped to the associated
variable. Then, in your event handler you s-s-s-s-imply
recreate your mapping. Like this if you know what it is
going to be (as you apparently do):
thisVariable = ASSOC(info.lun, IntArr(128, 128))
Now you can read away to your hearts content!
(No need to specify how many images are in the file, by the way.
Associated variables don't need to know, nor do they care, how
big the actual file is. And please don't hard code your logical
unit numbers. The dark side lies in wait, look for ways to
spoil your programs. This is one of their favorites methods.)
OpenR, lun, filename, /Get_Lun
May dwarfs and elves appear in your dreams. :-)
Strider
|
|
|
|