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

sbungay sbungay at smartsonsite.com
Wed Nov 15 16:55:05 CET 2023


Stupid question: What mechanism is making the components in the example 
automatically go full width of the form?

On 2023-11-14 12:44, Bruce Steers wrote:
> I added a CursorFrom() method to TextArea in the attached project.
> 
> If you drop the TextArea.class file into your project then it adds to 
> all TextArea controls the method..
> 
> TextArea1.CursorFrom(X as Integer, Y As Integer) As Integer
> 
> I called it CursorFrom() because it compliments CursorAt()
> 
> Should work with any font.
> 
> The attached project has a test prog that lists $HOME in an IconView, 
> dragging files to the TextArea inserts filenames at drop position.
> 
> 
> Respects
> BruceS
> 
> 
> On Mon, 13 Nov 2023 at 21:01, T Lee Davidson <t.lee.davidson at gmail.com 
> <mailto:t.lee.davidson at gmail.com>> wrote:
> 
>     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
> 
> 
>     ----[ http://gambaswiki.org/wiki/doc/netiquette
>     <http://gambaswiki.org/wiki/doc/netiquette> ]----
> 
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

-- 
Stephen A. Bungay, Prop.
Smarts On Site
Managed Information Systems & Support Services
705.734.0597


More information about the User mailing list