[Gambas-user] Mouse X & Y reporting...
    T Lee Davidson 
    t.lee.davidson at gmail.com
       
    Mon Nov 13 22:00:54 CET 2023
    
    
  
On 11/13/23 12:05, T Lee Davidson wrote:
> 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.
Further, I've come up with simple Drop event code that I think /might/ work, but I cannot verify it because setting 
TextArea.Line crashes the program when using gb.gtk3. I can't test the algorithm with Qt either because no drag or drop events 
fire. With gb.qt5 it just, simply, works.
Note: This code requires the use of a monospace font for the TextArea.
[code]
Public Sub TextArea1_Drop()
   TextArea1.Line = Min(TextArea1.Line, Int((Mouse.ScreenY - TextArea1.ScreenY) / TextArea1.Font.Height))
   TextArea1.Column = Min(TextArea1.Column, Int((Mouse.ScreenX - TextArea1.ScreenX) / TextArea1.Font.TextWidth(" ")))
   TextArea1.Insert(Drag.Data)
End
[/code]
-- 
Lee
    
    
More information about the User
mailing list