match_key: Match keys from a keyboard event

Description Usage Arguments Value Author(s) References Examples

View source: R/common-events.R

Description

This is a simple wrapper function to test if the given keys are hit in the keyboard event.

Usage

1
match_key(key, event)

Arguments

key

a character vector of key names (see the example below)

event

the keyboard event (if missing, the default value comes from the event argument of the parent function (sys.frame(1)), so if this function is called under a standard callback of a layer event, we can leave this argument blank)

Value

TRUE for the matched keys, and FALSE for those not matched

Author(s)

Yihui Xie <http://yihui.name>

References

http://doc.qt.nokia.com/latest/qt.html#Key-enum

Examples

1
2
3
4
5
6
7
8
9
library(qtbase)
library(qtpaint)
library(cranvas)
key_press <- function(layer, event) {
    print(match_key(c("A", "F", "PageUp", "1"), event))
}
s <- qscene()
r <- qlayer(s, keyPressFun = key_press)
qplotView(scene = s)

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.