How to reset Mouse Cursor?

I am controlling another application with my xojo app and monkeybread remote control. On the other app, there are parts of the screen where the mouse changes from standard to a line tool. When I move the mouse with xojo/MBS to a location where the mouse would normally change back to the standard pointer, the mouse does not change until I press a mouse click. I need a way to reset the cursor to standard without having the mouse click.

MouseCursor=system.Cursors.StandardPointer
winmain.MouseCursor=system.Cursors.StandardPointer

These work fine on the xojo app but do not have an effect on the other app I am remote controlling.

Any suggestions on how I can have xojo in the background but still have a function reset the mouse? Perhaps the other app is holding the mouse to the line tool since it does not recognize that the mouse has actually moved?

I would try NSCursorMBS class.
https://www.monkeybreadsoftware.net/class-nscursormbs.shtml

I can use the MBS Computer control plugin no problem. However, the NScursorMBS is included in the Cocoa plugins and I cannot figure out how to use it. Taking their example code found here:

https://www.monkeybreadsoftware.net/class-nscursormbs.shtml

Dim theCursor As NSCursorMBS produces an error “There is no class with that name”. So I create a new class, name it NScursorMBS, only guessing that I am to select super, there is a lot of MBS stuff in the list but no NScursorMBS. So I am at a loss for how to use this.

Edit I typed the name of the class Cocoa and now the NScursorMBS shows up as an option. This is new to me, hopefully I can figure out how to make it work now.

I ran this example code they provide and it works fine on the xojo app when triggered remotely via USB. But when I pull the other app to the front, the example does not work. It is possible that the other app is constantly resetting the cursor based on it’s location so it does not appear to work. I am not sure. Maybe there is some other work around to force the other app to switch back to the pointer. I tried using MouseUp alone but that fails. MouseDown and MouseUp works but is problematic that is clicks the screen.

[code]Dim im As NSImageMBS
Dim p As Picture
Dim m As Picture
Dim theCursor As NSCursorMBS
Dim test As Boolean

// create a blue ball picture
p = NewPicture(16,16,32)
p.Graphics.ForeColor = &c0000FF
p.Graphics.FillRect 0,0,16,16

m = NewPicture(16,16,32)
m.Graphics.ForeColor = &c000000
m.Graphics.Filloval 0,0,16,16

// Create a new NSImage
im=New NSImageMBS(p,m)

// Create a cursor from the NSImage
theCursor=New NSCursorMBS(im, 10, 10)

Title = Str(theCursor.Handle)

// Make this the active cursor
theCursor.set

// display picture
p.Mask.Graphics.DrawPicture m,0,0
Backdrop = p

// so you see it for a second before RB resets the cursor
DelayMBS 1.0[/code]

Actually, it makes no difference which app is in front, if it is not xojo then the example does not show up.

Have you seen an app control the cursor from the background previously?
I feel like it may be an OS limitation. All the native documentation I’m finding says you can change a cursor by responding to it entering a rect (as opposed to it being a global value.)

I found a work around. First send the mouse to a dead area in the application, mouseclick, then move to the place I really want to go and the cursor is correct. The mouse has to do a click somewhere in the new region to change to the standard pointer. You cannot really see the process moving the mouse to the null area first.

Thanks

you need to install the MBS Cocoa Plugin. (+ CocoaBase)