Re: Problem with pointers to structures [message #38657] |
Wed, 17 March 2004 23:39  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Tianle Yuan wrote:
> 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?
>
> -TL
>
You did not have said what you like to put on temp.f1
IDL> str={f1:1,f2:2}
IDL> ptr=ptr_new(str)
IDL> temp=*ptr
IDL> help,temp,/str
** Structure <82e79ec>, 2 tags, length=4, data length=4, refs=3:
F1 INT 1
F2 INT 2
IDL> temp.f1=10
IDL> PTR_FREE,ptr
Please try this! Does this work?
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
|
|
|