Mouse cursor/pointer invisible on full screen mode only

8 views (last 30 days)
I have a Matlab program that runs an experimental paradigm via the Cogent toolbox. At the start of the code there is an if statement that defines whether Cogent opens in a window or as full screen. The problem I have is that the mouse cursor/pointer disappears when I open in full screen, but not when I open as a window. On investigation it appears that in full screen the cursor is still there (i.e I can record mouse button clicks) but it can't be seen on the screen. Presumably therefore the cursor is somehow set to invisible, or to the same colour as the background of the screen (black).
I've tried a few things using the SET statement to try and make the cursor visible but to no avail. I can't find a way to change the colour of the cursor using MatLab. Any ideas how I can solve this issue or at least troubleshoot it further? I've included the code below.
Alternatively it may be a bug with the cgopen statement, however I can't find any report of similar occurences and I can't open the cgopen code to have a look, as it is not in .m file format. Is there anywhere to get help on Cogent - no help address appears to be listed on their website/documentation.
Thanks Rob
if(iNumber>1000)
cgopen(1,0,0,1) %Full screen
rng('default') %Sets matlab rand functions to their default settings
set(0, 'visible', 'on') %added for troubleshooting, no diff if removed
set(gcf,'pointer','crosshair') %added for t-shooting, no diff if removed
mid_loc = [0; 0] %added for troubleshooting, no difference if removed
set(0, 'pointerlocation', mid_loc) %added for t-shooting, no diff if rmvd
else
cgopen(1,0,0,0) %640*480
end

Answers (2)

Eydrian
Eydrian on 20 Oct 2015
cogent is a third party toolbox. You are trying to mix it with matlab graphic properties, this will never result in something useful. But there is a solution. The cogent mouse mode is exclusive to cogent by default and the cogent developers did not intend to give the user the possibility to change that fact. But you can cheat: after initializing the mouse but before starting cogent, you can set the mouse to nonexclusive:
...
config_mouse(10);
global cogent; % loads the global cogent variable
cogent.mouse.mode = 'nonexclusive';
...
start_cogent();

Robert
Robert on 2 Oct 2014
Hi
An update on this if anyone is interested. I couldn't find a solution - it appears to be some sort of bug with 'cgopen'.
The workaround I've used is to basically draw my own cursor in the code (see below). It's not ideal as the cursor (and therefore the buffer) has to refresh continuously. This means that whatever else you are showing will also have to be continuoulsy re-drawn, which is not really an efficient use of processing resources.
bp=0;
while bp==0;
[x,y,bp,bs] = cgmouse; %record mouse position and button state
%%%%%%%%%%%%%%%%
%Code for whatever else you want to show on screen
%%%%%%%%%%%%%%%
%draw cursor
cgpencol(1,1,1);
cgfont('Arial',64)
cgdraw(x,y,x+5,y)
%refresh screen
cgflip(0,0,0);
end

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!