Re: Problem with pointers to structures [message #38662 is a reply to message #38657] |
Wed, 17 March 2004 14:51  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
"Tianle Yuan" <tianle@rac3.wam.umd.edu> wrote in message
news:c3aho3$8fj$1@grapevine.wam.umd.edu...
> This bothers me for quite a while and I still can't figure out why it
doesn't work.
>
> Pro A
> .
> .
> str = {f1:..,f2:..,...}
> str_ptr = ptr_new(str)
> .
> .
> widget_control,...,set_uvalue = str_ptr
> .
> .
> end
>
> Pro A_sub,event
> .
> widget_control,...,get_uvalue= str_ptr
> temp = *str_ptr
> temp.f1 = ...
>
> end
>
> When I excute it, it says 'expression must be a structure in this
> context:temp'. But according to Gumley's book, this should work fine.
> Any comments?
When implemented correctly, as shown in the example programs in the book
(e.g., wgetname.pro and wpaint.pro in Chapter 9), this technique works just
fine.
If this technique does not work in your code, I suspect there is something
wrong with your code. However, you have not provided enough of your code for
inspection. You might want to try shortening your program to the minimum
number of lines that reproduces the error. This process may well fix the bug
in your code. Otherwise, post the entire program in your next message.
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|