diff -r 366fca254239 -r 816259bd3408 DialogBox.st --- a/DialogBox.st Wed May 29 14:56:00 1996 +0200 +++ b/DialogBox.st Wed May 29 15:15:25 1996 +0200 @@ -1563,75 +1563,249 @@ or the empty string (if cancel was pressed)" ^ self - request:aString - displayAt:nil - centered:false - action:nil - initialAnswer:'' + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:'' + onCancel:'' " Dialog - request:'enter a string:' + request:'enter a string:' " - "Modified: 27.1.1996 / 14:44:30 / cg" + "Modified: 29.5.1996 / 14:26:25 / cg" ! request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial "launch a Dialog, which allows user to enter a string. - If aPoint is nonNil, the box is shown there, optionally centered. - If it is nil, it is shown at the current pointer position or at the screen center. + If aPoint is nonNil, the box is shown there, optionally centered around + that point. + If it is nil, it is shown at the current pointer position or at the + screen center. Return the string or an empty string (if cancel was pressed)" ^ self - request:aString - displayAt:aPoint - centered:centered - action:resultAction - initialAnswer:initial - onCancel:'' + request:aString + displayAt:aPoint + centered:centered + action:resultAction + initialAnswer:initial + onCancel:'' " centered around 200@200: - Dialog - request:'enter a string:' - displayAt:200@200 - centered:true - action:[:result | result printNewline] - initialAnswer:'the default' + Dialog + request:'enter a string:' + displayAt:200@200 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' origin at 200@200: - Dialog - request:'enter a string:' - displayAt:200@200 - centered:false - action:[:result | result printNewline] - initialAnswer:'the default' + Dialog + request:'enter a string:' + displayAt:200@200 + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' under mouse pointer: - Dialog - request:'enter a string:' - displayAt:nil - centered:false - action:[:result | result printNewline] - initialAnswer:'the default' + Dialog + request:'enter a string:' + displayAt:nil + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' centered on the screen: - Dialog - request:'enter a string:' - displayAt:nil - centered:true - action:[:result | result printNewline] - initialAnswer:'the default' + Dialog + request:'enter a string:' + displayAt:nil + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' " "Created: 7.12.1995 / 23:14:10 / cg" - "Modified: 27.1.1996 / 14:44:08 / cg" + "Modified: 29.5.1996 / 14:19:36 / cg" +! + +request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel onCancel:cancelValue + "launch a Dialog, which allows user to enter a string. + If aPoint is nonNil, the box is shown there, optionally centered around it. + If it is nil, it is shown at the current pointer position or at the + screen center (if centered is true). + The ok-button is labelled okLabel (or the default, ifNil), + the cancel-button is labelled cancelLabel (or the default, ifNil). + Return the string or the value of cancelValue (if cancel was pressed)" + + ^ self + request:aString + displayAt:aPoint + centered:centered + action:resultAction + initialAnswer:initial + okLabel:okLabel + cancelLabel:cancelLabel + title:nil + onCancel:cancelValue + + " + at topLeft (centering is suppressed, to make the box fully visible) + Dialog + request:'enter a string:' + displayAt:0@0 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + onCancel:#foo + + centered around 200@200: + + Dialog + request:'enter a string:' + displayAt:200@200 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + onCancel:#foo + + topLeft of box at 200@200: + + Dialog + request:'enter a string:' + displayAt:200@200 + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + onCancel:#foo + + under mouse pointer: + + Dialog + request:'enter a string:' + displayAt:nil + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + onCancel:#foo + + centered on the screen: + + Dialog + request:'enter a string:' + displayAt:nil + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + onCancel:#foo + " + + "Created: 7.12.1995 / 23:14:10 / cg" + "Modified: 29.5.1996 / 14:35:45 / cg" +! + +request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue + "launch a Dialog, which allows user to enter a string. + The dialogs window is titled titleString, or the default (if nil). + If aPoint is nonNil, the box is shown there, optionally centered around it. + If it is nil, it is shown at the current pointer position or at the + screen center (if centered is true). + The ok-button is labelled okLabel (or the default, ifNil), + the cancel-button is labelled cancelLabel (or the default, ifNil). + Return the string or the value of cancelValue (if cancel was pressed)" + + |box| + + box := EnterBox title:aString. + box initialText:initial. + box abortAction:[:val | ^ cancelValue value]. + okLabel notNil ifTrue:[ + box okText:okLabel. + ]. + cancelLabel notNil ifTrue:[ + box abortText:cancelLabel + ]. + resultAction isNil ifTrue:[ + box action:[:val | ^ val] + ] ifFalse:[ + box action:[:val | ^ resultAction value:val] + ]. + titleString notNil ifTrue:[ + box label:titleString + ]. + + aPoint notNil ifTrue:[ + box showAt:aPoint center:centered + ] ifFalse:[ + centered ifTrue:[ + box showAtCenter + ] ifFalse:[ + box showAtPointer + ] + ]. + ^ cancelValue value. + + " + centered around 200@200: + + Dialog + request:'enter a string:' + displayAt:200@200 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + title:'foo' + onCancel:#foo + + under mouse pointer: + + Dialog + request:'enter a string:' + displayAt:nil + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + title:'foo' + onCancel:#foo + + centered on the screen: + + Dialog + request:'enter a string:' + displayAt:nil + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + title:'foo' + onCancel:#foo + " + + "Created: 29.5.1996 / 14:35:04 / cg" + "Modified: 29.5.1996 / 14:37:13 / cg" ! request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial onCancel:cancelValue @@ -1640,80 +1814,69 @@ If it is nil, it is shown at the current pointer position or at the screen center. Return the string or the value of cancelValue (if cancel was pressed)" - |box| - - box := EnterBox title:aString. - box initialText:initial. - box abortAction:[:val | ^ cancelValue value]. - resultAction isNil ifTrue:[ - box action:[:val | ^ val] - ] ifFalse:[ - box action:[:val | ^ resultAction value:val] - ]. - aPoint notNil ifTrue:[ - box showAt:aPoint center:centered - ] ifFalse:[ - centered ifTrue:[ - box showAtCenter - ] ifFalse:[ - box showAtPointer - ] - ]. - ^ cancelValue value. + ^ self + request:aString + displayAt:aPoint + centered:centered + action:resultAction + initialAnswer:initial + okLabel:nil + cancelLabel:nil + onCancel:cancelValue " at topLeft (centering is suppressed, to make the box fully visible) - Dialog - request:'enter a string:' - displayAt:0@0 - centered:true - action:[:result | result printNewline] - initialAnswer:'the default' - onCancel:#foo + Dialog + request:'enter a string:' + displayAt:0@0 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + onCancel:#foo centered around 200@200: - Dialog - request:'enter a string:' - displayAt:200@200 - centered:true - action:[:result | result printNewline] - initialAnswer:'the default' - onCancel:#foo + Dialog + request:'enter a string:' + displayAt:200@200 + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + onCancel:#foo topLeft of box at 200@200: - Dialog - request:'enter a string:' - displayAt:200@200 - centered:false - action:[:result | result printNewline] - initialAnswer:'the default' - onCancel:#foo + Dialog + request:'enter a string:' + displayAt:200@200 + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' + onCancel:#foo under mouse pointer: - Dialog - request:'enter a string:' - displayAt:nil - centered:false - action:[:result | result printNewline] - initialAnswer:'the default' - onCancel:#foo + Dialog + request:'enter a string:' + displayAt:nil + centered:false + action:[:result | result printNewline] + initialAnswer:'the default' + onCancel:#foo centered on the screen: - Dialog - request:'enter a string:' - displayAt:nil - centered:true - action:[:result | result printNewline] - initialAnswer:'the default' - onCancel:#foo + Dialog + request:'enter a string:' + displayAt:nil + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + onCancel:#foo " "Created: 7.12.1995 / 23:14:10 / cg" - "Modified: 27.1.1996 / 14:41:40 / cg" + "Modified: 29.5.1996 / 14:24:39 / cg" ! request:aString displayAt:aPoint initialAnswer:initial @@ -1722,20 +1885,21 @@ Return the entered string (may be empty string) or nil (if cancel was pressed)" ^ self - request:aString - displayAt:aPoint - centered:false - action:nil - initialAnswer:initial + request:aString + displayAt:aPoint + centered:false + action:nil + initialAnswer:initial + onCancel:'' " Dialog - request:'enter a string:' - displayAt:(250 @ 250) - initialAnswer:'the default' + request:'enter a string:' + displayAt:(250 @ 250) + initialAnswer:'the default' " - "Modified: 27.1.1996 / 14:45:47 / cg" + "Modified: 29.5.1996 / 14:29:51 / cg" ! request:aString initialAnswer:initial @@ -1743,19 +1907,20 @@ Return the entered string (may be empty string) or nil (if cancel was pressed)" ^ self - request:aString - displayAt:nil - centered:false - action:nil - initialAnswer:initial + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:initial + onCancel:'' " Dialog - request:'enter a string:' - initialAnswer:'the default' + request:'enter a string:' + initialAnswer:'the default' " - "Modified: 27.1.1996 / 14:44:22 / cg" + "Modified: 29.5.1996 / 14:30:05 / cg" ! request:aString initialAnswer:initial onCancel:cancelAction @@ -1763,23 +1928,74 @@ Return the entered string (may be empty string) or cancelValue (if cancel was pressed)" - self - request:aString - displayAt:nil - centered:false - action:[:result | ^ result] - initialAnswer:initial. - - ^ cancelAction value + ^ self + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:initial + onCancel:cancelAction " Dialog - request:'enter a string:' - initialAnswer:'the default' - onCancel:['foooo'] + request:'enter a string:' + initialAnswer:'the default' + onCancel:['foooo'] + " + + "Modified: 29.5.1996 / 14:28:24 / cg" +! + +request:aString okLabel:okLabel + "launch a Dialog, which allows user to enter something. + The okButton is labelled as okLabel. + Return the entered string (may be empty string) + or the empty string (if cancel was pressed)" + + ^ self + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:'' + okLabel:okLabel + cancelLabel:nil + onCancel:'' + + " + Dialog + request:'enter a string:' + okLabel:'yes' " - "Modified: 27.1.1996 / 14:46:00 / cg" + "Modified: 29.5.1996 / 14:26:25 / cg" + "Created: 29.5.1996 / 14:31:10 / cg" +! + +request:aString okLabel:okLabel onCancel:cancelValue + "launch a Dialog, which allows user to enter something. + The okButton is labelled as okLabel. + Return the entered string (may be empty string) + or the value from evaluating cancelValue (if cancel was pressed)" + + ^ self + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:'' + okLabel:okLabel + cancelLabel:nil + onCancel:cancelValue + + " + Dialog + request:'enter a string:' + okLabel:'yes' + onCancel:nil + " + + "Modified: 29.5.1996 / 14:32:00 / cg" ! request:aString onCancel:cancelAction @@ -1787,23 +2003,22 @@ Return the entered string (may be empty string) or the value of cancelAction (if cancel was pressed)." - self - request:aString - displayAt:nil - centered:false - action:[:result | ^ result] - initialAnswer:''. - - ^ cancelAction value + ^ self + request:aString + displayAt:nil + centered:false + action:nil + initialAnswer:'' + onCancel:cancelAction " Dialog - request:'enter a string:' - onCancel:nil + request:'enter a string:' + onCancel:nil " "Created: 27.1.1996 / 14:31:45 / cg" - "Modified: 27.1.1996 / 14:46:10 / cg" + "Modified: 29.5.1996 / 14:28:59 / cg" ! requestPassword:aString @@ -4511,6 +4726,6 @@ !DialogBox class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.76 1996-05-29 10:16:00 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.77 1996-05-29 13:15:25 cg Exp $' ! ! DialogBox initialize!