comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Generating keyword parameters from strings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Generating keyword parameters from strings [message #67445 is a reply to message #67443] Wed, 22 July 2009 15:55 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
Eric Hudson wrote:
> Hi,
>
> I guess I was unclear, sorry.
>
> What I mean is that I want to take a string and turn it into a
> keyword. So continuing my above example:
>
>
> function GetProperty, object, propertyName
> ; The below line is pseudocode -- what I want
> object->GetProperty, 'propertyName'=value
> ; using execute I'd say:
> ; ok = execute('object->GetProperty, '+propertyName+'=value')
> ; but I'm wondering if there is another way to do this
> ; that will work when execute is forbidden
> return, value
> end
>
> pro TestGet
> myObj = obj_new('IDLgrPalette')
> myvalue = GetProperty(myObj,'N_COLORS')
> ; Should be functionally equivalent to
> ; myObj->GetProperty, N_colors=myValue
> end
>
> That is, my 'GetProperty' function has to take the string 'N_COLORS'
> and then call the GetProperty method using that STRING as a reference
> keyword. It is this functionality that I'm interested in (I'm just
> using GetProperty as an example).

I don't think this is possible without a) using EXECUTE or b) writing a
temporary IDL .pro file. I messed around with the REF_EXTRA keyword to
SCOPE_VARFETCH, but I couldn't get what you wanted.

Mike
--
www.michaelgalloy.com
Associate Research Scientist
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: rIDL
Next Topic: Generating keyword parameters from strings

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 01:03:57 PDT 2025

Total time taken to generate the page: 2.55598 seconds