Created
February 2, 2023 03:44
-
-
Save rgchris/32ab9160ce7a66fb0f72d5a4b3cbf0d7 to your computer and use it in GitHub Desktop.
Intercepting Key events in Rebol 2
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
#!/usr/local/bin/rebview -iv | |
Rebol [ | |
Title: "Intercepting Key events" | |
Author: "Christopher Ross-Gill" | |
Date: 23-Feb-2017 | |
Notes: [ | |
https://rebolforum.com/index.cgi?f=printtopic&topicnumber=579&archiveflag=archive | |
] | |
] | |
view-block: [ | |
txt: field | |
entry: field feel [ | |
engage: func [ | |
face action event | |
][ | |
switch/default event/key reduce [ | |
bs [ | |
system/view/caret: remove back system/view/caret | |
] | |
cr [ | |
unview | |
] | |
escape [ | |
unview | |
] | |
'left [ | |
system/view/caret: back system/view/caret | |
; not working | |
] | |
][ | |
system/view/caret: insert system/view/caret event/key | |
] | |
set-face txt face/text | |
show face | |
event | |
] | |
] | |
] | |
view/new center-face layout view-block | |
focus entry | |
do-events |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment