Last active
December 18, 2015 03:39
-
-
Save Metaxal/5719809 to your computer and use it in GitHub Desktop.
Copy/paste example for keymap and text editors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/gui | |
(require framework) ; for keymap:get-editor | |
(define keymap (keymap:get-editor)) | |
#| ; Or define them yourself: | |
(define keymap (new keymap%)) | |
(add-text-keymap-functions keymap) | |
(send keymap map-function "c:x" "cut-clipboard") | |
(send keymap map-function "c:c" "copy-clipboard") | |
(send keymap map-function "c:v" "paste-clipboard") | |
(send keymap map-function "middlebutton" "paste-x-selection") | |
|# | |
(define text (new text%)) | |
(send text set-keymap keymap) | |
(define fr (new frame% [label ""])) | |
(define ed (new editor-canvas% [parent fr] | |
[editor text] | |
[min-width 400] [min-height 400])) | |
(send ed focus) | |
(send fr show #t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also possible:
but on Linux, the default bindings are then Emacs' ones (i.e., no Ctrl-x/c/v).