comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Keeping objects fixed in function graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Keeping objects fixed in function graphics [message #86986] Thu, 19 December 2013 04:40 Go to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
since I spent the last half an hour trying to figure this out, I thought I might as well share this.
The reason and idea behind this, was to draw in a window where I have an image some sort of markers that stay where they are. For example a grid or an aiming target or crosshair.
One should be able to pan and zoom the image below it, but not these objects on top.
Well, this is how I did it. Let me know if you know of a better/cleaner way, otherwise I'll stick to this.
What I did was basically turn off the event handlers for mouse movements and any other sort. Here is the code:

;#################################
FUNCTION AvoidMovingObj::MouseDown, oWin, x, y, iButton, KeyMods, nClicks
RETURN, 1
END

FUNCTION AvoidMovingObj::MouseMotion, oWin, x, y, KeyMods
RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
END

FUNCTION AvoidMovingObj::MouseUp, oWin, x, y, iButton
RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
END

FUNCTION AvoidMovingObj::MouseWheel, oWin, x, y, Delta, KeyMods
RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
END

PRO AvoidMovingObj__define
void = {AvoidMovingObj, inherits GraphicsEventAdapter}
END

PRO AvoidMovingObjTest
p = PLOT(/test)
e = ellipse(0.5,0.5, '-r2', FILL_BACKGROUND=0, /norm)
e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj')
END
;#################################

There are two clear drawbacks in this way of working:
1) if there are ellipses that one would like to move, than I should make sure that the correct ellipse (or object) is not moved and the rest is moved. I think this is solvable, but I didn't spend time on it yet
2) this seems to be an intrinsic drawback of this method: when clicking on the "unmovable" object, the mouse cursor will stay as it is until another object has been clicked. Not terrible, but not elegant.

I hope I'm not the only one in need for this and if you have suggestion on how to improve this... very welcome!
Cheers,
Helder
Re: Keeping objects fixed in function graphics [message #86987 is a reply to message #86986] Thu, 19 December 2013 05:10 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Thursday, December 19, 2013 1:40:06 PM UTC+1, Helder wrote:
> Hi,
>
> since I spent the last half an hour trying to figure this out, I thought I might as well share this.
>
> The reason and idea behind this, was to draw in a window where I have an image some sort of markers that stay where they are. For example a grid or an aiming target or crosshair.
>
> One should be able to pan and zoom the image below it, but not these objects on top.
>
> Well, this is how I did it. Let me know if you know of a better/cleaner way, otherwise I'll stick to this.
>
> What I did was basically turn off the event handlers for mouse movements and any other sort. Here is the code:
>
>
>
> ;#################################
>
> FUNCTION AvoidMovingObj::MouseDown, oWin, x, y, iButton, KeyMods, nClicks
>
> RETURN, 1
>
> END
>
>
>
> FUNCTION AvoidMovingObj::MouseMotion, oWin, x, y, KeyMods
>
> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
> END
>
>
>
> FUNCTION AvoidMovingObj::MouseUp, oWin, x, y, iButton
>
> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
> END
>
>
>
> FUNCTION AvoidMovingObj::MouseWheel, oWin, x, y, Delta, KeyMods
>
> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
> END
>
>
>
> PRO AvoidMovingObj__define
>
> void = {AvoidMovingObj, inherits GraphicsEventAdapter}
>
> END
>
>
>
> PRO AvoidMovingObjTest
>
> p = PLOT(/test)
>
> e = ellipse(0.5,0.5, '-r2', FILL_BACKGROUND=0, /norm)
>
> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj')
>
> END
>
> ;#################################
>
>
>
> There are two clear drawbacks in this way of working:
>
> 1) if there are ellipses that one would like to move, than I should make sure that the correct ellipse (or object) is not moved and the rest is moved. I think this is solvable, but I didn't spend time on it yet
>
> 2) this seems to be an intrinsic drawback of this method: when clicking on the "unmovable" object, the mouse cursor will stay as it is until another object has been clicked. Not terrible, but not elegant.
>
>
>
> I hope I'm not the only one in need for this and if you have suggestion on how to improve this... very welcome!
>
> Cheers,
>
> Helder

Ok,
So the solution for problem 1) (see above) is to substitute the lines with:
RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
with this line:
o = oWin.GetSelect()
IF ISA(oWin.GetSelect(), 'ELLIPSE') && (o.NAME EQ self.Name) THEN RETURN, 0 $
ELSE RETURN, 1

and to add an Init method:

