--- a/DialogBox.st Mon Jun 11 11:21:51 2001 +0200
+++ b/DialogBox.st Tue Jun 12 15:14:44 2001 +0200
@@ -1198,20 +1198,22 @@
InitialAnswer must be true or false and defines which button is to be
the default (i.e. return-) button"
- |box answer|
-
- box := YesNoBox title:aString.
- box yesAction:[answer := true] noAction:[answer := false].
- what == false ifTrue:[
- box okButton isReturnButton:false.
- box acceptReturnAsOK:false.
- box cancelButton beReturnButton.
- ].
- box label:(self classResources string:'confirm').
- box showAtPointer.
- box yesAction:nil noAction:nil.
- box destroy.
- ^ answer
+ ^ self confirm:aString title:nil yesLabel:nil noLabel:nil initialAnswer:what.
+
+"/ |box answer|
+"/
+"/ box := YesNoBox title:aString.
+"/ box yesAction:[answer := true] noAction:[answer := false].
+"/ what == false ifTrue:[
+"/ box okButton isReturnButton:false.
+"/ box acceptReturnAsOK:false.
+"/ box cancelButton beReturnButton.
+"/ ].
+"/ box label:(self classResources string:'confirm').
+"/ box showAtPointer.
+"/ box yesAction:nil noAction:nil.
+"/ box destroy.
+"/ ^ answer
"
Dialog confirm:'really ?' initialAnswer:false
@@ -1274,28 +1276,7 @@
return true for yes, false for no.
The yes/no buttons labels are defined by yesText/noText."
- |box answer t|
-
- box := YesNoBox title:aString.
- yesText notNil ifTrue:[
- box yesLabel:yesText.
- ].
- noText notNil ifTrue:[
- box noLabel:noText.
- ].
- answer := false.
- box yesAction:[answer := true].
- title notNil ifTrue:[
- t := title
- ] ifFalse:[
- t := self classResources string:'confirm'
- ].
-
- box label:t.
- box showAtPointer.
- box yesAction:nil noAction:nil.
- box destroy.
- ^ answer
+ ^ self confirm:aString title:title yesLabel:yesText noLabel:noText initialAnswer:true
"
Dialog
@@ -1325,6 +1306,61 @@
"Modified: / 18.4.1998 / 19:25:21 / cg"
!
+confirm:aString title:title yesLabel:yesText noLabel:noText initialAnswer:what
+ "launch a Dialog, which allows user to enter yes or no.
+ return true for yes, false for no.
+ The yes/no buttons labels are defined by yesText/noText."
+
+ |box answer t|
+
+ box := YesNoBox title:aString.
+ yesText notNil ifTrue:[
+ box yesLabel:yesText.
+ ].
+ noText notNil ifTrue:[
+ box noLabel:noText.
+ ].
+ answer := false.
+ box yesAction:[answer := true].
+ title notNil ifTrue:[
+ t := title
+ ] ifFalse:[
+ t := self classResources string:'confirm'
+ ].
+
+ box label:t.
+ what == false ifTrue:[
+ box okButton isReturnButton:false.
+ box acceptReturnAsOK:false.
+ box cancelButton beReturnButton.
+ ].
+
+ box showAtPointer.
+ box yesAction:nil noAction:nil.
+ box destroy.
+ ^ answer
+
+ "
+ Dialog
+ confirm:'really ?'
+ title:'fooBar'
+ yesLabel:'oh well'
+ noLabel:'nope'
+ initialAnswer:true
+ "
+ "
+ Dialog
+ confirm:'really ?'
+ title:'fooBar'
+ yesLabel:'oh well'
+ noLabel:'nope'
+ initialAnswer:false
+ "
+
+ "Created: / 21.2.1996 / 01:10:14 / cg"
+ "Modified: / 18.4.1998 / 19:25:21 / cg"
+!
+
confirm:aString yesLabel:yesText noLabel:noText
"launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
@@ -6861,6 +6897,6 @@
!DialogBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.165 2001-05-17 12:17:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.166 2001-06-12 13:14:44 cg Exp $'
! !
DialogBox initialize!