check for numArgs == 0 before evaluating the keyAction
authorboris
Wed, 07 Mar 2007 10:03:33 +0100
changeset 3462 447eb65a523f
parent 3461 0b3cc6fc00ef
child 3463 8408a4c800db
check for numArgs == 0 before evaluating the keyAction
EditField.st
--- a/EditField.st	Tue Mar 06 21:11:30 2007 +0100
+++ b/EditField.st	Wed Mar 07 10:03:33 2007 +0100
@@ -1526,7 +1526,7 @@
                           #DeleteLine #GotoLine #EndOfLine #EndOfText
                           #CursorDown #CursorUp)>
 
-    |leave oldContents newContents doAccept keyAction didAccept|
+    |leave oldContents newContents doAccept keyAction didAccept numArgs|
 
     enabled ifFalse:[
         ^ self
@@ -1581,9 +1581,14 @@
     ].
 
     keyAction notNil ifTrue:[
-        keyAction numArgs == 2 ifTrue:[
+        numArgs := keyAction numArgs.
+
+        numArgs == 2 ifTrue:[
             ^ keyAction value:self value:key
         ].
+        numArgs == 0 ifTrue:[
+            ^ keyAction value
+        ].
         ^ keyAction value:key
     ].
 
@@ -2186,5 +2191,5 @@
 !EditField class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.187 2007-03-06 20:11:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.188 2007-03-07 09:03:33 boris Exp $'
 ! !