Mouse overlord equivalent for Xojo?

Apologies if this has been discussed, I haven’t been able to find it.

I am reviving some projects I wrote back in 2006-9 (with RB 2009 5.1) and upgrading them to the current Xojo. All has gone well except for a class of functions that came from an add-on called Mouse Overlord. It allowed me to hide and show the cursor, move it, etc.

I cannot seem to find any current version of this for Xojo. I copied the add-on from the RB plug-in directory to the Xojo plug-in directory and then started Xojo, but these commands are still not recognized. I’ve looked on the web, I’ve looked on sites that refernce Mouse Overlord or Monkey<something, already forgot, but it seems to now be Windows only and I work on a Mac>, and not found anything to help.

So, any help will be greatly appreciated. Is there a new plug-in/add-on that has replaced Mouse Overload in Xojo? have some of those commands been brought in to Xojo itself? (I’ll start looking around, but I literally just uploaded the thing a day ago! and thought the best way to get started would be to bring in the simplest of the projects I’m trying to rehabilitate…)

Thank you so much,
Carolyn B-G

[quote=41251:@Carolyn Buck-Gengler]Apologies if this has been discussed, I haven’t been able to find it.

I am reviving some projects I wrote back in 2006-9 (with RB 2009 5.1) and upgrading them to the current Xojo. All has gone well except for a class of functions that came from an add-on called Mouse Overlord. It allowed me to hide and show the cursor, move it, etc.

I cannot seem to find any current version of this for Xojo. I copied the add-on from the RB plug-in directory to the Xojo plug-in directory and then started Xojo, but these commands are still not recognized. I’ve looked on the web, I’ve looked on sites that refernce Mouse Overlord or Monkey<something, already forgot, but it seems to now be Windows only and I work on a Mac>, and not found anything to help.

So, any help will be greatly appreciated. Is there a new plug-in/add-on that has replaced Mouse Overload in Xojo? have some of those commands been brought in to Xojo itself? (I’ll start looking around, but I literally just uploaded the thing a day ago! and thought the best way to get started would be to bring in the simplest of the projects I’m trying to rehabilitate…)

Thank you so much,
Carolyn B-G[/quote]
This is a question which I would also like to know the answer to, as I am currently working on a project that needs this.

I was hoping that the features in MouseOverlord would have been incorporated into Xojo by now.

My project is on the PC so perhaps there are some features built into Windows that I can get to work. Any suggestions would be appreciated.

Xojo:
MouseCursor = system.Cursors.StandardPointer
MouseCursor = System.Cursors.InvisibleCursor

MBS:
http://www.monkeybreadsoftware.net/class-presskeymbs.shtml

Joachim:
I guess I’m going to have to go looking at the MouseCursor documentation…thanks for the pointer (I am assuming that works on any platform).

The MBS link points to a deprecated class…but I guess it points at other classes to explore.

Thanks for giving me some places to go looking. If I can’t get my program(s) working I’ll be back!

Joachim,

Thanks for the suggestion. What I need is to be able to SET the mouse x and y position.

I see the mousemove function which should do what I want (moves the cursor position). I assume this means this capability is not built into Xojo. What a shame.

Followup: I forgot to say the mousemove function in the MBS plugin.

[quote=41640:@Loren Staplin]I was hoping that the features in MouseOverlord would have been incorporated into Xojo by now.

My project is on the PC so perhaps there are some features built into Windows that I can get to work. Any suggestions would be appreciated.[/quote]

[quote=41792:@Loren Staplin]Joachim,

Thanks for the suggestion. What I need is to be able to SET the mouse x and y position.

I see the mousemove function which should do what I want (moves the cursor position). I assume this means this capability is not built into Xojo. What a shame.[/quote]

Loren,

If you simply need to set the mouse position on a Win32 platform, something like this should work.

#if TargetWin32 Declare Function SetCursorPos Lib "user32" (ByVal x As Integer, ByVal y As Integer) As Integer //========================================== // Set cursor position to top left of screen //========================================== call SetCursorPos(0,0) #endif

Awesome! Thanks! I will likely use that but I was also looking for something that would work on Mac as well as Windows (and Web if possible). I guess I could do a check first then declare for either Mac or Windows but was hoping to keep it simpler than that. I already have old code that works on Mac (at least it worked on 10.3.9; I am not at work now so I can’t check it but I think it used a Cocoa library…not sure).

The only reason I am leaning towards MBS ComputerControl Plugin is that it works in everything but Linux (which I don’t care about; at least not now). I just wish it was built into Xojo by now.

Loren,

This does the trick for OSX but I have no clue how one would implement that for a web client.

[code] #if TargetMacOS
// Create a Xojo Structure (with the IDE) like this to contain the x/y coordinates
//
// struct CGPoint {
// CGFloat x; //Xojo single
// CGFloat y; //Xojo single
// };
// typedef struct CGPoint CGPoint;
//
//
Dim pt As CGPoint
Dim disp as Integer = 0

//  CGError CGDisplayMoveCursorToPoint (
//     CGDirectDisplayID display,
//     CGPoint point
//   );
Declare Function CGDisplayMoveCursorToPoint lib "Carbon" (Display as Integer, Point as CGPoint) as Integer


//===========================================
// Move mouse cursor to Top Left of display 0
//===========================================
pt.x = 0
pt.y = 0
Call CGDisplayMoveCursorToPoint(disp,pt)

#endif[/code]

OP here. I do appreciate the continued conversation, I’ve learned quite a bit. However, given the number of years it’s been, and that I have not been upgrading all along but am suddenly switching from a very old RB to the (what seems to me) different and newer and more complex Xojo environment, I’m feeling a little in over my head reading these replies. (And also, have explored some of the things on the Monkeybread site, and again, getting into places where I am over my head.)

