SimpleButtonMorph cannot clear args

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SimpleButtonMorph cannot clear args

K. K. Subramaniam
Hi,

I hit a problem with SimpleButtonMorph where I couldnt clear arguments. I
traced the problem to this code:

SimpleButtonMorph>>#setArguments
        ...
        newArgs _ FillInTheBlank
                request: 'Please type the arguments ..' translated
                initialAnswer: s contents.
        newArgs isEmpty ifFalse: [
                newArgsArray _ Compiler evaluate: '{', newArgs, '}' for: self logged: false.
                self arguments: newArgsArray].
         ...
newArgs can be empty if the user cancels the dialog or simply clears the
string. The second line assumes the first case and doesn't
affect 'arguments'. I tried the following fix:

        newArgs isEmpty ifTrue: [^self].
        newArgs = '.' ifTrue: [ ^self arguments: #() ].
        ^self arguments: (Compiler evaluate: '{', newArgs, '}' for: self logged:
false)

Is this a defect? .. Subbu