The quest for a working cursor

Hello everyone!

I’ve been looking into making a cursor that would work well with a small project I’m playing around with, but it’s been surprisingly hard.

Here are the things I’ve tried so far [And the problem with it]:

  • Use default hardware cursor by just setting bShowMouseCursor in my playercontroller (I want to have a custom cursor, so doesn’t work]
  • Use custom hardware cursor by having bShowMouseCursor, setting the DefaultMouseCursor/CurrentMouseCursor and setting a custom HCURSOR using ((FWindowsCursor*)FSlateApplication::Get().GetPlatformCursor()).SetCustomShape(LoadCursorFromFile(…)) [This seemed to work, but has the UMG problem described below]
  • Use custom software cursor by rendering using slate and drawing UMG widgets as a part of the slate UI, but rendering the cursor on the top. [This has the UMG problem as well, but also has problems with the cursor freezing completely when holding down the mouse on a UMG widget. I suppose the UMG widgets are returning handled on the FReply’s, which stops the slate callbacks from being run.]
  • Use the Default Cursor setting in Project Settings->User Interface [Also has the UMG problem, but as a twist, it duplicates the cursor and draws it a bit smaller and lighter to the top left of the main cursor]

The UMG cursor problem I mention is that when I press down on a UMG button, the system shows the default windows cursor again, until I click the game window once more. It kind of looks like the game window loses focus completely and needs to be refocused. I tried to run SetFocus on the HWND to see if that would fix it, but in my case it did not.

The only other thread I’ve found that seems to have similar symptoms is a thread from a year ago:

where Rudy Triplett gives a hackish solution to the op’s problem. I haven’t tried this solution, but it seems so roundabout I would not be happy with using it anyhow.
Has anyone else run into this problem and found a good solution I wonder?

My next step will be looking around in the source and see if I can see what is going wrong, but before starting that I thought I would post and see if someone has some wisdom to share :slight_smile:

Best regards,

Well, I fixed it I suppose.

I started digging around in the source and subclassed the button class to debug it a bit, but while doing this I seemed to have angered the editor somehow, since it stopped displaying the cursor at all, no matter what I did. I assumed I must have destroyed some editor serialized data somewhere, so I cleared all my transient folders.

Only, when getting back into the editor after the refresh, the cursor is now working without my previous problems using the Default Cursor setting in Project Settings->User Interface.

So my advice for anyone running into similar problems, doing that is my fix recommendation :slight_smile:

Best regards,