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

Detecting the Enter key in a field

 [1/2] from: bkalef::csc::com at: 24-Jun-2002 13:26


I'v been playing with this for a while now. I've checked out the www.rebol.com/how-to/feel.html and I have 'probed the source of field to see if I could figure out how to do. No luck as of yet. I used the below code from feel.html to get me started; view/new layout [ the-box: box "A Box" forest feel [ engage: func [face action event] [ if action = 'key [ either word? event/key [ print ["Special key:" event/key] ][ print ["Normal key:" mold event/key] ] ] ] ] ] focus the-box do-events But can't seem to get this same type of functionality to work with a 'field instead of a box. Regards, Brock

 [2/2] from: greggirwin:mindspring at: 24-Jun-2002 15:49


Hi Brock, << I used the below code from feel.html to get me started; ... But can't seem to get this same type of functionality to work with a 'field instead of a box. >> I'm not sure exactly what you're after. If you just substitute FIELD for BOX, you should get the same results. The catch, of course, is that you've replaced feel/engage for field, which may not be what you want to do. You can see the FEEL and EDIT-TEXT functions that are used to support it with: probe get in ctx-text 'edit and probe get in ctx-text 'edit-text You can write your own feel/engage and in the key handling part, call ctx-text/edit-text then do any extra processing you want to do. If you want to change the behavior (e.g. not lose focus on enter) you would check the keys before calling ctx-text/edit-text. HTH! --Gregg