FUNCTION AvoidMovingObj::Init, Name
self.Name = Name
RETURN, 1
END

PRO AvoidMovingObj__define
void = {AvoidMovingObj, inherits GraphicsEventAdapter, Name:''}
END

and then to set the event_handler property like this:
e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj', 'Obj1Name')

That solves that...

Cheers,
h
Re: Keeping objects fixed in function graphics [message #86990 is a reply to message #86987] Thu, 19 December 2013 05:56 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 19 décembre 2013 14:10:03 UTC+1, Helder a écrit :
> On Thursday, December 19, 2013 1:40:06 PM UTC+1, Helder wrote:
>
>> Hi,
>
>>
>
>> since I spent the last half an hour trying to figure this out, I thought I might as well share this.
>
>>
>
>> The reason and idea behind this, was to draw in a window where I have an image some sort of markers that stay where they are. For example a grid or an aiming target or crosshair.
>
>>
>
>> One should be able to pan and zoom the image below it, but not these objects on top.
>
>>
>
>> Well, this is how I did it. Let me know if you know of a better/cleaner way, otherwise I'll stick to this.
>
>>
>
>> What I did was basically turn off the event handlers for mouse movements and any other sort. Here is the code:
>
>>
>
>>
>
>>
>
>> ;#################################
>
>>
>
>> FUNCTION AvoidMovingObj::MouseDown, oWin, x, y, iButton, KeyMods, nClicks
>
>>
>
>> RETURN, 1
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> FUNCTION AvoidMovingObj::MouseMotion, oWin, x, y, KeyMods
>
>>
>
>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> FUNCTION AvoidMovingObj::MouseUp, oWin, x, y, iButton
>
>>
>
>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> FUNCTION AvoidMovingObj::MouseWheel, oWin, x, y, Delta, KeyMods
>
>>
>
>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> PRO AvoidMovingObj__define
>
>>
>
>> void = {AvoidMovingObj, inherits GraphicsEventAdapter}
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> PRO AvoidMovingObjTest
>
>>
>
>> p = PLOT(/test)
>
>>
>
>> e = ellipse(0.5,0.5, '-r2', FILL_BACKGROUND=0, /norm)
>
>>
>
>> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj')
>
>>
>
>> END
>
>>
>
>> ;#################################
>
>>
>
>>
>
>>
>
>> There are two clear drawbacks in this way of working:
>
>>
>
>> 1) if there are ellipses that one would like to move, than I should make sure that the correct ellipse (or object) is not moved and the rest is moved. I think this is solvable, but I didn't spend time on it yet
>
>>
>
>> 2) this seems to be an intrinsic drawback of this method: when clicking on the "unmovable" object, the mouse cursor will stay as it is until another object has been clicked. Not terrible, but not elegant.
>
>>
>
>>
>
>>
>
>> I hope I'm not the only one in need for this and if you have suggestion on how to improve this... very welcome!
>
>>
>
>> Cheers,
>
>>
>
>> Helder
>
>
>
> Ok,
>
> So the solution for problem 1) (see above) is to substitute the lines with:
>
> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
> with this line:
>
> o = oWin.GetSelect()
>
> IF ISA(oWin.GetSelect(), 'ELLIPSE') && (o.NAME EQ self.Name) THEN RETURN, 0 $
>
> ELSE RETURN, 1
>
>
>
> and to add an Init method:
>
>
>
> FUNCTION AvoidMovingObj::Init, Name
>
> self.Name = Name
>
> RETURN, 1
>
> END
>
>
>
> PRO AvoidMovingObj__define
>
> void = {AvoidMovingObj, inherits GraphicsEventAdapter, Name:''}
>
> END
>
>
>
> and then to set the event_handler property like this:
>
> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj', 'Obj1Name')
>
>
>
> That solves that...
>
>
>
> Cheers,
>
> h


