[UI] Improving ToolBuilder

Gary Chambers gazzaguru2 at btinternet.com
Tue Sep 18 10:25:05 UTC 2007


> But how can I change
> 
> OBMorphicPlatform>>handleConfirmationRequest: request
>   ^ PopUpMenu
>         confirm: request prompt
>         trueChoice: request okChoice
>         falseChoice: request cancelChoice
> 
> There is no such method in UIManager.

	^(UIManager default confirm: request prompt)
		ifTrue: [request okChoice]
		ifFalse: [request cancelChoice]

> And this one:
> 
> OBMorphicPlatform>>handleTextRequest: request
>   ^ FillInTheBlankMorph
>        request: request prompt
>        initialAnswer: request template
>        centerAt: Sensor cursorPoint
>        inWorld: World
>        onCancelReturn: nil
>        acceptOnCR: true
> 
> There is no way of returning nil on Cancel. The empty string is 
> always returned.

To be fair this is a limitation of the UIManager spec.

Assuming that an affirmative "empty" answer can count as being cancelled then...

	^(UIManager default
			request: request prompt
			initialAnswer: request template)
		ifNotEmptyDo: [:answer | answer]



More information about the UI mailing list