diff -r 80dcc5d0caac -r 620d5ac7dee5 DialogBox.st --- a/DialogBox.st Thu Dec 09 21:11:28 1999 +0100 +++ b/DialogBox.st Thu Dec 09 23:50:49 1999 +0100 @@ -2266,7 +2266,93 @@ ! -request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue list:listToSelectFrom +request:aString displayAt:aPoint centered:centered action:resultAction +initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString +onCancel:cancelValue list:listToSelectFrom + "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)" + + ^ self + request:aString + displayAt:aPoint + centered:centered + action:resultAction + initialAnswer:initial + okLabel:okLabel + cancelLabel:cancelLabel + title:titleString + onCancel:cancelValue + list:listToSelectFrom + initialSelection:nil + + " + 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 + + with a list: + + Dialog + request:'enter a string:' + displayAt:nil + centered:true + action:[:result | result printNewline] + initialAnswer:'the default' + okLabel:'yes' + cancelLabel:'no' + title:'foo' + onCancel:#foo + list:#(foo bar baz) + " + + "Created: / 29.5.1996 / 14:35:04 / cg" + "Modified: / 5.5.1999 / 10:50:22 / cg" +! + +request:aString displayAt:aPoint centered:centered action:resultAction +initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString +onCancel:cancelValue list:listToSelectFrom initialSelection:anInterval "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. @@ -2285,6 +2371,9 @@ box list:listToSelectFrom. ]. box initialText:initial printString. + anInterval notNil ifTrue:[ + box selectFrom:anInterval start to:anInterval stop. + ]. box abortAction:[:val | box destroy. ^ cancelValue value]. okLabel notNil ifTrue:[ box okText:okLabel. @@ -2487,6 +2576,33 @@ "Modified: 29.5.1996 / 14:30:05 / cg" ! +request:aString initialAnswer:initial initialSelection:anInterval + "launch a Dialog, which allows user to enter something. + 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 + okLabel:nil + cancelLabel:nil + title:nil + onCancel:'' + list:nil + initialSelection:anInterval + + " + Dialog + request:'enter a string:' + initialAnswer:'the default' + initialSelection:(1 to:3) + " + + "Modified: 29.5.1996 / 14:30:05 / cg" +! + request:aString initialAnswer:initial list:aList "launch a Dialog, which allows user to enter something, or select from a list of values. @@ -6092,6 +6208,6 @@ !DialogBox class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.138 1999-12-09 20:11:28 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.139 1999-12-09 22:50:49 cg Exp $' ! ! DialogBox initialize!