[R] tkbind key pressed
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Dec 9 23:51:59 CET 2005
"Manel Salamero" <10133msb at comb.es> writes:
> Hi,
>
> I see in Wettenhall RTclTk Examples that tkbind(xxx, <Key>,...) can
> pass the key pressed. How can I get the key pressed?
By making the callback function have an argument with a specific name.
Lookup the %-codes in the Tk man page for "bind". There are multiple
codes for getting the key as keycode, keysym, Unicode character,...
E.g.
%K The keysym corresponding to the event, substituted as a textual
string. Valid only for KeyPress and KeyRelease events.
so if you declare your callback to be
f <- function(K) print(K)
the keysym should be printed to the console.
[actually. that might be print(tclvalue(K)) --- I forget whether these
arguments are passed as tclObj's.]
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list