diff -r 7cc1e330da47 -r f4eaf04d1eaf YesNoBox.st --- a/YesNoBox.st Thu Nov 17 15:34:12 1994 +0100 +++ b/YesNoBox.st Thu Nov 17 15:38:53 1994 +0100 @@ -21,7 +21,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.7 1994-10-10 03:03:30 claus Exp $ +$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.8 1994-11-17 14:38:51 claus Exp $ '! !YesNoBox class methodsFor:'documentation'! @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.7 1994-10-10 03:03:30 claus Exp $ +$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.8 1994-11-17 14:38:51 claus Exp $ " ! @@ -66,6 +66,17 @@ There is also protocol to set both button titles in one message. Also, the action associated to the noButton can be changed. + For very simple yes/no queries, you can also use the much simpler confirm:. + Since implemented in Object, everyone understands confirm. You can pass + a question message (but not change the buttons labels). + Use is: + self confirm:'some question' + and will return true or false. +" +! + +examples +" Examples: |aBox| @@ -138,7 +149,7 @@ !YesNoBox class methodsFor:'easy startup '! -confirm:aTitle +XXconfirm:aTitle ^ self new confirm:aTitle ! ! @@ -153,6 +164,8 @@ initialize super initialize. + buttonPanel layout:#fit. "/ looks better; should it come from the StyleSheet ? + textLabel label:'please Confirm'. okButton label:(resources at:'yes'). @@ -175,7 +188,8 @@ have to be defined. The title is used as previously defined." self yesAction:[^ true] noAction:[^ false]. - self showAtPointer + self showAtPointer. + self yesAction:nil noAction:nil. "/ clear actions for earlier release of context " YesNoBox new confirm @@ -299,9 +313,11 @@ noButton width:max; fixSize. w := (formLabel width + textLabel width) max:max * 2. w := w + (3 * ViewSpacing) + (okButton borderWidth + noButton borderWidth * 2). - h := (3 * ViewSpacing) + h := ViewSpacing + ((formLabel height) max:(textLabel height)) - + okButton heightIncludingBorder. + + (ViewSpacing * 3) + + okButton heightIncludingBorder + + ViewSpacing. ^ (w @ h). ! !