[Gambas-user] Mouse X & Y reporting...

Bruce Steers bsteers4 at gmail.com
Sun Nov 12 16:41:37 CET 2023


On Sun, 12 Nov 2023 at 15:04, sbungay <sbungay at smartsonsite.com> wrote:

>    I've been struggling with dragging data from a TreeView to a Text
> Area, and I THINK I've found the source of the frustration.
>
>    Both the TreeView and TextArea have Tracking enabled. So everything
> is OK there.
>
>    The Drag begins and the Mouse.X and Mouse.Y coordinates are given
> relative to where it was in the TreeView when that event fires. Lets say
> the values are, respectively, 21 and 88. Dragging the text from the
> TreeView to the position in the TextArea where it needs to be inserted
> it ALWAYS inserts it in the wrong spot, and the Mouse.X and Mouse.Y
> remain set at 21 and 88, which explains why insertion did not take place
> at the desired location.
>
>   Shouldn't the Mouse.X and Mouse.Y be updated to the coordinates of the
> pointer relative to the control over which the drop occurred?
>
> --
> Steve.
>

No because Mouse.X and Mouse.Y are object relative positions.so belong to
the calling objects Drag event

See Drag.X and Drag.Y

Or use Mouse.ScreenX , Mouse.ScreenY with the dropped objects screen
positions.
Dim iDropRelativeMouseX = Mouse.ScreenX - MyDroppedControl.ScreenX
Dim iDropRelativeMouseY = Mouse.ScreenY - MyDroppedControl.ScreenY

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231112/3935c327/attachment-0001.htm>


More information about the User mailing list