[Gtk-sharp-list] Trouble with DrawingArea.MotionNotifyEvent.

Ivan Gužvinec ivan.guzvinec@telemach.net
Tue, 23 Mar 2004 09:16:24 +0100


--=-jgE7LKqKhcqUsCE60pPT
Content-Type: multipart/mixed; boundary="=-PV07YZLzOYyDIh7REwxY"


--=-PV07YZLzOYyDIh7REwxY
Content-Type: multipart/alternative; boundary="=-QYRClxjdbyyuBjx/pUZ+"


--=-QYRClxjdbyyuBjx/pUZ+
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: quoted-printable

One of the answers I was looking for was that:
Gdk.EventMotion ev =3D args.Event;
Gdk.Window window =3D ev.Window;
if (ev.IsHint) {
    Gdk.ModifierType s;
    window.GetPointer (out x, out y, out s);
}
MUST be performed inside MotionNotifyEventHandler.

This "bug-fixed" attached sample works as expected.

Thanks for luck ;))
Ivan

On Sun, 2004-03-21 at 17:33, Ofer Achler wrote:

> You can get the same effect by attaching to the expose event of the
> parent window.
>=20
> =20
>=20
> Good luck!
>=20
> =20
>=20
>                                   =20
> ______________________________________________________________________
>=20
> From:gtk-sharp-list-admin@lists.ximian.com
> [mailto:gtk-sharp-list-admin@lists.ximian.com] On Behalf Of Ivan
> Gu=BEvinec
> Sent: Sunday, March 21, 2004 6:07 AM
> To: gtk-sharp-list@lists.ximian.com
> Subject: [Gtk-sharp-list] Trouble with DrawingArea.MotionNotifyEvent.
>=20
>=20
> =20
>=20
> Hi,
>=20
> I'm having trouble with MotionNotifyEvent in my derived Window class.
> I would like to create a DrawingArea widget, add it to self (this) and
> then catch its MotionNotifyEvent(s). So far I only get exactly one
> MotionNotifyEvent when (1) mouse Enters the window area or (2) when I
> press mouse buttons and then move the mouse inside the DrawingArea.
> But when I simply move the mouse inside the DrawingArea, no
> MotionNotifyEvents are fired.
>=20
> Perhaps I'm doing things the wrong way, so any hint/help would be
> greatly appreciated.
>=20
> I've made a simple test program to demonstrate this. Please find the
> attached "CreatedWindow.cs", compile with "mcs -r gtk-sharp.dll -r
> gdk-sharp.dll -r glib-sharp.dll CreatedWindow.cs"
>=20
> thanks,
> Ivan=20
>=20
>=20

--=-QYRClxjdbyyuBjx/pUZ+
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; CHARSET=3DUTF-8">
  <META NAME=3D"GENERATOR" CONTENT=3D"GtkHTML/3.0.9">
</HEAD>
<BODY LINK=3D"#0000ff">
One of the answers I was looking for was that:<BR>
Gdk.EventMotion ev =3D args.Event;<BR>
Gdk.Window window =3D ev.Window;<BR>
if (ev.IsHint) {<BR>
&nbsp;&nbsp;&nbsp; Gdk.ModifierType s;<BR>
&nbsp;&nbsp;&nbsp; window.GetPointer (out x, out y, out s);<BR>
}<BR>
MUST be performed inside MotionNotifyEventHandler.<BR>
<BR>
This &quot;bug-fixed&quot; attached sample works as expected.<BR>
<BR>
Thanks for luck ;))<BR>
Ivan<BR>
<BR>
On Sun, 2004-03-21 at 17:33, Ofer Achler wrote:
<BLOCKQUOTE TYPE=3DCITE>
    <FONT COLOR=3D"#000080" SIZE=3D"2"><I>You can get the same effect by at=
taching to the expose event of the parent window.</FONT><BR>
    <FONT COLOR=3D"#737373"></FONT><BR>
    <FONT COLOR=3D"#000080" SIZE=3D"2">&nbsp;</FONT><BR>
    <FONT COLOR=3D"#737373"></FONT><BR>
    <FONT COLOR=3D"#000080" SIZE=3D"2">Good luck!</FONT><BR>
    <FONT COLOR=3D"#737373"></FONT><BR>
    <FONT COLOR=3D"#000080" SIZE=3D"2">&nbsp;</FONT><BR>
    <FONT COLOR=3D"#737373"><BR>
    <DIV ALIGN=3Dcenter>
