Re: IDL8 CWO issue [message #72493] |
Tue, 07 September 2010 09:25  |
Paul Adams
Messages: 1 Registered: September 2010
|
Junior Member |
|
|
On Sep 7, 8:10 am, Larry Kneller <larry.knel...@gmail.com> wrote:
> Hi All,
>
> I found this "bug" that appears in some of my code now, and describing
> it may be a little confusing.
> In what follows I refer to a function called "class_name()" that I use
> to create an instance of the class
> "class_name" that is defined in class_name__define.pro.
>
> I have a lot of object compound widgets where I make a function that
> (for clarity) has the same name as my compound widget class, and it
> returns the widget_id:
>
> id = class_name(obj=obj, etc)
>
> Here I use the keyword "obj" to get the instance of my class called
> "class_name" that is created
> in the obj_new('class_name',...) call in the widget creation function
> called "class_name".
>
> Now, in IDL8 when I call the widget_creation function "class_name",
>
> id=class_name(obj=obj,etc.)
>
> this is a direct call to "class_name::init" method in my
> class_name__define program, and if
> the call does not throw an error, instead of returning a widget id it
> returns and object reference!!!
>
> For now, my solution to deal with this is to keep the name of the
> widget creation function the same and
> change the name of the class to "class_name_class"
> so that my calls to the widget creation function (that are peppered
> throughout my applications)
> are left untouched and I can fix this in one place per incident.
>
> -Larry
Hi Larry,
It is the case that in IDL 8.0, the statements "o = class_name(...)"
and "o = OBJ_NEW("class_name",...)" are equivalent. However, in the
case where you have a function named "class_name" and a class named
"class_name", the function should take priority, so the behavior you
are describing is unexpected.
Is your function "class_name" defined in its own file,
"class_name.pro", and is it on your IDL_PATH?
Would it be possible for you to provide an example of failing code?
Thanks in advance,
Paul Adams
ITT VIS
|
|
|