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

T Lee Davidson t.lee.davidson at gmail.com
Mon Nov 13 18:05:53 CET 2023


On 11/13/23 11:59, Bruce Steers wrote:
> 
> 
> On Mon, 13 Nov 2023 at 16:47, T Lee Davidson <t.lee.davidson at gmail.com <mailto:t.lee.davidson at gmail.com>> wrote:
> 
>     On 11/12/23 10:03, sbungay 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?
>      >
> 
>     You shouldn't need to use Tracking and Mouse.X/Y to drop text into a TextArea at the position you desire. Notice that the
>     TextArea's text cursor follows the mouse cursor. Just position the mouse over where you want to drop the text and let go of the
>     mouse button. If you want the text on a new line use "TextArea1.Insert(gb.NewLine & Drag.Data)".
> 
> 
> That's only QT TextArea does that though.  (a much much simpler way for sure)
> 
> But with GTK the cursor stays where it is.
> 
> Respects
> BruceS
You are right. I corrected that in a message that obviously crossed in transit.

I've tried with Tracking turned off (as it is not needed) and getting the Mouse.X/Y coordinates in the Drop event, but the 
values are inconsistent.


-- 
Lee



More information about the User mailing list