 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mjj1998 Guest
|
Posted: Thu Apr 14, 2005 7:12 am Post subject: Detect MouseDown during specified time |
|
|
Hi,
I'm creating a program with Delphi 7 that measures the reaction time
(RT) of a user when they click a mouse button after stimuli
presentation. The stimuli is presented on a form (full-screen) with a
TImage and TLabel visible. The correct response can be either the left
or right mouse button (depending on specfic cues presented before the
stimulus & picked randomly). This process is called a trial, and there
are many trials presented one after the other.
I am using the QueryPerformanceCounter method to measure the user's RT
for each trial (this seems to be the most accurate way to get
millisecond recording under WinXP - although I am aware that Windows
does occaisionally slice away to do other things, but this can't be
helped). What I need to do is record which mouse button was pressed,
but only during at a specific time. For each trial, 2 events can
happen:
1) If no button is pressed, the trial remains on the screen until 5
seconds has elapsed. The next trial then begins; or
2) If a mouse button is pressed, the trial ends and next trial begins
(after a slight delay).
At the end of each trial the mouse-click capture procedure should be
deactivated and only activated again when the next trial begins. The
mouse-click event isn't related to any object on the form (no object
needs to be "clicked" and eventually I want the mouse cursor to be
invisible during the trial) and it only needs to be active during a
certain time period (so I can't just use the OnMouseDown event handler
on the form itself).
I am having a lot of trouble trying to get this to work. My Delphi
training so far has been self-taught and I've been going fairly well,
but I'm hoping someone may be able to help me with this problem.
Thanks in advance!
~Mj
|
|
| Back to top |
|
 |
ATM Dude Guest
|
Posted: Wed Apr 20, 2005 7:21 am Post subject: Re: Detect MouseDown during specified time |
|
|
| Quote: | At the end of each trial the mouse-click capture procedure should be
deactivated and only activated again when the next trial begins. The
mouse-click event isn't related to any object on the form (no object
needs to be "clicked" and eventually I want the mouse cursor to be
invisible during the trial) and it only needs to be active during a
certain time period (so I can't just use the OnMouseDown event handler
on the form itself).
|
You can use the OnClick event for the form, and perhaps, the object
that presents your stimuli, I don't know how to make a mouse event
global, but I know just about everything's got an OnClick event, so if
it were me, I would be setting the OnClick for everything
on your form to the same procedure.
I would have a "mouse click ok" global (don't tell anybody I suggested a
global var, though) that your OnClick method would check before
continuing. if MouseOK then Begin {do your thing} end else Begin
{ignore} end; etc. The OnClick event will tell you which mouse
button(s) were pressed and can stop the trial timer.
A timer for your trial length, pop stimuli up, start TrialTimer, set
MouseOK to TRUE, TrialTimer.OnTimer event would signal that no mouse
button was clicked. Trial timer's OnTimer event sets MouseOK to FALSE,
clears previous trial, and starts inter-stimuli timer. inter-stimuli
timer's OnTimer event starts next trial.
Good luck.
Erik
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|