We can use:
SetOptions[EvaluationNotebook[], NotebookEventActions -> {{"KeyDown","s"} :> Print["triggered"]}]
to make the current notebook respond to s button press, also we can do the same to Modifier Keys like Ctrl, Shift, Alt or so.
Can we do the same with Backspace, Delete or F1~F12?
Additionally, can we detect the mouse-wheel's scrolling state?
Answer
Following detects backspace on Mac:
SetOptions[EvaluationNotebook[],NotebookEventActions->
{{"KeyDown","\.08"}:>Print["triggered"]}]
This code can be helpful for finding out different codes for non-standard keys.
SetOptions[EvaluationNotebook[],NotebookEventActions->
{"KeyDown":>Print[FullForm@CurrentValue["EventKey"]]}]
Comments
Post a Comment