<HR>
</DIV><BR>
    </FONT><BR>
    <FONT COLOR=3D"#737373" SIZE=3D"2"><B>From:</B>gtk-sharp-list-admin@lis=
ts.ximian.com [mailto:gtk-sharp-list-admin@lists.ximian.com] <B>On Behalf O=
f </B>Ivan Gu&#382;vinec<BR>
    <B>Sent:</B> Sunday, March 21, 2004 6:07 AM<BR>
    <B>To:</B> gtk-sharp-list@lists.ximian.com<BR>
    <B>Subject:</B> [Gtk-sharp-list] Trouble with DrawingArea.MotionNotifyE=
vent.</FONT><BR>
    <FONT COLOR=3D"#737373"><BR>
    </FONT><BR>
    <FONT COLOR=3D"#737373" SIZE=3D"3">&nbsp;</FONT><BR>
    <FONT COLOR=3D"#737373"></FONT><BR>
    <FONT COLOR=3D"#737373" SIZE=3D"3">Hi,<BR>
    <BR>
    I'm having trouble with MotionNotifyEvent in my derived Window class. I=
 would like to create a DrawingArea widget, add it to self (this) and then =
catch its MotionNotifyEvent(s). So far I only get exactly one MotionNotifyE=
vent when (1) mouse Enters the window area or (2) when I press mouse button=
s and then move the mouse inside the DrawingArea. But when I simply move th=
e mouse inside the DrawingArea, no MotionNotifyEvents are fired.<BR>
    <BR>
    Perhaps I'm doing things the wrong way, so any hint/help would be great=
ly appreciated.<BR>
    <BR>
    I've made a simple test program to demonstrate this. Please find the at=
tached &quot;CreatedWindow.cs&quot;, compile with &quot;mcs -r gtk-sharp.dl=
l -r gdk-sharp.dll -r glib-sharp.dll CreatedWindow.cs&quot;<BR>
    <BR>
    thanks,<BR>
    Ivan </FONT><BR>
    <FONT COLOR=3D"#737373"><BR>
    </I></FONT><BR>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-QYRClxjdbyyuBjx/pUZ+--

--=-PV07YZLzOYyDIh7REwxY
Content-Disposition: attachment; filename=CreatedWindow.cs
Content-Transfer-Encoding: base64
Content-Type: text/x-csharp; name=CreatedWindow.cs; charset=

Ly8gY3JlYXRlZCBvbiAwMy8yMS8yMDA0IGF0IDE0OjQwDQp1c2luZyBTeXN0ZW07DQp1c2luZyBH
dGs7DQp1c2luZyBHZGs7DQoNCnB1YmxpYyBjbGFzcyBDcmVhdGVkV2luZG93IDogR3RrLldpbmRv
dw0Kew0KCXN0YXRpYyBHTGli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KfQ0KDQpjbGFzcyBN
YWluQ2xhc3Mgew0KCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkNCgl7DQoJCUFwcGxpY2F0aW9u
LkluaXQoKTsNCgkJDQoJCUNyZWF0ZWRXaW5kb3cgd2luID0gbmV3IENyZWF0ZWRXaW5kb3coKTsN
CgkJd2luLlNob3dBbGwoKTsNCgkJDQoJCUFwcGxpY2F0aW9uLlJ1bigpOw0KCX0NCn0NCg==

--=-PV07YZLzOYyDIh7REwxY--

--=-jgE7LKqKhcqUsCE60pPT
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iQCUAwUAQF/yWMj+Az87AOMpAQIQqAP1EeXdqFDJbmdDoau8GNA9VQpjSFYYTmby
5n/d7xuEHv+yYo21+088I9TgC0ph9h51X3KmxCEAXY4VdJ66IHpc9vDx3DWL7KDj
AasyqquCX02mg///IXeoYV7cUZaX47rHiiDMxMwr8c9Qg8ARF42zYerTU+d5voYG
yk9d1CpTjw==
=YCoH
-----END PGP SIGNATURE-----

--=-jgE7LKqKhcqUsCE60pPT--