[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: motion notify event messages.



That's what I thought. 
Here's what I did.  I created the button and wrote down the pointer returned (136791384).  Then I created the ENTRY control and wrote down the pointer (136977848).  

When I held the left-mouse button down on each one and moved the mouse, I observed the GTKWidget value passed into the callback, along with the GDKEventMotion's X and Y coordinates.  The widget value was always the value that was returned from the creation of the control (the pointer value 136791384 or 136977848). However, the X and Y values were either relative to the control (the entry control) or relative to the Button's parent (the gtkwindow).

Any thoughts?  

Shane Miller


>>> Havoc Pennington <hp@redhat.com> 10/29/01 02:45PM >>>

"Shane Miller" <SMiller1@stvgb.org> writes: 
> If I hold the left mouse button down over the ENTRY and move my
> mouse to the left, I get motion-notify events fired by the Entry.
> The x and y coords are based on the mouse postion within that entry
> control.  Meaning that if the control was 75 pixels wide and 10 high
> and I held the mouse button down over the right-bottom most pixel on
> the entry control and moved one pixel to the left, the mouse coord's
> reported in motion-notify would be 74,10 or something near that.
>  
> If I hold the left mouse button down over the BUTTON control and
> move my mouse to the left, I get motion-notify events fired by the
> button.  The x and y coords are based on the mouse postion within
> that FORM instead of the control.  Meaning that if the control was
> 75 pixels wide and 10 high and it's origin was at 50,50 on the form,
> and I held the mouse button down over the right-bottom most pixel on
> the button control and moved one pixel to the left, the mouse
> coord's reported in motion-notify would be 124,60 or something near
> that.
> 
> Why is that?  Shouldn't they both report mouse coordinates based on
> the mouse position in the FORM or the CONTROL?  Is this a known
> issue or have we coded something incorrectly in Lazarus?
> 

Motion coordinates should always be relative to the GdkWindow that was
initially clicked on (or that has the pointer grab). Both entry and
button have a GdkWindow of their own, so coords should be relative to
the widget. If that's not the case then something is wrong.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]