--- a/DialogBox.st Tue Oct 15 14:05:48 1996 +0200
+++ b/DialogBox.st Fri Oct 18 15:52:52 1996 +0200
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.9 on 9-sep-1996 at 22:52:00' !
-
ModalBox subclass:#DialogBox
instanceVariableNames:'buttonPanel okButton okAction abortButton abortAction
acceptReturnAsOK yPosition leftIndent rightIndent bindings
@@ -23,7 +21,7 @@
category:'Views-DialogBoxes'
!
-!DialogBox class methodsFor:'documentation'!
+!DialogBox class methodsFor:'documentation'!
copyright
"
@@ -950,7 +948,7 @@
"
! !
-!DialogBox class methodsFor:'class initialization'!
+!DialogBox class methodsFor:'class initialization'!
initialize
self == DialogBox ifTrue:[
@@ -961,7 +959,7 @@
"Modified: 10.4.1996 / 08:16:18 / cg"
! !
-!DialogBox class methodsFor:'common dialogs'!
+!DialogBox class methodsFor:'common dialogs'!
information:aString
"launch a Dialog to tell user something"
@@ -997,7 +995,7 @@
"Modified: 29.5.1996 / 15:23:14 / cg"
! !
-!DialogBox class methodsFor:'confirmation dialogs'!
+!DialogBox class methodsFor:'confirmation dialogs'!
confirm:aString
"launch a Dialog, which allows user to enter yes or no.
@@ -1118,35 +1116,62 @@
"launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', nil for 'cancel'"
+ ^ self
+ confirmWithCancel:aString
+ labels:(self
+ classResources
+ array:
+ #('cancel'
+ 'no'
+ 'yes')
+ )
+ default:nil
+ "
+ Dialog confirmWithCancel:'really ?'
+ "
+
+ "
+ Transcript showCR:(
+ Dialog confirmWithCancel:'really ?'
+ )
+ "
+
+ "Modified: 18.10.1996 / 14:51:51 / cg"
+!
+
+confirmWithCancel:aString labels:buttonLabels default:default
+ "launch a Dialog, which allows user to enter yes, no and cancel.
+ Return true for 'yes', false for 'no', nil for 'cancel'.
+ The strings for cancel, no and yes are to be passed in
+ buttonLabels; default (if non-nil) defines the index of the
+ return button (1 to 3)"
+
|box answer|
box := OptionBox title:aString numberOfOptions:3.
- box buttonTitles:(self classResources array:
- #('cancel'
- 'no'
- 'yes')
- )
+ box buttonTitles:buttonLabels
actions:(Array with:[answer := nil]
with:[answer := false]
with:[answer := true]
).
+ default notNil ifTrue:[box defaultButtonIndex:default].
box showAtPointer.
box actions:nil.
box destroy.
^ answer
"
- Dialog confirmWithCancel:'really ?'
-
- Transcript showCR:(
- Dialog confirmWithCancel:'really ?'
- )
+ Dialog
+ confirmWithCancel:'really ?'
+ labels:#('mhmh' 'maybe' 'definitely')
+ default:3
"
"Modified: 29.5.1996 / 15:24:06 / cg"
+ "Created: 18.10.1996 / 14:50:51 / cg"
! !
-!DialogBox class methodsFor:'defaults'!
+!DialogBox class methodsFor:'defaults'!
defaultLabel
"return the boxes default window title."
@@ -1156,7 +1181,7 @@
"Created: 23.4.1996 / 17:13:10 / cg"
! !
-!DialogBox class methodsFor:'file name dialogs'!
+!DialogBox class methodsFor:'file name dialogs'!
requestDirectoryName
"same as requestFileName, but only show directories."
@@ -1565,7 +1590,7 @@
"Modified: 27.1.1996 / 13:44:13 / cg"
! !
-!DialogBox class methodsFor:'fill in the blank dialogs'!
+!DialogBox class methodsFor:'fill in the blank dialogs'!
request:aString
"launch a Dialog, which allows user to enter something.
@@ -2103,7 +2128,7 @@
"Created: 17.11.1995 / 09:45:21 / cg"
! !
-!DialogBox class methodsFor:'multiple choice dialogs'!
+!DialogBox class methodsFor:'multiple choice dialogs'!
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock
"launch a Dialog showing the message and list.
@@ -5216,9 +5241,9 @@
]
! !
-!DialogBox class methodsFor:'documentation'!
+!DialogBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.90 1996-09-09 22:58:40 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.91 1996-10-18 13:52:52 cg Exp $'
! !
DialogBox initialize!