If you put your "steady" objects as "annotation" objects (TEXT, ELLIPSE, POLYLINE, etc..) bu using /RELATIVE keyword, I guess that you will get what you want.
alx.
Re: Keeping objects fixed in function graphics [message #86994 is a reply to message #86990] Thu, 19 December 2013 06:14 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Thursday, December 19, 2013 2:56:51 PM UTC+1, alx wrote:
> Le jeudi 19 décembre 2013 14:10:03 UTC+1, Helder a écrit :
>
>> On Thursday, December 19, 2013 1:40:06 PM UTC+1, Helder wrote:
>
>>
>
>>> Hi,
>
>>
>
>>>
>
>>
>
>>> since I spent the last half an hour trying to figure this out, I thought I might as well share this.
>
>>
>
>>>
>
>>
>
>>> The reason and idea behind this, was to draw in a window where I have an image some sort of markers that stay where they are. For example a grid or an aiming target or crosshair.
>
>>
>
>>>
>
>>
>
>>> One should be able to pan and zoom the image below it, but not these objects on top.
>
>>
>
>>>
>
>>
>
>>> Well, this is how I did it. Let me know if you know of a better/cleaner way, otherwise I'll stick to this.
>
>>
>
>>>
>
>>
>
>>> What I did was basically turn off the event handlers for mouse movements and any other sort. Here is the code:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> ;#################################
>
>>
>
>>>
>
>>
>
>>> FUNCTION AvoidMovingObj::MouseDown, oWin, x, y, iButton, KeyMods, nClicks
>
>>
>
>>>
>
>>
>
>>> RETURN, 1
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> FUNCTION AvoidMovingObj::MouseMotion, oWin, x, y, KeyMods
>
>>
>
>>>
>
>>
>
>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> FUNCTION AvoidMovingObj::MouseUp, oWin, x, y, iButton
>
>>
>
>>>
>
>>
>
>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> FUNCTION AvoidMovingObj::MouseWheel, oWin, x, y, Delta, KeyMods
>
>>
>
>>>
>
>>
>
>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> PRO AvoidMovingObj__define
>
>>
>
>>>
>
>>
>
>>> void = {AvoidMovingObj, inherits GraphicsEventAdapter}
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> PRO AvoidMovingObjTest
>
>>
>
>>>
>
>>
>
>>> p = PLOT(/test)
>
>>
>
>>>
>
>>
>
>>> e = ellipse(0.5,0.5, '-r2', FILL_BACKGROUND=0, /norm)
>
>>
>
>>>
>
>>
>
>>> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj')
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>> ;#################################
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> There are two clear drawbacks in this way of working:
>
>>
>
>>>
>
>>
>
>>> 1) if there are ellipses that one would like to move, than I should make sure that the correct ellipse (or object) is not moved and the rest is moved. I think this is solvable, but I didn't spend time on it yet
>
>>
>
>>>
>
>>
>
>>> 2) this seems to be an intrinsic drawback of this method: when clicking on the "unmovable" object, the mouse cursor will stay as it is until another object has been clicked. Not terrible, but not elegant.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I hope I'm not the only one in need for this and if you have suggestion on how to improve this... very welcome!
>
>>
>
>>>
>
>>
>
>>> Cheers,
>
>>
>
>>>
>
>>
>
>>> Helder
>
>>
>
>>
>
>>
>
>> Ok,
>
>>
>
>> So the solution for problem 1) (see above) is to substitute the lines with:
>
>>
>
>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>> with this line:
>
>>
>
>> o = oWin.GetSelect()
>
>>
>
>> IF ISA(oWin.GetSelect(), 'ELLIPSE') && (o.NAME EQ self.Name) THEN RETURN, 0 $
>
>>
>
>> ELSE RETURN, 1
>
>>
>
>>
>
>>
>
>> and to add an Init method:
>
>>
>
>>
>
>>
>
>> FUNCTION AvoidMovingObj::Init, Name
>
>>
>
>> self.Name = Name
>
>>
>
>> RETURN, 1
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> PRO AvoidMovingObj__define
>
>>
>
>> void = {AvoidMovingObj, inherits GraphicsEventAdapter, Name:''}
>
>>
>
>> END
>
>>
>
>>
>
>>
>
>> and then to set the event_handler property like this:
>
>>
>
>> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj', 'Obj1Name')
>
>>
>
>>
>
>>
>
>> That solves that...
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>> h
>
>
>
>
>
> If you put your "steady" objects as "annotation" objects (TEXT, ELLIPSE, POLYLINE, etc..) bu using /RELATIVE keyword, I guess that you will get what you want.
>
> alx.

Nice, thanks.
However, you can still select, pan, move and rotate the object by clicking on it. This is not very useful when overlaying a grid and the mouse is constantly going over the grid and if you click on it you might move/change it.
But yes, coordinates are now normalize for this object and don't change when the underlying object is changing in size or position (pan).

