Re: Button drag

Robin Dunn <[email protected]> Mon, 10 Jun 2019 11:42:40 -0700 (PDT)
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
------=_Part_1758_715884754.1560192160293
Content-Type: multipart/alternative; 
	boundary="----=_Part_1759_1544258358.1560192160294"

------=_Part_1759_1544258358.1560192160294
Content-Type: text/plain; charset="UTF-8"

On Saturday, June 8, 2019 at 2:28:35 AM UTC-7, philippe DALET wrote:
>
> Hello
>
> I try to drag a button with the mouse on a panel.
>
> It works fine on win7 (64bits) with wxpython 4.0.6.  py3.7.3
>
> On Ubuntu 18.04--16.04  (64bits) with wxpython 4.0.6. GTK2 py3.5 or py3.6, 
> a capturelost event appears, and after my script is out of control.
> Only alt+F4 can stop the script.
>

On X this usually means that something has the mouse captured but doesn't 
release it.

 

> if I change the code like this
>     def OnMouseDown(self, event):
>         self.btn.CaptureMouse()
>         self.btn.ReleaseMouse()
> it works fine.
>
> How to avert this event ?
>


It's probable that the native widget itself is doing something with the 
capture, or even that the parent or some other window is stealing the 
capture. I noticed that if I change your sample to use a generic widget 
like wx.lib.buttons.ThemedGenButton that it didn't have any problems.

 
--
Robin

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxPython-dev/b15a48f5-1eed-4d86-b959-c1c0b7f7b259%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

------=_Part_1759_1544258358.1560192160294
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, June 8, 2019 at 2:28:35 AM UTC-7, philippe DA=
LET wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><di=
v>Hello</div><div><br></div><div>I try to drag a button with the mouse on a=
 panel.</div><div><br></div><div>It works fine on win7 (64bits) with wxpyth=
on 4.0.6.=C2=A0 py3.7.3</div><div><br></div><div>On Ubuntu 18.04--16.04=C2=
=A0  (64bits) with wxpython 4.0.6. GTK2  py3.5 or py3.6, a capturelost even=
t appears, and after my script is out of control.</div><div>Only alt+F4 can=
 stop the script.<br></div></div></blockquote><div><br></div><div>On X this=
 usually means that something has the mouse captured but doesn&#39;t releas=
e it.</div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr"><div></div><div>if I change the code like thi=
s</div><div>=C2=A0=C2=A0=C2=A0 def OnMouseDown(self, event):<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.btn.CaptureMouse()</div><div>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.btn.ReleaseMouse()<br></div><div>=
</div><div></div><div>it works fine.</div><div><br></div><div>How to avert =
this event ?<br></div></div></blockquote><div><br></div><div><br></div><div=
>It&#39;s probable that the native widget itself is doing something with th=
e capture, or even that the parent or some other window is stealing the cap=
ture. I noticed that if I change your sample to use a generic widget like w=
x.lib.buttons.ThemedGenButton that it didn&#39;t have any problems.</div><d=
iv><br></div><div>=C2=A0</div><div>--</div><div>Robin</div><div><br></div><=
/div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wxPython-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wxPyth=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/wxPython-dev/b15a48f5-1eed-4d86-b959-c1c0b7f7b259%40googlegroups=
.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/ms=
gid/wxPython-dev/b15a48f5-1eed-4d86-b959-c1c0b7f7b259%40googlegroups.com</a=
>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

------=_Part_1759_1544258358.1560192160294--

------=_Part_1758_715884754.1560192160293--