Re: Widget Weirdness [message #65646 is a reply to message #65642] |
Fri, 13 March 2009 11:53   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I finally got my little test widget program to exhibit
> the symptoms of this problem. It turns out that two
> things are necessary for the problem to show itself.
>
> Just to recap the problem. I have a centered widget.
> If I move the widget off-center (on the display), then
> create an event that changes the text of a label widget,
> the entire widget jumps back to the center of the display.
> This happens ONLY on UNIX machines.
>
> As I say, there are two requirements for this to occur.
>
> First, I have to locate the widget on the display using
> the [XY]OFFSET keywords.
>
> Widget_Control, tlb, XOFFSET=400, YOFFSET=400
>
> It doesn't matter if I do this before or after the
> widget is realized, or if I do it as shown or if I
> do it in the TLB creation routine. It only matters
> that I assign a location to the widget. It doesn't
> matter if the widget is centered necessarily. The
> widget will pop back to this original offset location,
> whatever it happens to be.
>
> Second, I have to use the UPDATE keyword to
> turn updates off and on for the top-level base. In my
> test program, the code looks like this:
>
> Widget_Control, event.top, Update=0
> Widget_Control, event.top, Update=1
> Widget_Control, labelID, Set_Value=newText
>
> If I don't do *both* of these things, my widget acts
> like it is suppose to.
Wait a minute! It is not this simple.
OK, I am still positioning my widget with offsets,
as before, but I have removed ALL updating from my
widget.
*NOW* what happens is that the widget jumps back to
its starting position, but only *SOME* of the time.
This is unreal!! Apparently now there is some interaction
going on, such that if the text of the label widget changes
its length "appreciably" then this jumpy behavior occurs,
but if the text is the same length as the previous text,
the jumpy behavior doesn't occur.
I feel like I am in some kind of twilight zone episode!
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|