Cheers,
Helder
Re: Keeping objects fixed in function graphics [message #86997 is a reply to message #86994] Thu, 19 December 2013 06:25 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 19 décembre 2013 15:14:53 UTC+1, Helder a écrit :
> On Thursday, December 19, 2013 2:56:51 PM UTC+1, alx wrote:
>
>> Le jeudi 19 décembre 2013 14:10:03 UTC+1, Helder a écrit :
>
>>
>
>>> On Thursday, December 19, 2013 1:40:06 PM UTC+1, Helder wrote:
>
>>
>
>>>
>
>>
>
>>>> Hi,
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> since I spent the last half an hour trying to figure this out, I thought I might as well share this.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> The reason and idea behind this, was to draw in a window where I have an image some sort of markers that stay where they are. For example a grid or an aiming target or crosshair.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> One should be able to pan and zoom the image below it, but not these objects on top.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Well, this is how I did it. Let me know if you know of a better/cleaner way, otherwise I'll stick to this.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> What I did was basically turn off the event handlers for mouse movements and any other sort. Here is the code:
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> ;#################################
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> FUNCTION AvoidMovingObj::MouseDown, oWin, x, y, iButton, KeyMods, nClicks
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> RETURN, 1
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> FUNCTION AvoidMovingObj::MouseMotion, oWin, x, y, KeyMods
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> FUNCTION AvoidMovingObj::MouseUp, oWin, x, y, iButton
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> FUNCTION AvoidMovingObj::MouseWheel, oWin, x, y, Delta, KeyMods
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> PRO AvoidMovingObj__define
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> void = {AvoidMovingObj, inherits GraphicsEventAdapter}
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> PRO AvoidMovingObjTest
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> p = PLOT(/test)
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> e = ellipse(0.5,0.5, '-r2', FILL_BACKGROUND=0, /norm)
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj')
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> END
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> ;#################################
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> There are two clear drawbacks in this way of working:
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> 1) if there are ellipses that one would like to move, than I should make sure that the correct ellipse (or object) is not moved and the rest is moved. I think this is solvable, but I didn't spend time on it yet
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> 2) this seems to be an intrinsic drawback of this method: when clicking on the "unmovable" object, the mouse cursor will stay as it is until another object has been clicked. Not terrible, but not elegant.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I hope I'm not the only one in need for this and if you have suggestion on how to improve this... very welcome!
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Cheers,
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Helder
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Ok,
>
>>
>
>>>
>
>>
>
>>> So the solution for problem 1) (see above) is to substitute the lines with:
>
>>
>
>>>
>
>>
>
>>> RETURN, ~ISA(oWin.GetSelect(), 'ELLIPSE')
>
>>
>
>>>
>
>>
>
>>> with this line:
>
>>
>
>>>
>
>>
>
>>> o = oWin.GetSelect()
>
>>
>
>>>
>
>>
>
>>> IF ISA(oWin.GetSelect(), 'ELLIPSE') && (o.NAME EQ self.Name) THEN RETURN, 0 $
>
>>
>
>>>
>
>>
>
>>> ELSE RETURN, 1
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> and to add an Init method:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> FUNCTION AvoidMovingObj::Init, Name
>
>>
>
>>>
>
>>
>
>>> self.Name = Name
>
>>
>
>>>
>
>>
>
>>> RETURN, 1
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> PRO AvoidMovingObj__define
>
>>
>
>>>
>
>>
>
>>> void = {AvoidMovingObj, inherits GraphicsEventAdapter, Name:''}
>
>>
>
>>>
>
>>
>
>>> END
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> and then to set the event_handler property like this:
>
>>
>
>>>
>
>>
>
>>> e.window.EVENT_HANDLER=Obj_New('AvoidMovingObj', 'Obj1Name')
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> That solves that...
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Cheers,
>
>>
>
>>>
>
>>
>
>>> h
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> If you put your "steady" objects as "annotation" objects (TEXT, ELLIPSE, POLYLINE, etc..) bu using /RELATIVE keyword, I guess that you will get what you want.
>
>>
>
>> alx.
>
>
>
> Nice, thanks.
>
> However, you can still select, pan, move and rotate the object by clicking on it. This is not very useful when overlaying a grid and the mouse is constantly going over the grid and if you click on it you might move/change it.
>
> But yes, coordinates are now normalize for this object and don't change when the underlying object is changing in size or position (pan).
>
>
>
> Cheers,
>
> Helder


Please note that by using WINDOW handler functions combined with HitTest function, you might get a finer control over what should be moved and what should be not.
alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Trapped Error. CGPLOT:CGDEFAULTCOLOR
Next Topic: Ternary diagrams

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:32:28 PDT 2025

Total time taken to generate the page: 0.00679 seconds