Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-sig-gui-bounces at stat.math.ethz.ch [mailto:r-sig-gui-
> bounces at stat.math.ethz.ch] On Behalf Of Adrian Waddell
> Sent: Thursday, June 24, 2010 12:18 PM
> To: r-sig-gui at stat.math.ethz.ch
> Subject: [R-gui] Ask for the State of a Keyboard Key
>
> Dear GUI list,
>
> Is it possible in R to check whether a certain key is pressed or not.
>
> For example
>
> if(isKeyPressed("a")) {
> cat("a is pressed\n")
> }else {
> cat("a is not pressed\n")
> }
>
> I would like to use this function within tk events. For example when a
> '<Button-1>' event calls foo(), I would like to know within foo()
> whether the Shift key is pressed or not.
>
> I know that I could generate events when a key is pressed or released
> (with focus on a tk toplevel window). However I would prefer a function
> like isKeyPressed().
>
> Sincerely,
>
> Adrian Waddell
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui