Touchscreen inputs may be too transient to be captured by repetitively checking mouse status ?

2 views (last 30 days)
Hello, experts.
I'm using Psychtoolbox. I usually wait for and detect a mouse input like this:
while true
[x, y, button] = GetMouse ;
if any(button)
break
end
end
And it works fine with mouse. But when I run this with the touchscreen of Microsoft Surface, I often have to poke several times with my finger to input a click. The mouse works fine with my code on Surface, and the touchscreen works fine in all Windows applications on Surface except when running my code.
I doubt that it's because when I poke the touchscreen, the effect equals a very brief mouse click on that point. Sometimes the duration of the click includes the time when the function GetMouse runs, and a click would be received by my code. But sometimes the duration of the click doesn't include the time when the function GetMouse runs, so my code does not detect the click.
Is my guess correct? If not, what might the cause be? Could any of you experts please tell me how can I detect inputs on touchscreen sensitively? Thank you a lot if you help!
  2 Comments
Chip
Chip on 1 Mar 2018
I am having the same problem, but it is only a problem for the first touch. Subsequent touches seem to be detected on time and accurately. In fact, my program works fine if I "double" the first touch (but this is not an adequate solution). Did you find the solution to your problem, Bisconect?

Sign in to comment.

Accepted Answer

bisconect
bisconect on 21 Jun 2018
Hi, I asked that question in PsychToolbox forum, and someone told me that the latest version of Psychtoolbox in Windows was not designed for touchscreen, so many unexpected situation may occur. The latest version of PsychToolbox in Linux was newer and compatible with touchscreen.
So I installed Ubuntu and PsychToolbox for Linux in my touchscreen computer, then everything worked fine. I hope this solves your problem.

More Answers (1)

Jan
Jan on 2 Jun 2017
Using a callback of the underlying object will be a much better approach than a polling loop.
  2 Comments
bisconect
bisconect on 8 Jun 2017
Thanks for the reply.
From what I've seen, "callback" seems to work only for objects in figure windows. But I'm not going to open any figure window, I use Psychtoolbox functions like Screen('FillOval') to draw pictures, which is probably built on OpenGL. Is it feasible to make a callback function without any figure window?
Jan
Jan on 8 Jun 2017
Edited: Jan on 8 Jun 2017
This seems to be a good question for a PsychToolbox forum.
What about using GetClicks instead? See also KbQueueCreate, which is thought exactly for this problem.
Note that I do not know the PsychToolbox and used just Google to find these suggestions.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!