allow more than 1 numArg for an action
authorca
Tue, 03 Feb 1998 20:01:55 +0100
changeset 568 7c4482bf37cf
parent 567 2406b6193e93
child 569 8df885a4b692
allow more than 1 numArg for an action
UIPainterView.st
--- a/UIPainterView.st	Tue Feb 03 17:17:10 1998 +0100
+++ b/UIPainterView.st	Tue Feb 03 20:01:55 1998 +0100
@@ -502,22 +502,33 @@
 !
 
 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
-    |selector args showIt code alreadyInSuperclass|
+    |selector args showIt code alreadyInSuperclass numArgs method|
 
     selector := aspect asSymbol.
 
     alreadyInSuperclass := targetClass superclass canUnderstand:selector.
 
-    (selector numArgs) == 1 ifFalse:[
+    numArgs := selector numArgs.
+    method  := aspect.
+
+    numArgs == 1 ifTrue:[
+        args := 'anArgument'.
+        showIt := ''' , anArgument printString , '' ...''.\'.
+    ] ifFalse:[    
         args := ''.
         showIt := ' ...''.\'.
-    ] ifTrue:[
-        args := 'anArgument'.
-        showIt := ''' , anArgument printString , '' ...''.\'.
+
+        numArgs ~~ 0 ifTrue:[
+            method := ''.
+
+            selector keywords keysAndValuesDo:[:i :key|
+                method := method, key, 'arg', i printString, ' '
+            ]
+        ]
     ].
 
     code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
-                aspect , args , '\' ,
+                method , args , '\' ,
                 '    "automatically generated by UIPainter ..."\\' ,
                 '    "*** the code below performs no action"\' ,
                 '    "*** (except for some feedback on the Transcript)"\' ,