AddHandler and MouseMove Event

I am trying add a handler to the MouseMove Event

MouseEnter and MouseExit work fine, but MouseMove returns the following errors:

Tooltips.TooltipHandler, line 1
Type mismatch error. Expected delegate Delegate( DesktopUIControl, Integer, Integer ), but got delegate Delegate( DesktopUIControl )
AddHandler Caller.MouseMove, AddressOf ShowToolTip

Tooltips.TooltipHandler, line 1
This method requires fewer parameters than were passed
AddHandler Caller.MouseMove, AddressOf ShowToolTip

Here is the code:

Public Sub TooltipHandler(Extends Caller as DesktopUIControl)
  AddHandler Caller.MouseMove, AddressOf ShowToolTip
  AddHandler Caller.MouseEnter, AddressOf ShowToolTip
  AddHandler Caller.MouseExit, AddressOf HideToolTip
End Sub

The event is expecting a handler method with three parameters (DesktopUIControl, Integer, Integer) but you are assigning a method with one parameter (DesktopUIControl). The two additional parameters receive the mouse X and Y coordinates.

Ok, so how do I fix the code above?

Nothing seems to work that I have found.

If i use

AddHandler Caller.MouseMove(Integer, Integer), AddressOf ShowToolTip

I get:

Tooltips.TooltipHandler, line 1
Type “DesktopUIControl” has no member named “MouseMove”
AddHandler Caller.MouseMove(Integer, Integer), AddressOf ShowToolTip

You have to create a method that matches the expected signature. As Andrew explained, this event expects a method like this:

Sub Handle_MouseMove (sender As DesktopUIControl, x As Integer, y As Integer)

AddHandler on mouse events is not currently working consistently across platforms (or at all on macOS). I have reported it and it’s nominated for the Bug Bash.

https://tracker.xojo.com/xojoinc/xojo/-/issues/69613

Ok, at least I am not going completely crazy, I got the method right, but it still wasn’t working on a Mac, it does seem to work on Windows.

If you’re doing what I think you’re doing, the code is already written and in the class, it’s just private until this is fixed.

I see, well, I was going to do something else as well, but I know not to waste my time now…lol