[Gambas-user] Hover text anchored to mouse pointer
Gianluigi
gradobag at gradobag.it
Thu Jun 8 11:42:06 CEST 2023
Il 08/06/23 11:29, Gianluigi ha scritto:
> 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:
>
> ...
To avoid confusion, the whole code follows:
Private $sMouse As String
Private $hPicture As Picture
Public Sub Form_Open()
$sMouse = File.Load("./label-mouse.svg")
End
Public Sub Form_Enter()
Dim s As String
Me.Tracking = True
s = Replace($sMouse, "$$$", "I am on " & Me.Name)
$hPicture = Picture.FromString(s)
Me.Cursor = New Cursor($hPicture)
End
Public Sub TextArea1_Enter()
Dim s As String
TextArea1.Tracking = True
s = Replace($sMouse, "$$$", "I am on " & TextArea1.Name)
$hPicture = Picture.FromString(s)
TextArea1.Cursor = New Cursor($hPicture)
End
Public Sub TextBox1_Enter()
' Dim s As String
TextBox1.Tracking = True
' s = Replace($sMouse, "$$$", "I am on " & TextBox1.Name)
' $hPicture = Picture.FromString(s)
' TextBox1.Cursor = New Cursor($hPicture)
End
Public Sub TextArea1_MouseMove()
' Print Mouse.X
Dim s As String
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