Re: Non-persistent object, persistent headache [message #79218] |
Sun, 12 February 2012 19:10 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wlandsman writes:
> This is a question that I don't expect anyone to be able to answer (since the relevant code is too long and complicated, and I give only a much simplified snippet here) but after 3 days of trying to determine the problem, I am hopeful that writing the question might give me some insight.
>
>
> I am setting a value in an object widget. Right before exiting the method I verify that I have the correct value:
>
> pro myobject::method1, event=event
> print,*self.x
> 2
> ....
> *self.x = 3
> print,*self.x
> 3
> end
>
> However, when the next widget event occurs, I immediately check the value of *self and find that it no longer has the value that I have just given it.
>
> pro myobject::method2, event=event
> print,*self.x
> 2
>
> I use this technique several times in the code and there only one case where it is failing. Any suggestions on possible causes of the problem? Is there anyway I can determine where *self is changing its value? Thanks, --Wayne
Is this an event handler where events can be queuing up
rapidly? I've noticed from time to time that the "order" in
which things are handled can sometime become compromised.
If this is a possibility, you might try clearing
the events in the queue, before you exit the event handler:
Widget_Control, /Clear_Events
The more logical explanation, of course, is that you are
changing a local, rather than a global variable. But I don't
see how that could be possible in the code you are showing
us.
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.")
|
|
|