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

Hard to kill key-event....

 [1/2] from: jfdutcher1958::yahoo::com at: 16-Jun-2004 12:39


The code snip below traps key presses nicely......what I don't get is why when I do: 'return none' as shown, due to satisfaction of the 'if' statement that checks for the length of the face field, the relavant 'face/text' still appears to get updated with the very character I think I am preventing from getting there....(ala: 'return none'). The next key-event handled re-triggers the same error. The 'fields' involved (style 'numbox') all show (2) or less characters in them in the GUI, so the 3rd character never got displayed after 'return none' which is good ... but appears to be continuing to affect the length of 'face/text' ??? ****************************** <pre> key-event: func [face event] [ if event/type = 'key [ ch: event/key if ch = 'left [return event] if ch = 'right [return event] if ch = #"^-" [return event] if not find "0123456789" ch [alert "Only digits can be entered" return none] foreach face lotto-layout/pane [ if face/style = 'numbox [ if 2 < (1 + length? face/text) [alert "Maximum of two digits per box" return none ] ] ] ] if event/type = 'close [ print "Removing event function" remove-event-func :key-event unview/all ] RETURN event ] </pre>

 [2/2] from: carl:rebol at: 16-Jun-2004 13:51


Your code works fine here, using the latest beta (1.2.47). Probably was in the fixes, my guess. If you are using VID, you might want to modify the feel/engage of numbox, rather than use insert-event-func. Of course, I don't know what your goal is, so what do I know. Anyway, just had to make a comment before "vanishing again" back to the home planet, as Pekr likes to say. -Carl At 12:39 PM 6/16/2004, you wrote: