[UI] Improving ToolBuilder

Gary Chambers gazzaguru2 at btinternet.com
Tue Sep 18 10:42:50 UTC 2007


Best take the last one from Andreas. What was I thinking... (ifEmpty: []).

> -----Original Message-----
> From: ui-bounces at lists.squeakfoundation.org 
> [mailto:ui-bounces at lists.squeakfoundation.org] On Behalf Of 
> Gary Chambers
> Sent: 18 September 2007 11:25 am
> To: Squeak's User Interface
> Subject: RE: [UI] Improving ToolBuilder
> 
> 
> > 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]
> 
> _______________________________________________
> UI mailing list
> UI at lists.squeakfoundation.org 
> http://lists.squeakfoundation.org/mailman/listinfo/ui
> 



More information about the UI mailing list