Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Disabling shortcut Keys for text field entry?

From: brett:codeconscious at: 8-Jul-2001 18:12

Here's another way. You could change the detect function of system/view/window-feel which is reponsible for handling shortcut keys. I've put an example below. My example is bloated by some supporting code that allows me to install the change and uninstall it again later. The bit that makes it work is the function "install-nofieldshortcuts". Note that in the version of the code shortcuts are "turned off" for fields but still operational for areas so you can compare. install-nofieldshortcuts: does [ system/view/window-feel: make system/view/window-feel [ detect: func [face event] [ either all [ event/type = 'key system/view/focal-face system/view/focal-face/style equal? system/view/focal-face/style 'field ] [event] [old-detect face event] ] old-detect: get in system/view/window-feel 'detect ] ] uninstall-nofieldshortcuts: does [ use [wf] [ wf: system/view/window-feel set in wf 'detect get in wf 'old-detect ] ] view layout [ button "press" #"a" [print "button pressed - a"] field do [ print "Installing shortcut trap" install-nofieldshortcuts print "Installing event function" evtfunc: insert-event-func [ if equal? event/type 'close [ print "Removing shortcut trap" uninstall-nofieldshortcuts print "Removing event function" remove-event-func :evtfunc ] RETURN event ] ] ] HTH Brett.