Re: waiting for pressed key and reading key
- To: mathgroup at smc.vnet.net
- Subject: [mg87616] Re: waiting for pressed key and reading key
- From: dh <dh at metrohm.ch>
- Date: Mon, 14 Apr 2008 05:46:10 -0400 (EDT)
- References: <ftsd13$bar$1@smc.vnet.net>
Hi Adrian,
you may use a "KeyDown" event, e.g. like:
EventHandler["Cursor
here",{{"KeyDown","a"}:>(var=1;),{"KeyDown","b"}:>(var=2;)}]
hope this helps, Daniel
Adrian Lupascu wrote:
> Hi everyone,
>
> I am interested to include in a program a part in which the program
> waits until either of two specific keys are pressed, and once this
> happens waiting is over and the one key (ut of the two) which was
> pressed determines the value of a variable. I basically want to use as a
> mean to read user confirmation.
> I figured out how to do something in this line by using a DynamicModule,
> with an EventHandler that wait for a mouse click. The problem I have
> with that is that I would prefer to use keys and also that
> "MouseClicked" event requires the cursor to be positioned over a certain
> expression.
> Any help is appreciated.
>
> Thanks,
> Adrian
>
>
>