Virtual Events

A virtual event corresponds to one or more event sequences. When any of the event sequences occurs, then the virtual event occurs. The next example shows the default virtual events for each platform:

Example 26-4 Virtual events for cut, copy, and paste.
switch $tcl_platform(platform) {
    "unix" {
      event add <<Cut>> <Control-Key-x> <Key-F20>
      event add <<Copy>> <Control-Key-c> <Key-F16>
      event add <<Paste>> <Control-Key-v> <Key-F18>
   }
   "windows" {
      event add <<Cut>> <Control-Key-x> <Shift-Key-Delete>
      event add <<Copy>> <Control-Key-c> <Control-Key-Insert>
      event add <<Paste>> <Control-Key-v> <Shift-Key-Insert>
   }
   "macintosh" {
      event add <<Cut>> <Control-Key-x> <Key-F2>
      event add <<Copy>> <Control-Key-c> <Key-F3>
      event add <<Paste>> <Control-Key-v> ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.