diff -r ace25772463d -r 86dd024ed773 YesNoBox.st --- a/YesNoBox.st Sat Apr 27 20:13:37 1996 +0200 +++ b/YesNoBox.st Sat Apr 27 20:21:37 1996 +0200 @@ -88,26 +88,27 @@ examples " Examples: - - |aBox| - - aBox := YesNoBox title:'Coffee or tee ?'. - aBox noText:'tee'. - aBox yesText:'coffee'. - aBox yesAction:[Transcript showCr:'make coffee']. - aBox noAction:[Transcript showCr:'make tee']. - aBox showAtPointer. + [exBegin] + |aBox| + aBox := YesNoBox title:'Coffee or tee ?'. + aBox noText:'tee'. + aBox yesText:'coffee'. + aBox yesAction:[Transcript showCr:'make coffee']. + aBox noAction:[Transcript showCr:'make tee']. + aBox showAtPointer. + [exEnd] or, shorter: - - |aBox| + [exBegin] + |aBox| - aBox := YesNoBox new. - aBox title:'Coffee or Tee ?' - yesAction:[Transcript showCr:'make coffee'] - noAction:[Transcript showCr:'make tee']. - aBox yesText:'Coffee' noText:'Tee'. - aBox showAtPointer + aBox := YesNoBox new. + aBox title:'Coffee or Tee ?' + yesAction:[Transcript showCr:'make coffee'] + noAction:[Transcript showCr:'make tee']. + aBox yesText:'Coffee' noText:'Tee'. + aBox showAtPointer + [exEnd] Also, have a look at the inherited protocol; for example, this allows changing the bitmap (default: a question mark) and other properties. @@ -116,32 +117,34 @@ #confirm method, to bring up a box, let it ask for something and return true or false. Example: - - |box value| + [exBegin] + |box value| - box := YesNoBox new. - value := box confirm:'yes or no:'. - value ifTrue:[ - Transcript showCr:'yes' - ] ifFalse:[ - Transcript showCr:'no' - ] + box := YesNoBox new. + value := box confirm:'yes or no:'. + value ifTrue:[ + Transcript showCr:'yes' + ] ifFalse:[ + Transcript showCr:'no' + ] + [exEnd] of course, this can also be written shorter as: - - (YesNoBox new confirm:'yes or no:') ifTrue:[ - Transcript showCr:'yes' - ] ifFalse:[ - Transcript showCr:'no' - ] - + [exBegin] + (YesNoBox new confirm:'yes or no:') ifTrue:[ + Transcript showCr:'yes' + ] ifFalse:[ + Transcript showCr:'no' + ] + [exEnd] or: - - (Dialog confirm:'yes or no:') ifTrue:[ - Transcript showCr:'yes' - ] ifFalse:[ - Transcript showCr:'no' - ] + [exBegin] + (Dialog confirm:'yes or no:') ifTrue:[ + Transcript showCr:'yes' + ] ifFalse:[ + Transcript showCr:'no' + ] + [exEnd] " ! ! @@ -389,5 +392,5 @@ !YesNoBox class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.27 1996-04-25 17:19:19 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.28 1996-04-27 18:15:26 cg Exp $' ! !