Re: 2 little questions: (Object windows with widget_draw) AND (geting working directory) [message #37615] |
Wed, 07 January 2004 07:19 |
Nuno Oliveira
Messages: 75 Registered: October 2003
|
Member |
|
|
What a distraction! .
Maybe vacations produce a lazy head.
Thanks,
Nuno.
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a65d0147c60d242989795@news.frii.com...
> Nuno Oliveira writes:
>
>> I'm trying do work an object window created with widget draw. Seems to
me,
>> for what I have seen from the tutorial and programs distributed from
people
>> on this group, that I'm doing all the steps needed.
>>
>>
>>
>> I do something like this (omitting unnecessary code):
>>
>> Draw = WIDGET_DRAW(tlb, XSIZE=xsize, YSIZE=ysize, GRAPHICS_LEVEL=2)
>>
>> ;graphics_level=2 to set as object window
>> ;then .
>>
>> WIDGET_CONTROL_, draw, GET_VALUE=myWindow
>>
>> ;in this statement myWindow should now be an Window Object?
>>
>> ;assuming that I have a View with a lots of pretty things
>> ; I do
>>
>> myWindow->Draw, myView
>>
>> ;and this is the point where I get the error:
>>
>> ;MESSAGE: 'Unable to invoke method on NULL object reference: myWindow'
>>
>> when the problem arrived I put a debugging statement
>>
>> HELP, myWindow
>>
>> just after the statement widget_control, draw, GET_VALUE=myWindow
>> And the output is WINDOW OBJREF=<NullObject>
>> when I suppose it should and WindowIDLObject
>>
>> Which step am I missing?
>
> You haven't realized the draw widget. The draw widget doesn't
> *have* a (valid) value until after it has been realized.
>
>> Second question: There is a command/function that returns the directory
>> from which the idled was calling from? I'm looking in the quick
>> reference -> 'Operating System Access' and I don't find it. If it
doesn't
>> exist can you give a clue how can I get it?
>
> I'm not exactly use what you are asking for here. I presume
> you are asking for what directory is the current directory.
> (The IDLDE is always called from the same directory, "bin" something.)
> You find the current directory in IDL like this:
>
> IDL> CD, Current=currentDirectory & Print, currentDirectory
>
> Because this involves too much typing, you usually put this
> into a PWD procedure:
>
> PRO PWD
> CD, Current=currentDirectory & Print, currentDirectory
> END
>
> Then, to learn the current directory, you just type:
>
> IDL> pwd
>
> 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
|
|
|
Re: 2 little questions: (Object windows with widget_draw) AND (geting working directory) [message #37616 is a reply to message #37615] |
Wed, 07 January 2004 07:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Nuno Oliveira writes:
> I'm trying do work an object window created with widget draw. Seems to me,
> for what I have seen from the tutorial and programs distributed from people
> on this group, that I'm doing all the steps needed.
>
>
>
> I do something like this (omitting unnecessary code):
>
> Draw = WIDGET_DRAW(tlb, XSIZE=xsize, YSIZE=ysize, GRAPHICS_LEVEL=2)
>
> ;graphics_level=2 to set as object window
> ;then .
>
> WIDGET_CONTROL_, draw, GET_VALUE=myWindow
>
> ;in this statement myWindow should now be an Window Object?
>
> ;assuming that I have a View with a lots of pretty things
> ; I do
>
> myWindow->Draw, myView
>
> ;and this is the point where I get the error:
>
> ;MESSAGE: 'Unable to invoke method on NULL object reference: myWindow'
>
> when the problem arrived I put a debugging statement
>
> HELP, myWindow
>
> just after the statement widget_control, draw, GET_VALUE=myWindow
> And the output is WINDOW OBJREF=<NullObject>
> when I suppose it should and WindowIDLObject
>
> Which step am I missing?
You haven't realized the draw widget. The draw widget doesn't
*have* a (valid) value until after it has been realized.
> Second question: There is a command/function that returns the directory
> from which the idled was calling from? I'm looking in the quick
> reference -> 'Operating System Access' and I don't find it. If it doesn't
> exist can you give a clue how can I get it?
I'm not exactly use what you are asking for here. I presume
you are asking for what directory is the current directory.
(The IDLDE is always called from the same directory, "bin" something.)
You find the current directory in IDL like this:
IDL> CD, Current=currentDirectory & Print, currentDirectory
Because this involves too much typing, you usually put this
into a PWD procedure:
PRO PWD
CD, Current=currentDirectory & Print, currentDirectory
END
Then, to learn the current directory, you just type:
IDL> pwd
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
|
|
|