FWIW, I can still program fine in RB (haven’t forgotten those things) but only ever had the one plug-in (that I purposefully added), so am not really up on the world of plug-ins.

As I noted above, I’m taking an old program and modifying it for a new use. I program on the Mac (and intend to continue to do so), and all our applications have always been for the Mac, so I’ve never had to do anything to make my executable run on a Win platform. But that is part of what these modifications require: to be able to run on a Win laptop. My old RB will compile for Windows, but only as a demo: only good for 30 days, will only run 5 min. That’s not something we can use. So, I have to upgrade, obviously, since the professional version of the old RB is not available (I assume, but I will check that out, in addition).

The types of commands I need to do are to show the cursor, hide the cursor (and obviously render it non-operational while hidden), and to move the cursor (which I do usually while it is hidden). The commands (using Mouse Overlord) that I need to be able to find current alternatives for are:
MOv.HideCursor
MOv.MoveCursorTo(tempx,tempy)
MOv.ShowCursor

I see examples above which I believe I can just use to hide and show the cursor, without having to make any more changes or find any more plugins, but like Loren, I still need to set the mouse position.

I want this to be able to run on both Windows and Mac platforms, so I don’t know if the examples above that are for specific targets mean that they won’t work on the other platform (especially the very simple
#if TargetWin32
Declare Function SetCursorPos Lib “user32” (ByVal x As Integer, ByVal y As Integer) As Integer
//==========================================
// Set cursor position to top left of screen
//==========================================
call SetCursorPos(0,0)
#endif
example – If I took out the #if Target stuff, would the rest work? I am not sure I know how (or where) to make a Xojo Structure as shown in the next, more complicated example (and again, would the target platform specific code be needed?).

I suppose I could just TRY those things – except I’m not recognizing the “declare function” (I’m used to just creating them, not writing them in as code like that) nor the “call functionname” stuff either. I am used to creating a function, and then just calling it with its name. Another change from old RB?

I’m sorry I’m so last decade in my understanding of this stuff. Trying to get back in the swing but there are so many little things to figure out, and I’m not on this project for that many hours of the week, so it’s going to take longer anyway.

Thanks for any help in getting me back up and running. All of the projects we are trying to update and create Windows versions (as well as Mac versions) of utilize mouse position and showing and hiding, so I kind of have to figure this out, and it’s the next step before I can start testing it to make sure it still works.

Carolyn

Am I the only person who pictures a tiny Darth Vader with a tail whenever I read the words “Mouse Overlord”?

Carolyn,

First, I apologize, I feel as if I’ve assisted in a thread hijacking.

[quote=42090:@Carolyn Buck-Gengler]The types of commands I need to do are to show the cursor, hide the cursor (and obviously render it non-operational while hidden), and to move the cursor (which I do usually while it is hidden). The commands (using Mouse Overlord) that I need to be able to find current alternatives for are:
MOv.HideCursor
MOv.MoveCursorTo(tempx,tempy)
MOv.ShowCursor[/quote]

With the information in this thread I’ve created a “Mouse Overlord” module you can use with those exact function names, that will also work on Mac or Windows. By studying this code, I’m sure it will help to clarify some of your other questions as well. If you are interested, please send me a private message via this forum and I will email you the example project.

Regards,

Jim

I want to thank everyone here who has responded (David Wylie, you made me laugh out loud!!).

Especially thanks to Jim Cramer who has come up with something for me to try in my projects (Jim, I’ve been trying to PM you, but the system keeps refusing to accept my messages).

Also, as it turns out, my boss seems to think that the hide/show effects (which are solved much more easily than the location setting, it appears) are the main thing she’s interested in and she doesn’t care about the mouse location setting…in the current project the location setting (to a neutral spot between trials in the experiment) is, in all honesty, just a nicety. So, for now, I’m officially not worried about that, will comment out the mov.movecursorto(x,y) code, and go forward. However, (1) I think that it still is useful to know how to do, and (2) I expect the possibility that moving the mouse/cursor in the more complex problems may be more a necessity than a nicety. I am hoping that Jim’s solution will work, because I like to get these things right and not just do the minimum (and I want to make it as much like the previous version as possible).

Thank you again for reading this Xojo-newbie’s questions, and I’ll let you know if the module from Jim works (as soon as I am able; only on this project very part time, and our potential NASA grant-giver will be in town this week, disrupting everything, though for a very good cause).

Carolyn B-G
ps Jim, since the PM system keep refusing to send my PMs to you, how do you want me to proceed?

Always glad to help :slight_smile:

Carolyn, you are very welcome and I am glad to help. You can pick up the example xojo binary project here:

https://www.dropbox.com/s/rw93zy33dl4re0y/MouseUtils.xojo_binary_project

Simply drag the MouseUtils module into your application and start using.

The following functions are implemented:

MouseUtils.HideCursor
MouseUtils.MoveCursorTo(tempx,tempy)
MouseUtils.ShowCursor

This will work for Mac & Windows but will do nothing on a Linux Target.

Additionally, I put a fair number of comments in the code to answer some of your questions above.

If you have any questions, you can contact me directly at jim underscore cramer at me dot com ( replace underscore with _ ).

Thank you, Jim!!
Like I said, our NASA connection (who happens to be a former office mate of mine before he got his second PhD :-); I’ve known him since my first linguistics class here at CU 23 years ago) is here today, and I will be working with him. But I will try out your code as soon as I am able, and I’ll let you know how it goes.

Y’all are just great!
Carolyn