getmouse

Hi--

I'm having trouble using getMouse to record the location of a mouse click. For
some reason, it is recording the location properly, but then when I go to, say,
check for accuracy, everything is recorded as accurate.... Is something weird
going on where I have to flushevents or something?

Here is are two bits of my code:

This records the location as x and y

keepchecking = 1;
while (keepchecking == 1)
[x,y,buttons] = GetMouse;
if any(buttons) % the mouse has been pressed,
keepchecking = 0; % end while-loop.
end
end

And this compares those values to what they are supposed to be. "missingx"
and "missingy" are the correct values. I'm giving people 50 points in either
direction as leeway.

if (((missingx-50) < x < (missingx+50)) & ((missingy-50) < y < (missingy+50)))
trialmatrix(i,8) = 1;
else
trialmatrix(i,8) = 0;
end

For some reason, no matter where I click, the value keeps getting set to 1,
even if I'm way off. Any thoughts?