Re: Button drag

Robin Dunn <[email protected]> Wed, 19 Jun 2019 14:19:14 -0700 (PDT)
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
------=_Part_33_937021749.1560979154869
Content-Type: multipart/alternative; 
	boundary="----=_Part_34_1647421266.1560979154869"

------=_Part_34_1647421266.1560979154869
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Saturday, June 15, 2019 at 7:06:52 AM UTC-7, philippe DALET wrote:
>
> Hello,
>
> I have the same problem when I drag with this widgets like button
> checkbox
> choice=20
> combobox
> Floatcanvas
> stc.StyledTextCtrl)
> imagebutton
> listbox
> notebook
> texctrl
>
> but no problems with this widgets
> bitmapconvas
> calendar
>
> The file joined (checkbox.py)  works fine on win7 64bits and wxpython=20
> 4.0.6.
> I have not seen a generic Checkbox.
>

One way to work around things like this is to create an image to represent=
=20
the widget while dragging, and hide the real widget when the drag starts=20
and show the image instead. Then when the drag is done you can move the=20
real widget and then show it. The wx.DragImage class can help you with the=
=20
dragging part.

--
Robin

=20

>
> Philippe
>
>
>
>
>
>
> Le samedi 8 juin 2019 11:28:35 UTC+2, philippe DALET a =C3=A9crit :
>>
>> 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=20
>> py3.6, a capturelost event appears, and after my script is out of contro=
l.
>> Only alt+F4 can stop the script.
>>
>> 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 ?
>>
>> Thanks for your reply.
>>
>> Ph.DALET
>>
>

--=20
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 e=
mail to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/=
wxPython-dev/382146fb-9731-4605-8485-8710b18ade5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

<div dir=3D"ltr">On Saturday, June 15, 2019 at 7:06:52 AM UTC-7, philippe D=
ALET 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">He=
llo,<div><br></div><div>I have the same problem when I drag with this widge=
ts like button</div><div><div>checkbox</div><div>choice=C2=A0</div><div>com=
bobox</div><div>Floatcanvas</div><div>stc.StyledTextCtrl)<br></div><div>ima=
gebutton</div><div>listbox</div><div>notebook</div><div>texctrl</div><div><=
br></div><div>but no problems with this widgets</div><div>bitmapconvas</div=
><div>calendar</div><div><br></div><div>The file joined (checkbox.py)=C2=A0=
 works fine on win7 64bits and wxpython 4.0.6.</div><div>I have not seen a =
generic Checkbox.</div></div></div></blockquote><div><br></div><div>One way=
 to work around things like this is to create an image to represent the wid=
get while dragging, and hide the real widget when the drag starts and show =
the image instead. Then when the drag is done you can move the real widget =
and then show it. The wx.DragImage class can help you with the dragging par=
t.</div><div><br></div><div>--</div><div>Robin</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><br></div><div>Philippe</div><div><br></div><div><br></div><br><br><b=
r><br>Le samedi 8 juin 2019 11:28:35 UTC+2, philippe DALET a =C3=A9crit=C2=
=A0:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Hello</di=
v><div><br></div><div>I try to drag a button with the mouse on a panel.</di=
v><div><br></div><div>It works fine on win7 (64bits) with wxpython 4.0.6.=
=C2=A0 py3.7.3</div><div><br></div><div>On Ubuntu 18.04--16.04=C2=A0  (64bi=
ts) with wxpython 4.0.6. GTK2  py3.5 or py3.6, a capturelost event appears,=
 and after my script is out of control.</div><div>Only alt+F4 can stop the =
script.<br></div><div><br></div><div>if I change the code like this</div><d=
iv>=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><di=
v></div><div>it works fine.</div><div><br></div><div>How to avert this even=
t ?<br></div><div><br></div><div>Thanks for your reply.<br></div><div><br><=
/div><div></div><div>Ph.DALET<br></div></div></blockquote></div></div></blo=
ckquote></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/382146fb-9731-4605-8485-8710b18ade5a%40googlegroups=
.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/ms=
gid/wxPython-dev/382146fb-9731-4605-8485-8710b18ade5a%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_34_1647421266.1560979154869--

------=_Part_33_937021749.1560979154869--