[Gambas-user] User control disappears when moved by mouse

Bruce Steers bsteers4 at gmail.com
Tue Jun 13 00:31:15 CEST 2023


On Mon, 12 Jun 2023 at 17:01, Claus Dietrich <claus.dietrich at freenet.de>
wrote:

> When I move a user control (.i.e. a button ) on its form with following
> code
>
> Public Sub Button1_MouseMove()
>
>    If Mouse.left = True Then
>       Button1.Move(Mouse.screenx - Mouse.startx + Mouse.X, Mouse.Screeny
> - Mouse.StartY + Mouse.y)
>    End If
>
> End
>
>
The problem is you are using Mouse.ScreenX not Button1.X as the first value
The button x pos moves relevant to itself not Mouse.screenx.

Try this...  (I used Last not Button1 as then this code works to move any
control

Public Sub Button1_MouseMove()

If Mouse.Left Then Last.Move(Last.X + (Mouse.X - Mouse.StartX), Last.Y +
(Mouse.Y - Mouse.StartY))
End
BruceS




> the user control disappears at some positions and when I lift the mouse
> button in such a moment the user control disappears completely. That
> means, that it is not displayed any longer and also stops to raise mouse
> events.
>
> It happens on Mint Cinnamon, Mate an Kubuntu and also with labels, no
> matter whether I use QT or GTK. Is it a bug? What can be done to avoid
> this behaviour?
>
> Best regards
>
> Claus
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230612/db449af2/attachment.htm>


More information about the User mailing list