HideCursor doesn't work in my program

My environment

Ubuntu 18.04.4 64bit
Octave 4.2.2
Psychotoolbox 3.0.16

Hello.
When the following demo program was executed, the mouse cursor did not disappear, even though the HideCursor function was described.

Moreover, the mouse cursor did not disappear when screenID and mouiseID were given to the function as arguments.

Does anyone know the cause of this phenomenon and how to solve it?

Thank you.

========================================
function myprogram

ListenChar(2);
AssertOpenGL;
KbName(‘UnifyKeyNames’);
%myKeyCheck;

GetSecs;
WaitSecs(0.1);
rand(‘state’, sum(100*clock));
bgColor = [128 128 128];

try

HideCursor;
% HideCursor(screenid=0, 15);
screenNumber = max(Screen(‘Screens’));
[windowPtr, windowRect] = Screen(‘OpenWindow’, screenNumber, bgColor, [100, 200, 700, 600]);

escapeKey = KbName(‘ESCAPE’);

while KbCheck; end
while 1
[ keyIsDown, seconds, keyCode ] = KbCheck;
if keyIsDown
if keyCode(escapeKey)
break;
end;
while KbCheck; end;
end;
end

Screen(‘CloseAll’);
ShowCursor;
ListenChar(0);

catch
Screen(‘CloseAll’);
ShowCursor;
ListenChar(0);
psychrethrow(psychlasterror);
end

Move the HideCursor call after the ‘OpenWindow’ call. Often OS’es + desktop environments do not allow to control cursor visibility or shape unless the cursor is located “on top” of an onscreen window.

Also it is a good idea to specify the screenid - or i think it also accepts the window handle iirc - because some OS + desktop combos also make the cursor status depending on target window or screen. Our docs and demos could be more clear and consistent about this, but they aren’t.

-mario

To Mario,

After following your advice and modifying my code, I ran the program. Then, the cursor disappeared from the top of the window.

Thank you so much for your advice!!!

-ucosabeen