SimpleButtonMorph cannot clear args

subbukk subbukk at gmail.com
Sun May 20 15:46:38 UTC 2007


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



More information about the Squeak-dev mailing list