[Gambas-user] Hover text anchored to mouse pointer

Gianluigi gradobag at gradobag.it
Thu Jun 8 11:29:26 CEST 2023


Il 08/06/23 10:24, KKing ha scritto:
> Hi Gianluigi,
>
> That looks pretty good!
>
> And is nearly what I want .... the but is I will be hovering over a 
> bespoke chart which am still experimenting with where how and where 
> drawn. I will want the text to change depending on the x,y position of 
> the cursor, actually just the x position.
>
> K
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----


Hi,

Try adding this code:

Public Sub TextArea1_MouseMove()

   Print Mouse.X
   Dim s As String
   TextArea1.Tracking = True
   Select Mouse.X
     Case 20 To 100
       s = Replace($sMouse, "$$$", "I am on " & "Column one")
     Case 100 To 180
       s = Replace($sMouse, "$$$", "I am on " & "Column two")
     Case 180 To 260
       s = Replace($sMouse, "$$$", "I am on " & "Column three")
     Case Else
       s = Replace($sMouse, "$$$", "I am on " & TextArea1.Name)
       ' or
       ' s = Replace($sMouse, "$$$", "")
   End Select
   $hPicture = Picture.FromString(s)
   TextArea1.Cursor = New Cursor($hPicture)

End

Regards

Gianluigi



More information about the User mailing list