On Friday, June 19, 2015 at 10:51:08 AM UTC+2, Helder wrote:
> Hi,
> I've been fighting with this for ~2 hours and I don't know where to bang my head against.
> I have a complicated object and I start apologizing for posting such complicated lines, but I see no other way and don't want to leave out anything. So I have the following lines using the text() function and setting the position with the self.position property. I print out the self.position value before and then the position parameter of the text object after:
>
> print, 'pos before = '+string(self.position, format='("(",f0.2,",",f0.2,")")')
> self.overlay = text(self.position[0], self.position[1], self.txtValue, /norm, target=self.refObj.widgets.oWin)
> print, 'pos after = '+string(self.overlay.position, format='("(",f0.2,",",f0.2,",",f0.2,",",f0.2,")")')
>
> This runs 4 times and I get the following print out:
>
> pos before = (0.08,0.95)
> pos after = (0.40,0.40,0.53,0.42)
> pos before = (0.92,0.95)
> pos after = (0.40,0.39,0.71,0.42)
> pos before = (0.08,0.04)
> pos after = (0.40,0.40,0.84,0.42)
> pos before = (0.92,0.04)
> pos after = (0.40,0.40,0.57,0.42)
>
> Something stupid is happening and I can't figure out what I'm doing wrong...
>
> Thanks for any insight,
> Helder
Hi,
I've been trying some more, but can't get around this.
If I set up a test example, everything works as expected:
i = image(/test)
position = [0.08,0.95]
overlay = text(position[0], position[1], 'test', /norm, target=i.window)
print, 'pos after = '+string(overlay.position, format='("(",f0.2,",",f0.2,",",f0.2,",",f0.2,")")')
Then I get as expected:
pos after = (0.08,0.95,0.12,0.98)
However, in my "longer" program, I get a very different answer and I cannot find a reason for that:
print, 'pos before = '+string(self.position, format='("(",f0.2,",",f0.2,")")')
self.overlay = text(self.position[0], self.position[1], self.txtValue, /norm, target=self.refObj.widgets.oWin)
print, 'pos after = '+string(self.overlay.position, format='("(",f0.2,",",f0.2,",",f0.2,",",f0.2,")")')
Then I get this:
pos before = (0.92,0.04)
pos after = (0.40,0.40,0.57,0.42)
GRAPHICSWIN <3442>
BACKGROUND_COLOR = 0 0 0
DIMENSIONS = 638.000 640.000
EVENT_HANDLER = <ObjHeapVar5073(GRAPHICSHANDLER)>
KEYBOARD_HANDLER = ''
MOUSE_DOWN_HANDLER = ''
MOUSE_MOTION_HANDLER = ''
MOUSE_UP_HANDLER = ''
MOUSE_WHEEL_HANDLER = ''
NAME = 'IDL'
RESOLUTION = 0.035277778 0.035277778
SELECTION_CHANGE_HANDLER = ''
TITLE = <NullObject>
WINDOW_TITLE = ''
Any clue why this is happening?
It seems stupid to ask for help without a working example, but I cannot create one, otherwise I would!
The window object is created inside a widget_window in widget program. There are no other lines executed between the ones shown above. One thing that I think is happening is that the coordinate system gets screwed up when resizing the window, creating image axes, ... But I cannot pin that down.
I would be greatful for any heads up on where to look.
Cheers,
Helder
|