Re: getting/setting value of unknown tag of structure??? [message #7652] |
Wed, 18 December 1996 00:00 |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
Well, it seems to me you're creating trouble for yourself
by allowing the user to create structures like this
(and the IDL code you wrote doesn't quite work as it stands
on my system), but...
text = 'mystruct.'+thetagis+' = ''THE NEW VALUE'''
test = execute(text)
... should work
Tim
Hendrik Roepcke wrote:
>
> Hello,
>
> imagine the little program:
>
> pro problem
> read,mytagname,prompt="Enter Tagname: "
> read,myvalue,prompt="This into it: "
>
> mystruct=create_struct([mytagname,'test'],[myvalue,myvalue])
>
> ; this is easy and works
> print,mystruct.test
>
> ; but how to get the myvalue via the first tagname?
> print,mystruct.????
>
> ; ok, i can fetch it via tag_names:
> thetagis=tag_names(mystruct)
> thetagis=thetagis(0)
>
> print,thetagis
>
> ; and my main problem is: how to set the unknown tag?
>
> mystruct.???='THE NEW VALUE'
>
> end
>
> OK, any help needed...
>
> Panther
>
> PS: greetings to the housekeeper of wayward inodes...
>
> --
> Panther in the Jungle __..--''``\--....___ _..,_
> -BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
> http://www.ang-physik _.-' _..--.'_ \ `(^) )
> .uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
|
|
|