Re: Conflicting Data structures [message #15931] |
Sun, 27 June 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dirk Fabian (dirk@uwast.astro.wisc.edu) writes:
> Now! I have a widget that allows a user to select an ascii data file and read
> it into a structure. Lets say widget#2 queries that structure and performs some
> operations based on the data, and then widget#2 is destroyed.
>
> Ideally, i would like the user (me) to be able to choose a new data file, read it
> in, and query it, but i keep get the conflicting data structures error. Even
> if i exit the program and rerun it, it seems like that structure is still hanging
> around. I can't figure out how or where to zero it out! What am i missing?
Any field in a structure that is going to have the type
or size of the information stored there changing from
time to time should be implemented as a pointer. This
is *especially* true for the data fields if you intend to
allow the user to read new data sets.
info = { data: Ptr_New(real_data), ... }
Then, to use the data:
Plot, *info.data
Be sure to destroy the pointer in your CLEANUP routine
when the widget program is destroyed:
Ptr_Free, info.data
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|