In Xojo, there is System.Cursors.Wait, but there doesn’t seem to be a way to switch to the Windows ArrowHourglass cursor. I don’t think such a cursor exists on Mac which might be why it’s missing, but I don’t want to embed my own mouse cursor graphic in there since the system one varies based on Windows version and theme.
Thanks for the reply, but the ArrowHourglass is an animated cursor, not a bitmap. On Windows 10 (I haven’t upgraded to 11 yet so I can’t speak to that) it’s the arrow with the blue spinner at the top right, which is animated. And it’s been animated ever since Windows Vista I believe.
Here’s what it looks like on Win10 for reference. Sorry for the crappy phone recording but screen capture software doesn’t capture the mouse cursor, it saves the position and draws it in later so it’s representation of the mouse is unreliable.
Yes, but the System.Cursors.Wait cursor replaces the entire mouse with the blue spinner, it has no arrow next to it. It’s a different cursor for a different situation.
The cursor with the arrow attached indicates to the user that the mouse is still functional, they can still click the cancel button for example. We developers know you can still click the cancel button while the cursor is System.Cursors.Wait but not only is it not obvious to the user, they also have to guess where the hotspot of the mouse is on the wait cursor.
vbArrowHourglass, despite “hourglass” being in the name, was just an enum that loaded the correct cursor. In .NET it’s Cursors.AppStarting while Xojo’s System.Cursors.Wait is equivalent to .Net’s Cursors.WaitCursor.
Here’s all the cursors that .Net enumerates, you can see the difference between .AppStarting and .WaitCursor:
Xojo doesn’t seem to have an equivalent cursor for Cursors.AppStarting (or vbArrowHourglass as it was called in VB6).
Been working on this for two days now, and nothing I tried gets it to work.
I did end up picking up @Eugene_Dakin 's Declares book and it’s fantastic. He points out:
It is not recommended to use … API declares for setting the cursor … Xojo calls SetCursor often, so declares will only change the mouse for an instant and will then return to its normal state… The solution is to use the built-in Xojo MouseCursor class.
And I think this is what I’m running into because my declares should be working. Perhaps my attempts are actually successful but the Xojo framework resets the mouse cursor before I can even see it. I was able to get it to work successfully on a new window, created with CreateWindowEx, that is not managed by the Xojo framework. But at that point I might as well use C++ instead of Xojo.
As @MarkusR pointed out, a picture array might be one approach, but I can’t figure out how to parse the individual frames out of an .ANI file.
i would use an online converter or paint tool and images as static app ressource.
or delayed switch between pointer and wait if mouse is on same place, means not move.
and what if windows 12 not have your file,renamed it, change the format, or you app is 100% sandbox?
windows 11 ■■■■■■ up everything … mouse look is the least of my worries.
I agree this is not ideal, I created a feedback case to get Xojo to add the cursor to the Cursors type. It literally would be the exact same code as the Wait cursor except they’d send 32650 to the LoadCursorW function instead of 32514.
I can’t worry about what future versions of Windows will bring - When a new OS breaks something, we patch the software, that’s how it’s always worked. But the reason the mouse cursor is important is:
How does the user know they can click the cancel button here? And where is the hotspot of the mouse? Is it in the top left? Center? Everything is a guess from the user’s perspective. The solution is already built into the Windows API, we just can’t access it from a Xojo window.
Appreciate the help though, cheers and best of luck with your projects on Win11. I’ve had some frustrations with the OS as well (which is why I haven’t upgraded my personal system yet).
How does the user know they can click the cancel button here?
the area of popup where the user get information that he must wait get the wait cursor.
if the user move the mouse over other ui he could get this default pointer.
or
you would use a progress bar or progress wheel and let the mouse a arrow if your app is accessible.
This project allow the user to change the ListBox MouseCursor, using one of the System.Cursors OR Custom.
What is Custom in this context ?
The code takes the Clipboard available Picture and convert it as a cursor (I made a copy of and get that as a cursor (RAW Cursor, whith white background since it was only to recall how this project worked).
Of course, this MouseCursor change when the Mouse is ut of the ListBox.
I do not tried to create a multiple Picture object, so I do not know if this work.
I wrote that on January 22nd, 2022, and run it now with Xojo 2022r2 (m1 MacBookPro / Monterey 12.5). The code is some lines only (including tests)… but warning: you can pass a large image asa MouseCursor (on macOS, not tested on WIndows) by error, so limit the picture size.
Case "Custom"
Dim Clip As New Clipboard
Dim Curs_Pict As New Picture(40,40)
If Clip.PictureAvailable Then
Curs_Pict = Clip.Picture
Clip.Close
Dim thisMouse As New MouseCursor(Curs_Pict, 0, 0)
Me.MouseCursor = thisMouse
End If
Remember: in my code above, I use a ScreenShot I’ve done before I click in Custom (last line of the first screen shot above).
Thus my question above: what do not worked for you ?