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

Home » Public Forums » archive » Re: Whither Object
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: Whither Object [message #34630] Wed, 09 April 2003 21:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
M. Katz (MKatz843@onebox.com) writes:

> What is the best way to define a new object variable such that:
> A) if the object class exists, then it is loaded.
> B) if the object class is unknown then we return obj_new() or set a
> failure flag somehow.
>
> Given an object class name in a string, I'd like to make a flexible
> definition:
>
> a = obj_new("MyClass")
>
> Then if there is a myclass__define.pro, we assign the object,
> otherwise we assign obj_new().

I'd do something like this:

objectClass = "MyClass

filename = StrLowCase(objectClass) + "__define.pro"
IF File_Which(filename, /Include_Current_Directory) EQ "" THEN $
thisObject = Obj_New() ELSE thisObject = Obj_New(objectClass)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Previous Topic: Re: porting IDL code to OS X
Next Topic: Compound Widget and Event Handlers

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

Current Time: Wed Oct 08 16:57:05 PDT 2025

Total time taken to generate the page: 0.00208 seconds