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

Home » Public Forums » archive » Re: Object SetProperty Not inherited
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Object SetProperty Not inherited [message #78863] Thu, 05 January 2012 09:15
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> SetProperty and GetProperty methods must be implemented explicitly.
> They do this "magically" only in marketing literature. :-)

Mark Piper shows a "semi-magical" way of handing these
methods in his IDL Data Point blog this morning, with
a guest post by Ron Kneusel.

http://idldatapoint.com/

Having done some pioneering work in this area myself,
I just offer a word of warning. Sometimes the more
elaborate the trick, the more fragile the end program
becomes. ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Object SetProperty Not inherited [message #78866 is a reply to message #78863] Thu, 05 January 2012 07:45 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
godber writes:

> Do they have to be implemented to explicitly return the properties as you show in your book?
> I had hoped it would inherit a generic getter and magically do it.

SetProperty and GetProperty methods must be implemented explicitly.
They do this "magically" only in marketing literature. :-)

> Thanks for your reply, your book, and your continuous attention to IDL.

I appreciate the kind words. Thank you.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Object SetProperty Not inherited [message #78869 is a reply to message #78866] Wed, 04 January 2012 19:31 Go to previous message
godber is currently offline  godber
Messages: 4
Registered: January 2012
Junior Member
Do they have to be implemented to explicitly return the properties as you show in your book? I had hoped it would inherit a generic getter and magically do it. If not, I guess I will look into implementing one. I will start looking for some introspective functionality.

Thanks for your reply, your book, and your continuous attention to IDL.

Austin
Re: Object SetProperty Not inherited [message #78870 is a reply to message #78869] Wed, 04 January 2012 17:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
godber writes:

> Using IDL 8.1 I am having a hard time setting properties on objects as the documentation suggests I can. Using the sample object from the documentation:
>
> PRO myObjectClass__define
> structure = { myObjectClass, $
> PROPERTY1: 0L, $
> PROPERTY2: '', $
> INHERITS IDL_Object $
> }
> END
>
> I then instantiate and try to set a property as follows and I get an undefined method error
>
> IDL> o = Obj_New('myobjectclass')
> % Compiled module: MYOBJECTCLASS__DEFINE.
> IDL> o.property2 = 'foo'
> % Attempt to call undefined method: 'MYOBJECTCLASS::SetProperty'.
> % Execution halted at: $MAIN$
>
> The documentation suggests that subclassing IDL_Object should make using the dot operator possible:
>
> "If your object inherits from the IDL_Object class, you can set or change the object's properties after object initialization by calling the property directly using the dot operator:
>
> Obj.PROPERTY = value, ...
> "
>
> What am I missing?

You have to write the SetProperty and GetProperty methods
for this object class. Then, you can use the "dot" operators
to call the methods like you are doing.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL
Next Topic: IDL help online

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

Current Time: Wed Oct 08 13:31:17 PDT 2025

Total time taken to generate the page: 0.00575 seconds