Skip to content

Instantly share code, notes, and snippets.

@rgchris
Created February 2, 2023 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgchris/32ab9160ce7a66fb0f72d5a4b3cbf0d7 to your computer and use it in GitHub Desktop.
Save rgchris/32ab9160ce7a66fb0f72d5a4b3cbf0d7 to your computer and use it in GitHub Desktop.
Intercepting Key events in Rebol 2
#!/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