|
Class: DialogBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--ActionWaitBox
|
+--Dolphin::ListPrompter
|
+--Dolphin::MessageBox
|
+--Dolphin::Prompter
|
+--EnterBox
|
+--FontPanel
|
+--InfoBox
|
+--LicenceBox
|
+--OptionBox
|
+--Tools::SearchDialog
- Package:
- stx:libwidg
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.459
date: 2019/07/17 09:25:32
- user: cg
- file: DialogBox.st directory: libwidg
- module: stx stc-classLibrary: libwidg
- Author:
- Claus Gittinger
this class implements the common behavior of dialogboxes.
DialogBox is also a superclass of many other boxes - see InfoBox,
WarningBox, YesNoBox etc. for concrete examples.
Most of them simply add buttons or other elements.
For programmatically created boxes, instances support adding of components
in a top-to-bottom fashion, and also keep track of added text-fields and,
since they are most common, automatically create an EnterFieldGroup for
them.
Caveat:
more adding support is required - especially for row-wise construction.
The programmatic interface is best suited for row-wise
arranged components; laying out elements in columns is a bit
complicate - for complicated dialogs, it may be better to not use
the automatic arrangement, but instead give explicit layouts to
the components (in a subclass) or better use the UIPainter.
Compatibility note:
For ST-80 compatibility, DialogBox is also accessible under
the global named 'Dialog' (which is the name of an ST-80 class,
providing a very similar protocol).
This may lead to confusion, if DialogBox is recompiled - you have
to manually assign Dialog again to refer to the new DialogBox class.
In future versions of ST/X, DialogBox may be renamed to Dialog.
Historic note:
originally, ST/X had separate classes for the various entry methods;
there were YesNoBox, EnterBox, InfoBox and so on.
ST-80 has all this defined in the common Dialog.
Therefore, for compatibility, many ST/X methods defined here in Dialogs
class protocol simply dispatch to some other boxes class method.
In the future, those existing subclasses' functionality is going to
be moved full into Dialog, and the subclasses will be replaced by dummy
delegators. (They will be kept for backward compatibility, though).
[instance variables:]
buttonPanel <PanelView> contains the button(s)
okButton <Button> the ok-Button
okAction <Block> the action to be performed when ok is pressed,
or return is pressed.
acceptReturnAsOK <Boolean> if true, pressing the return-key counts
as if ok was pressed. Default is true.
abortButton <Button> the cancel-Button
abortAction <Block> the action to be performed when cancel is
pressed.
yPosition <Integer> current y position when adding components
leftIndent <Integer> left inset to use when adding components
rightIndent <Integer> right inset to use when adding components
addedComponents <Collection> programmatically added components
inputFieldGroup <EnterFieldGroup>
for added input fields
acceptOnLeave <Boolean> if true (the default) and there are
tabable inputFields, accept and close when
the last field is left. If false, the ok
button must be pressed to close the box.
acceptedValue v(<Boolean>) valueHolder on a boolean
after close: holds true if box was accepted
(i.e. ok-Button was pressed), false if box was
closed via cancel or window manager.
autoAccept Boolean if true, pressing ok (or return)
sends #accept to all subcomponents.
I.e. all subfields update their models
first. The default is true.
variablePanel nil|VPanel an optional additional panel to be filled dynamically
in an aboutToOpenNotification hook.
For compatibility with ST-80, this class is also available under
the global names DialogView and Dialog (see patches file).
Button
CheckToggle
Toggle
EditField
SelectionInListView
FileSelectionList
FramedBox
Separator
[introduction to view programming]
Compatibility-Squeak
-
chooseDirectory
-
self chooseDirectory
Compatibility-VW
-
choose: aString fromList: list values: listValues lines: maxLines cancel: cancelBlock for: aView
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
This is a new VW2.5 interface - passing an addtional argument.
In ST/X, this is not needed and ignored
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:4
cancel:nil
)
Transcript showCR:(
Dialog
choose:'choose example'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:4
cancel:[Transcript flash. #aborted]
)
|
-
confirm: aMessageString for: ignoredView
-
VW compatibility - confirm using the same viewStyle as in the view
argument; not supported in ST/X (who mixes styles ?)
-
request: aString for: aView
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or the empty string (if cancel was pressed),
This is a new VW2.5 interface - passing an addtional argument.
In ST/X, this is not needed and ignored
-
request: aString initialAnswer: initial for: aView
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed).
This is a new VW2.5 interface - passing an addtional argument.
In ST/X, this is not needed and ignored
-
requestFileName: title default: default version: versionSym ifFail: failBlock for: aViewOrNil
-
new VW2.5 interface - passing an addtional argument.
In ST/X, this is not needed and ignored
-
warn: aMessageString for: ignoredView
-
VW compatibility - warn using the same viewStyle as in the view
argument; not supported in ST/X (who mixes styles ?)
class initialization
-
initialize
-
do this for ST-80 compatibility
common dialogs
-
about: text label: label icon: image
-
opens an standard about box for an application.
-
aboutClass: aClass
-
opens a standard (simple) aboutBox for aClass.
usage example(s):
Dialog aboutClass:Dialog
Dialog aboutClass:Dialog withText:'some more blabla'
|
-
aboutClass: aClass withText: textOrNil
-
opens a standard (simple) aboutBox for aClass.
usage example(s):
self aboutClass:Array withText:'bla bla'
|
-
ask: setupBlock ifNotNilOrEmptyDo: actionBlock
-
utility: open a requestor with setupBlock;
if it answers ok, invoke actionBlock with the entered input.
Otherwise do nothing
usage example(s):
Dialog
ask:[ Dialog request:'Some Answer:' ]
ifNotNilOrEmptyDo:[:what | Transcript showCR:what ]
|
usage example(s):
Dialog
ask:[ Dialog requestFileName:'Some File:' ]
ifNotNilOrEmptyDo:[:what | Transcript showCR:what ]
|
-
askYesNo: setupBlock ifYesDo: actionBlock
-
utility: open a confirmer with setupBlock;
if it answers true, invoke actionBlock.
Otherwise do nothing
usage example(s):
Dialog
askYesNo:[ Dialog confirm:'Yes or No?' ]
ifYesDo:[ Transcript showCR:'yes' ]
|
-
informUser: aString during: aBlock
-
show a message-box while executing aBlock.
If aBlock expects an argument, pass it the box,
so it can change its label via label:
usage example(s):
Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1]
Dialog informUser:'wait a few seconds...' during:[100000 factorial]
Dialog
informUser:'wait two seconds...'
during:[:box |
Delay waitForSeconds:1.
box label:'still running...'.
Delay waitForSeconds:1.
box label:'one more second...'.
Delay waitForSeconds:1.
]
|
-
informUser: aString during: aBlock cancel: canCancel
-
show a message-box while executing aBlock
usage example(s):
Dialog informUser:'don''t wait ...' during:[true] cancel:true
Dialog informUser:'please wait a second...' during:[Delay waitForSeconds:1] cancel:true
Dialog informUser:'please wait, while I compute 30000 factorial...' during:[30000 factorial] cancel:true
Dialog
informUser:'wait two seconds...'
during:[:box |
Delay waitForSeconds:1.
box label:'still running...'.
Delay waitForSeconds:1.
box label:'one more second...'.
Delay waitForSeconds:1.
]
cancel:true
|
-
information: aString
-
launch a Dialog to tell user something
usage example(s):
Dialog information:'help'
|
-
information: aString title: windowTitle
-
launch a Dialog to tell user something
usage example(s):
Dialog information:'help' title:'Attention'
|
-
information: aString with: arg
-
launch a Dialog to tell user something
usage example(s):
Dialog information:'help %1' with:'foo'
|
-
information: aString with: arg1 with: arg2
-
launch a Dialog to tell user something
usage example(s):
Dialog information:'help %1 %2' with:'foo' with:1234
|
-
informationText: aString title: windowTitle
-
launch a Dialog to tell user something.
The argument aString is shown as multiline, scrollable text
usage example(s):
Dialog
informationText:(DialogBox class compiledMethodAt:#information:title:) source
title:'Hello'
|
-
informationText: aString title: title windowTitle: windowTitle
-
launch a Dialog to tell user something.
The argument aString is shown as multiline, scrollable text
usage example(s):
Dialog
informationText:(DialogBox class compiledMethodAt:#information:title:) source
title:'Hello - the text is:'
windowTitle:'Hello'
|
-
warn: aString
-
launch a Dialog to warn user
usage example(s):
Dialog warn:'some warning message'
Dialog warn:('some text with italic emphasis' asText
emphasizeFrom:16 to:22 with:#italic)
Dialog warn:('some warning message' asText
emphasizeAllWith:(#color->Color red))
Dialog warn:('some text with color emphasis' asText
emphasizeFrom:6 to:10 with:(#color->Color blue);
emphasizeFrom:16 to:20 with:(#color->Color red))
|
-
warn: aString title: windowTitle
-
launch a Dialog to warn user
usage example(s):
Dialog warn:'some warning message' title:'oops'
Dialog warn:('some text with italic emphasis' asText
emphasizeFrom:16 to:22 with:#italic)
Dialog warn:('some warning message' asText
emphasizeAllWith:(#color->Color red))
Dialog warn:('some text with color emphasis' asText
emphasizeFrom:6 to:10 with:(#color->Color blue);
emphasizeFrom:16 to:20 with:(#color->Color red))
|
-
warn: aString with: arg
-
launch a Dialog to warn user
usage example(s):
Dialog warn:'some %1 message' with:'warning'
|
-
warn: aString with: arg1 with: arg2
-
launch a Dialog to warn user
usage example(s):
Dialog warn:'some %1 message %2' with:'warning' with:'with argument'
|
confirmation dialogs
-
confirm: aString
-
open a modal yes-no dialog.
Return true for yes, false for no
usage example(s):
Dialog confirm:'really ?'
Transcript showCR:(
Dialog confirm:'are you certain ?'
)
|
-
confirm: aString default: what
-
launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
InitialAnswer must be true or false and defines which button is to be
the default (i.e. return-) button
usage example(s):
Dialog confirm:'Are you happy' default:true
Dialog confirm:'Are you happy' default:false
|
-
confirm: aString initialAnswer: what
-
launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
InitialAnswer must be true or false and defines which button is to be
the default (i.e. return-) button
usage example(s):
Dialog confirm:'really ?' initialAnswer:false
Transcript showCR:(
Dialog confirm:'are you certain ?' initialAnswer:false
)
Transcript showCR:(
Dialog confirm:'are you certain ?' initialAnswer:true
)
|
-
confirm: aString initialAnswer: what noLabel: noText
-
launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
InitialAnswer must be true or false and defines which button is to be
the default (i.e. return-) button
-
confirm: aString noLabel: noText
-
launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
The no-button is labeled noText (for example, if you need a 'cancel' there)
usage example(s):
Dialog confirm:'really ?'
Dialog confirm:'really ?' noLabel:'Cancel'
|
-
confirm: aString title: title
-
open a modal yes-no dialog.
Return true for yes, false for no
usage example(s):
Dialog confirm:'really ?'
Transcript showCR:(
Dialog confirm:'are you certain ?'
)
|
-
confirm: aString title: title noLabel: noText
-
launch a Dialog, which allows user to enter yes or no.
return true for yes, false for no.
The no buttons label is defined by noText (for example, to make it 'cancel').
usage example(s):
Dialog
confirm:'really ?'
title:'fooBar'
noLabel:'Nope'
|
usage example(s):
Dialog
confirm:'really ?'
title:nil
noLabel:'Cancel'
|
-
confirm: aString title: title yesLabel: yesText noLabel: noText
-
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.
usage example(s):
Dialog
confirm:'really ?'
title:'fooBar'
yesLabel:'Oh well'
noLabel:'Nope'
|
usage example(s):
Dialog
confirm:'really ?'
title:nil
yesLabel:'Oh well'
noLabel:'Nope'
|
usage example(s):
Dialog
confirm:'really ?'
title:''
yesLabel:'Oh well'
noLabel:'Nope'
|
-
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.
usage example(s):
Dialog
confirm:'really ?'
title:'fooBar'
yesLabel:'Oh well'
noLabel:'Nope'
initialAnswer:true
|
usage example(s):
Dialog
confirm:'really ?'
title:'fooBar'
yesLabel:'Oh well'
noLabel:'Nope'
initialAnswer:false
|
-
confirm: msg withCancel: aBoolean
-
launch a Dialog, which allows user to enter yes, no and optionally: cancel.
Return true for 'yes', false for 'no', nil for 'cancel'
usage example(s):
Dialog confirm:'really ?' withCancel:false
Dialog confirm:'really ?' withCancel:true
|
-
confirm: msg withCancel: aBoolean default: default
-
launch a Dialog, which allows user to enter yes, no and optionally: cancel.
Return true for 'yes', false for 'no', nil for 'cancel'
usage example(s):
Dialog confirm:'really ?' withCancel:false
Dialog confirm:'really ?' withCancel:true
|
-
confirm: aString yesLabel: yesText
-
launch a Dialog, which allows user to enter yes or no.
Return true for yes, false for no.
The yes button's label is defined by yesText.
usage example(s):
Dialog
confirm:'really ?'
yesLabel:'Oh well'
|
-
confirm: aString yesLabel: yesText initialAnswer: what
-
launch a Dialog, which allows user to enter yes or no.
Return true for yes, false for no.
The yes button's label is defined by yesText.
usage example(s):
Dialog
confirm:'really ?'
yesLabel:'Oh well'
initialAnswer:false
|
-
confirm: aString yesLabel: yesText noLabel: noText
-
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.
usage example(s):
Dialog
confirm:'really ?'
yesLabel:'Oh well'
noLabel:'Nope'
|
-
confirm: aString 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.
usage example(s):
Dialog
confirm:'really ?'
yesLabel:'Oh well'
noLabel:'Nope'
initialAnswer:false
|
-
confirmOKCancel: aString
-
launch a Dialog, which allows user to enter OK or Cancel.
return true for OK, false for Cancel.
usage example(s):
Dialog confirmOKCancel:'really ?'
|
-
confirmWithCancel: aString
-
launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', nil for 'cancel'
usage example(s):
Dialog confirmWithCancel:'really ?'
|
usage example(s):
Transcript showCR:(
Dialog confirmWithCancel:'really ?'
)
|
-
confirmWithCancel: aString 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 default argument marks the return-button; it may be one of nil, false or true
usage example(s):
Dialog confirmWithCancel:'really ?' default:false
Dialog confirmWithCancel:'really ?' default:true
|
-
confirmWithCancel: aString default: defaultValue onCancel: cancelValue
-
launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', cancelValues value for 'cancel'
usage example(s):
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise]
|
-
confirmWithCancel: aString default: default title: titleString
-
launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', nil for 'cancel'.
The default argument marks the return-button; it may be one of nil, false or true
usage example(s):
Dialog confirmWithCancel:'really ?' default:false
Dialog confirmWithCancel:'really ?' default:true
|
-
confirmWithCancel: aString labels: labelArray
-
launch a Dialog, which allows user to enter cancel, no or yes.
Return true for 'yes', false for 'no', nil for 'cancel'.
The default is yes.
The buttons labels are given in labelArray with order #(cancel, no, yes)
(notice that the order may get reversed in some styles)
usage example(s):
Dialog confirmWithCancel:'really ?' labels:#( 'Oops' 'Nope' 'Yea')
Dialog confirmWithCancel:'really ?'
|
-
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, with order #(cancel, no, yes).
The default argument (if non-nil) defines the index of the
return button (1 to 3)
usage example(s):
Transcript showCR:(
Dialog
confirmWithCancel:'really ?'
labels:#('mhmh' 'Maybe' 'Definitely')
default:3
)
|
-
confirmWithCancel: aString labels: labelArray title: title
-
launch a Dialog, which allows user to enter cancel, no or yes.
Return true for 'yes', false for 'no', nil for 'cancel'.
The default is yes.
The buttons labels are given in labelArray with order #(cancel, no, yes)
(notice that the order may get reversed in some styles)
usage example(s):
Dialog confirmWithCancel:'really ?' labels:#( 'Oops' 'Nope' 'Yea') title:'bla'
Dialog confirmWithCancel:'really ?'
|
-
confirmWithCancel: aString labels: buttonLabels values: buttonValues default: default
-
launch a Dialog, which allows user to click on any button.
Return the corresponding value from the values array.
The labels for the buttons are to be passed in
buttonLabels, with order #(cancel, no, yes).
The default argument (if non-nil) defines the index of the
return button (1 to n)
usage example(s):
Transcript showCR:(
Dialog
confirmWithCancel:'really ?'
labels:#('mhmh' 'maybe' 'definitely')
values:#(1 2 3)
default:3
)
|
-
confirmWithCancel: aString labels: buttonLabels values: buttonValues default: default boxLabel: boxLabelOrNil
-
obsolete - for backward compatibility
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
confirmWithCancel: aString labels: buttonLabels values: buttonValues default: default check: checkLabelOrNil on: checkHolderOrNil title: boxLabelOrNil
-
launch a Dialog, which allows user to click on any button.
Return the corresponding value from the values array.
The labels for the buttons are to be passed in
buttonLabels, with order #(cancel, no, yes).
The default argument (if non-nil) defines the index of the return button (1 to n).
If checkLabel/checkHolder are not nil, and additional labelled checkBox is added to operate on
checkHolder. This can be used for 'do not show this box again' checkItems.
usage example(s):
Transcript showCR:(
Dialog
confirmWithCancel:'really ?'
labels:#('mhmh' 'maybe' 'definitely')
values:#(1 2 3)
default:3
check:'Again' on:(true asValue)
title:'hello there'
)
Transcript showCR:(
Dialog
confirmWithCancel:'really ?'
labels:#('mhmh' 'maybe' 'definitely')
values:#(1 2 3)
default:3
check:nil on:nil
title:'hello there'
)
|
-
confirmWithCancel: aString labels: buttonLabels values: buttonValues default: default title: boxLabelOrNil
-
launch a Dialog, which allows user to click on any button.
Return the corresponding value from the values array.
The labels for the buttons are to be passed in
buttonLabels, with order #(cancel, no, yes).
The default argument (if non-nil) defines the index of the
return button (1 to n)
usage example(s):
Transcript showCR:(
Dialog
confirmWithCancel:'really ?'
labels:#('mhmh' 'maybe' 'definitely')
values:#(1 2 3)
default:3
title:'hello there'
)
|
-
confirmWithCancel: aString onCancel: cancelValue
-
launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', cancelValues value for 'cancel'
usage example(s):
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise]
|
-
confirmWithCancel: aString title: titleString
-
launch a Dialog, which allows user to enter yes, no and cancel.
return true for 'yes', false for 'no', nil for 'cancel'
usage example(s):
Dialog confirmWithCancel:'really ?'
|
usage example(s):
Transcript showCR:(
Dialog confirmWithCancel:'really ?'
)
|
-
confirmWithRaiseAbortOnCancel: aString
-
launch a Dialog, which allows user to enter yes, no and cancel.
Return true for 'yes', false for 'no'.
Raise the abort signal on 'cancel'
usage example(s):
Dialog confirmWithRaiseAbortOnCancel:'really ?'
|
usage example(s):
Transcript showCR:(
Dialog confirmWithRaiseAbortOnCancel:'really ?'
)
|
-
confirmWithRaiseAbortOnCancel: aString default: default
-
launch a Dialog, which allows user to enter yes, no and cancel.
Return true for 'yes', false for 'no'.
Raise the abort signal on 'cancel'
usage example(s):
Dialog confirmWithRaiseAbortOnCancel:'really ?'
|
usage example(s):
Transcript showCR:(
Dialog confirmWithRaiseAbortOnCancel:'really ?'
)
|
defaults
-
defaultLabel
-
return the boxes default window title.
-
defaultMinWidthForListBoxes
-
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
file name dialogs
-
requestDirectoryName
-
same as requestFileName, but only show directories.
usage example(s):
Dialog requestDirectoryName
|
-
requestDirectoryName: title
-
same as requestFileName, but only show directories.
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
|
-
requestDirectoryName: title default: aFileName
-
same as requestFileName, but only show directories
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
|
-
requestDirectoryName: title default: aFileName acceptReturnAsOK: aBoolean
-
same as requestFileName, but only show directories
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
|
-
requestDirectoryName: title default: aFileName ifFail: failBlock
-
same as requestFileName, but only show directories
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
ifFail:'none' 'none'
|
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText
-
same as requestFileName, but only show directories
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
ok:'Yes' abort:'No'
|
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failBlock
-
Same as requestFileName, but only show directories.
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failBlock acceptReturnAsOK: aBoolean
-
Same as requestFileName, but only show directories.
Extended to accept return as ok if wanted.
usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
ifFail:'none'
|
-
requestDirectoryName: titleString default: aFileName ok: okText abort: abortText version: versionSymbol pattern: pattern fromDirectory: aDirectoryPath ifFail: failBlock whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
same as requestFileName, but only show directories
-
requestDirectoryName: titleString default: aFileName pattern: pattern fromDirectory: aDirectoryPath
-
same as requestFileName, but only show directories
usage example(s):
Dialog
requestDirectoryName:'which directory ?' default:'/etc'
pattern:'*' fromDirectory:'/'
|
-
requestFileName
-
launch a Dialog, which allows the user to enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
-
requestFileName: titleString
-
launch a Dialog, which allows user to enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog requestFileName:'enter a fileName:'
Dialog requestFileName:'enter a fileName:'
|
-
requestFileName: titleString default: defaultName
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog requestFileName:'Enter a fileName:' default:''
Dialog requestFileName:'Enter a fileName:' default:'Makefile.bak'
|
-
requestFileName: titleString default: defaultName fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:'Makefile.bak'
fromDirectory:'..'
|
-
requestFileName: titleString default: defaultName ifFail: cancelBlockOrValue
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog requestFileName:'enter a fileName:' default:''
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak'
|
-
requestFileName: titleString default: defaultName ifFail: failReturn pattern: pattern fromDirectory: dir
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from dir.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or failReturn if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
ok:'yeah'
abort:'oh, no'
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
ok:'yeah'
abort:'oh, no'
pattern:'*.st'
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil forSave: forSave
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil forSave: forSave whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
ok:'yeah'
abort:'oh, no'
pattern:'rc*'
fromDirectory:'/etc'
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText pattern: patternOrNil orFilters: filtersOrNil fromDirectory: aDirectoryPathOrNil forSave: forSave whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
ok:'yeah'
abort:'oh, no'
pattern:'rc*'
fromDirectory:'/etc'
|
-
requestFileName: titleString default: defaultName ok: okText abort: abortText version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileName: titleString default: defaultName pattern: pattern
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
pattern:'*.st'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
pattern:'*.st;*.h'
|
-
requestFileName: titleString default: defaultName pattern: pattern fromDirectory: aDirectory
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
pattern:'*.st'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
pattern:'*.st;*.h'
|
-
requestFileName: titleString default: defaultName version: versionSymbol
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string or the empty string if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
usage example(s):
Dialog requestFileName:'enter a fileName:'
default:''
version:nil
Dialog requestFileName:'enter a fileName:'
default:''
version:#mustBeNew
Dialog requestFileName:'enter a fileName:'
default:''
version:#new
|
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:#old
ifFail:['none']
|
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:#old
ifFail:['none']
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:#mustBeNew
ifFail:['none']
fromDirectory:'/etc'
|
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath forSave: forSave whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'Enter a fileName:'
default:''
version:#old
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'Enter a fileName:'
default:''
version:#mustBeNew
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
-
requestFileName: titleString default: defaultName version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:#old
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
default:''
version:#mustBeNew
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
-
requestFileName: titleString fromDirectory: aDirectory
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
fromDirectory:'../../libbasic'
|
-
requestFileName: titleString ifFail: cancelBlockOrValue
-
launch a Dialog, which allows user to enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or the value from evaluating cancelBlock (if cancel was pressed).
usage example(s):
Dialog requestFileName:'enter a fileName:' ifFail:['foo']
Dialog requestFileName:'enter a fileName:' ifFail:[nil]
|
-
requestFileName: titleString pattern: pattern
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
pattern:'*.st'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
pattern:'*.st;*.h'
|
-
requestFileName: titleString pattern: pattern fromDirectory: aDirectory
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show ok/cancel in its buttons.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
usage example(s):
Dialog
requestFileName:'enter a fileName:'
pattern:'*.st'
|
usage example(s):
Dialog
requestFileName:'enter a fileName:'
pattern:'*.st;*.h'
|
-
requestFileNameForImageSave: title image: anImage default: defaultName pattern: patternOrNil
-
launch a Dialog, which allows user to enter a filename for a bitmap image save operation.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
self
requestFileNameForImageSave:'save'
image:(Image fromScreen:(0@0 corner:100@100))
default:'screen.png'
pattern:'*.png'
|
-
requestFileNameForSave: titleString
-
launch a Dialog, which allows user to enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
-
requestFileNameForSave: titleString default: defaultName
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog requestFileName:'enter a fileName:' default:''
Dialog requestFileNameForSave:'enter a fileName:' default:''
|
-
requestFileNameForSave: titleString default: defaultName fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
-
requestFileNameForSave: titleString default: defaultName ok: okText abort: abortText pattern: pattern
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those from the current directory.
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string or nil if cancel was pressed.
-
requestFileNameForSave: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileNameForSave: titleString default: defaultName ok: okText abort: abortText pattern: pattern fromDirectory: aDirectoryPathOrNil whenBoxCreatedEvaluate: boxCreatedCallback
-
launch a Dialog, which allows user to enter a filename.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return the string, or nil if cancel was pressed.
-
requestFileNameForSave: titleString default: defaultName version: versionSymbol ifFail: failBlock
-
launch a Dialog, which allows user to enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileNameForSave: titleString default: defaultName version: versionSymbol ifFail: failBlock fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileNameForSave: titleString default: defaultName version: versionSymbol ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath
-
launch a Dialog, which allows user to enter a filename.
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
#mustBeNew - fail (return empty string) if the file exists
#new - confirm if the file exists
#mustBeOld - fail if the file does not exist
#old - confirm if the file does not exist
#any (other) - no validation
-
requestFileNames: titleString default: defaultName ok: okText abort: abortText ifFail: failBlock pattern: pattern fromDirectory: aDirectoryPath whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: asLoadDialog
-
launch a Dialog, which allows user to enter a filename or select multiple files.
The files presented initially are those in aDirectoryPathOrNil, or the
last fileBox directory (default: current directory) (if a nil path is given).
The box will show okText in its okButton, abortText in the abortButton.
The matchPattern is set to pattern initially.
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed
usage example(s):
self
requestFileNames:'test'
default:nil
ok:'OK' abort:'Cancel'
ifFail:[]
pattern:'*.st'
fromDirectory:(Filename currentDirectory)
whenBoxCreatedEvaluate:nil
asLoadDialog:true
|
-
requestNewFileName: titleString default: defaultName
-
launch a Dialog, which allows user to enter a filename.
We expect a new files (i.e. nonexisting) name to be entered,
and confirm if it already exists.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string consisting of the full pathname of the filename,
or an empty string (if cancel was pressed).
usage example(s):
Dialog requestNewFileName:'enter a fileName:' default:''
|
-
requestSaveFileName: title default: defaultOrNil fromDirectory: directoryOrNil action: action appendAction: appendActionOrNil
-
save contents into a file - ask user for filename using a fileSelectionBox.
Append is NOT offered, if appendActionOrNil is nil.
usage example(s):
Dialog
requestSaveFileName:'Save dialog example with append'
default:'xxx.txt'
fromDirectory:(Filename homeDirectory)
action:[:fn | Transcript showCR:'save ',fn]
appendAction:[:fn | Transcript showCR:'append ',fn]
Dialog
requestSaveFileName:'Save dialog example'
default:'xxx.txt'
fromDirectory:(Filename homeDirectory)
action:[:fn | Transcript showCR:'save ',fn]
appendAction:nil
|
fill in multiple blank dialogs
-
request: string1 asPassWord: isPassword1 initialAnswer: initial1 and: string2 asPassWord: isPassword2 initialAnswer: initial2 label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for 2 string values, labelled string1 and string2,
with corresponding initial values.
Above the fields, label is shown, and the window title will be boxTitle.
Returns the entered strings as a pair or the value from cancelValue.
Useful to ask for user+password or host+port
usage example(s):
Dialog
request:'UserName:' asPassWord:false initialAnswer:'tim'
and:'Password' asPassWord:true initialAnswer:''
label:'Please Login'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
-
request: string1 asPassWord: isPassword1 on: holder1 and: string2 asPassWord: isPassword2 on: holder2 label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for 2 string values, labelled string1 and string2,
with corresponding initial values.
Above the fields, label is shown, and the window title will be boxTitle.
Returns the entered strings as a pair or the value from cancelValue.
Useful to ask for user+password or host+port
usage example(s):
Dialog
request:'UserName:' asPassWord:false initialAnswer:'tim'
and:'Password' asPassWord:true initialAnswer:''
label:'Please Login'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
-
request: string1 initialAnswer: initial1 andText: string2 initialAnswer: initial2 lines: numLines label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for 1 single line string value, and one multiline string,
with corresponding initial values.
Above the fields, label is shown, and the window title will be boxTitle.
Returns the entered strings as a pair or the value from cancelValue.
Useful to ask for short message+long message
usage example(s):
Dialog
request:'User Name:' initialAnswer:'tim'
andText:'Password' initialAnswer:'' lines:5
label:'Please Enter your Name and a Log Message'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
-
request: string1 on: holder1 andText: string2 lines: numLines on: holder2 label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for 1 single line string value, and one multiline string,
with corresponding initial values.
Above the fields, label is shown, and the window title will be boxTitle.
Returns the entered strings as a pair or the value from cancelValue.
Useful to ask for short message+long message
usage example(s):
Dialog
request:'UserName:' initialAnswer:'tim'
andText:'Password:' initialAnswer:'' lines:5
label:'Please Login'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
fill in the blank dialogs
-
forRequestText: title editViewClass: editViewClass lines: numLines columns: numCols initialAnswer: initialText initialSelection: anIntervalOrNil model: textModel
-
return a dialog asking for multiline text.
The box is not shown yet, for further customization
-
forRequestText: title editViewClass: editViewClass lines: numLines columns: numCols initialAnswer: initialText model: textModel
-
return a dialog asking for multiline text.
The box is not shown yet, for further customization
-
forRequestText: title editViewClass: editViewClass lines: numLines columns: numCols initialAnswer: initialText setupWith: aSetupBlockOrNil
-
return a dialog asking for multiline text.
The box is not shown yet, for further customization
-
forRequestText: title lines: numLines columns: numCols initialAnswer: initialText initialSelection: anIntervalOrNil model: textModel
-
return a dialog asking for multiline text.
The box is not shown yet, for further customization
-
forRequestText: title lines: numLines columns: numCols initialAnswer: initialText model: textModel
-
return a dialog asking for multiline text.
The box is not shown yet, for further customization
-
request: aString
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or the empty string (if cancel was pressed)
usage example(s):
Dialog request:'enter a string:'
|
-
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 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)
usage example(s):
centered around 200@200:
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'
under mouse pointer:
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'
|
-
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)
usage example(s):
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
|
-
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 dialog's 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)
-
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 dialog's 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)
usage example(s):
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)
|
-
request: aString displayAt: aPoint centered: centered action: resultAction initialAnswer: initial okLabel: okLabel cancelLabel: cancelLabel title: titleString onCancel: cancelValue list: listToSelectFrom initialSelection: anIntervalOrNil
-
launch a Dialog, which allows user to enter a string.
The dialog's 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)
usage example(s):
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)
|
-
request: aString displayAt: aPoint centered: centeredOrNil action: resultAction initialAnswer: initial okLabel: okLabel cancelLabel: cancelLabel title: titleString onCancel: cancelValue list: listToSelectFrom initialSelection: anIntervalOrNil entryCompletionBlock: entryCompletionBlock
-
launch a Dialog, which allows user to enter a string.
The dialog's 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)
usage example(s):
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)
|
-
request: aString displayAt: aPoint centered: centered action: resultAction initialAnswer: initial onCancel: cancelValue
-
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.
Return the string or the value of cancelValue (if cancel was pressed)
usage example(s):
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
centered around 200@200:
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
under mouse pointer:
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
|
-
request: aString displayAt: aPoint initialAnswer: initial
-
launch a Dialog, which allows user to enter something.
The boxes topLeft is placed at aPoint, or under the mouse pointer (if aPoint is nil).
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
displayAt:(250 @ 250)
initialAnswer:'the default'
|
-
request: aString initialAnswer: initial
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
|
-
request: aString initialAnswer: initial entryCompletionBlock: entryCompletionBlock
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a selector:'
initialAnswer:'at:p'
entryCompletionBlock:[:s | |completion|
completion := Smalltalk selectorCompletion:s.
completion second size > 1 ifTrue:[ Screen current beep].
completion first
].
|
-
request: aString initialAnswer: initial initialSelection: anIntervalOrNil
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
initialSelection:(1 to:3)
|
-
request: aString initialAnswer: initial list: aList
-
launch a Dialog, which allows user to enter something,
or select from a list of values.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
initialAnswer:'the default'
list:#('foo' 'bar' 'baz')
|
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
list:((1 to:30) collect:[:i | i printString])
|
-
request: aString initialAnswer: initial list: aList entryCompletionBlock: entryCompletionBlock
-
launch a Dialog, which allows user to enter something,
or select from a list of values.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
initialAnswer:'the default'
list:#('foo' 'bar' 'baz')
|
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
list:((1 to:30) collect:[:i | i printString])
|
-
request: aString initialAnswer: initial list: aList title: titleString
-
launch a Dialog, which allows user to enter something,
or select from a list of values.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
initialAnswer:'the default'
list:#('foo' 'bar' 'baz')
|
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
list:((1 to:30) collect:[:i | i printString])
|
-
request: aString initialAnswer: initial okLabel: okLabel title: titleString
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
initialAnswer:'the default'
okLabel:'Yes'
title:'Only a Test'
|
-
request: aString initialAnswer: initial okLabel: okLabel title: titleString list: list
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'Enter or select a string:'
initialAnswer:'the default'
okLabel:'Yes'
title:'Only a Test'
list:#('a' 'b' 'c')
|
-
request: aString initialAnswer: initial okLabel: okLabel title: titleString onCancel: cancelAction
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
initialAnswer:'the default'
onCancel:['foooo']
|
-
request: aString initialAnswer: initial okLabel: okLabel title: titleString onCancel: cancelAction list: listOfChoices
-
launch a Dialog, which allows user to enter something
(with a list of choices for fast input).
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a String:'
initialAnswer:'the default'
okLabel:'OK'
title:'demo'
onCancel:nil
list:#('foo' 'bar' 'baz')
|
-
request: aString initialAnswer: initial okLabel: okLabel title: titleString onCancel: cancelAction list: listOfChoices entryCompletionBlock: entryCompletionBlock
-
launch a Dialog, which allows user to enter something
(with a list of choices for fast input).
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a String:'
initialAnswer:'the default'
okLabel:'OK'
title:'demo'
onCancel:nil
list:#('foo' 'bar' 'baz')
|
-
request: aString initialAnswer: initial onCancel: cancelAction
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or cancelValue (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
onCancel:['foooo']
|
-
request: aString initialAnswer: initial title: titleString
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
|
-
request: aString list: listOfChoices
-
launch a Dialog, which allows user to enter something,
but adds a list of choices for fast input.
Return the entered string (may be empty string)
or the empty string (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
list:#('foo' 'bar' 'baz')
|
-
request: aString list: listOfChoices initialAnswer: initialAnswer
-
launch a Dialog, which allows user to enter something,
but adds a list of choices for fast input.
Return the entered string (may be empty string)
or the empty string (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
list:#('foo' 'bar' 'baz')
initialAnswer:'foe'
|
-
request: aString list: listOfChoices initialAnswer: initialAnswer initialSelection: initialSelection
-
launch a Dialog, which allows user to enter something,
but adds a list of choices for fast input.
Return the entered string (may be empty string)
or the empty string (if cancel was pressed)
usage example(s):
Dialog
request:'Enter a string:'
list:#('foo' 'bar' 'baz')
initialAnswer:'foe'
|
-
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)
usage example(s):
Dialog
request:'Enter a string:'
okLabel:'Yes'
|
-
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)
usage example(s):
Dialog
request:'Enter a string:'
okLabel:'Yes'
onCancel:nil
|
-
request: aString okLabel: okLabel title: titleString 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)
usage example(s):
Dialog
request:'Enter a String:'
okLabel:'Yes'
title:'foo'
onCancel:nil
|
-
request: aString onCancel: cancelActionOrValue
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or the value of cancelAction (if cancel was pressed).
usage example(s):
Dialog
request:'Enter a String:'
onCancel:nil
|
-
request: aString title: windowTitle
-
launch a Dialog, which allows user to enter a string.
usage example(s):
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
centered around 200@200:
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
under mouse pointer:
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
|
-
request: aString title: titleString initialAnswer: initial
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string) or nil (if cancel was pressed)
usage example(s):
Dialog
request:'enter a string:'
initialAnswer:'the default'
|
-
requestNumber: aString
-
launch a Dialog, which allows user to enter a number.
Return the numeric value or nil
(for an invalid number or if cancel was pressed)
usage example(s):
Dialog requestNumber:'Enter your Age:'
|
-
requestNumber: aString initialAnswer: aNumber
-
launch a Dialog, which allows user to enter a number.
Return the numeric value or nil
(for an invalid number or if cancel was pressed)
usage example(s):
Dialog requestNumber:'Enter your Age:' initialAnswer: 25
|
-
requestPassword: aString
-
launch a Dialog, which allows user to enter something invisibly.
Return the entered string (may be empty string)
or nil (if cancel was pressed)
usage example(s):
Dialog
requestPassword:'Enter Secret:'
|
-
requestPassword: aString initialAnswer: defaultAnswer
-
launch a Dialog, which allows user to enter something invisibly.
Return the entered string (may be empty string)
or nil (if cancel was pressed)
usage example(s):
Dialog
requestPassword:'Enter Secret:'
initialText:'blabla'
|
-
requestText: title
-
open a dialog asking for multiline text.
Return a stringCollection or nil if canceled.
usage example(s):
-
requestText: title initialAnswer: initialAnswer
-
open a dialog asking for multiline text.
Return a stringCollection or nil if canceled.
usage example(s):
Dialog requestText:'Bla' initialAnswer:'Hello world'
|
-
requestText: title initialAnswer: initialAnswer initialSelection: anIntervalOrNil
-
open a dialog asking for multiline text.
Return a stringCollection or nil if canceled.
usage example(s):
Dialog requestText:'Bla' initialAnswer:'Hello world' initialSelection:(1 to:5)
|
-
requestText: title lines: numLines columns: numCols initialAnswer: initialText
-
open a dialog asking for multiline text.
Return a stringCollection or nil if canceled.
usage example(s):
Dialog requestText:'Bla' lines:8 columns:40 initialAnswer:'hello world'
|
-
requestText: title lines: numLines columns: numCols initialAnswer: initialText initialSelection: anIntervalOrNil
-
open a dialog asking for multiline text.
Return a stringCollection or nil if canceled.
usage example(s):
Dialog
requestText:'Bla' lines:8 columns:40 initialAnswer:'hello world'
Dialog
requestText:'Bla2' lines:8 columns:40 initialAnswer:'hello world' initialSelection:(1 to:5)
|
multiple choice dialogs
-
choose: aString fromList: list lines: maxLines
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the value
from list is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
)
|
-
choose: aString fromList: list lines: maxLines initialSelection: initialSelection
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the value
from list is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
initialSelection:4
)
|
-
choose: aString fromList: list lines: maxLines initialSelection: initialSelection title: windowTitle
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the value
from list is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
title:'Choose'
)
|
-
choose: aString fromList: list lines: maxLines title: windowTitle
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the value
from list is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
title:'Choose'
)
|
-
choose: aString fromList: list values: listValues buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
full example:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:10
cancel:nil
)
no buttons:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:4
cancel:nil
)
no list (lines argument is ignored):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:nil
values:nil
buttons:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:nil
cancel:nil
)
full including cancel value:
Transcript showCR:(
Dialog
choose:'choose example'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:4
cancel:[Transcript flash. #aborted]
)
degenerated:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:nil
values:nil
buttons:nil
values:nil
lines:nil
cancel:nil
)
|
-
choose: aString fromList: list values: listValues buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock multiple: multiple
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
-
choose: aString fromList: list values: listValues buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock multiple: multiple postBuildBlock: aBlockOrNil
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
usage example(s):
full example:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:10
cancel:nil
multiple:true
)
no buttons:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:4
cancel:nil
multiple:true
)
|
-
choose: aString fromList: list values: listValues buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock postBuildBlock: postBuildBlock
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
full example:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:10
cancel:nil
)
no buttons:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:4
cancel:nil
)
no list (lines argument is ignored):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:nil
values:nil
buttons:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:nil
cancel:nil
)
full including cancel value:
Transcript showCR:(
Dialog
choose:'choose example'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:4
cancel:[Transcript flash. #aborted]
)
degenerated:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:nil
values:nil
buttons:nil
values:nil
lines:nil
cancel:nil
)
|
-
choose: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil buttons: buttonLabels values: buttonValues default: defaultValue lines: maxLines cancel: cancelBlock multiple: multiple postBuildBlock: aBlockOrNil
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
-
choose: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil buttons: buttonLabels values: buttonValues default: defaultValue lines: maxLines cancel: cancelBlock multiple: multiple title: windowTitle postBuildBlock: aBlockOrNil
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
usage example(s):
full example:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4)
initialSelection: nil
buttons:#('five' 'six' 'seven') values:#(5 6 7)
default:6
lines:10
cancel:nil
multiple:true
postBuildBlock:nil
)
no buttons:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:4
cancel:nil
multiple:true
)
|
-
choose: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil buttons: buttonLabels values: buttonValues default: defaultValue lines: maxLines width: boxWidthOrNil cancel: cancelBlock multiple: multiple title: windowTitle postBuildBlock: aBlockOrNil
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
The buttonValue may be a block of up to 3 arguments; it gets the selection, the box and selIndices as args.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
usage example(s):
full example:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4)
initialSelection: nil
buttons:#('five' 'six' 'seven') values:#(5 6 7)
default:6
lines:10
cancel:nil
multiple:true
postBuildBlock:nil
)
no buttons:
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:4
cancel:nil
multiple:true
)
|
-
choose: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock multiple: multiple postBuildBlock: aBlockOrNil
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
If a list is present, multiple controls if multiple selections are allowed.
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns nil or an empty collection (if multiple is true).
-
choose: aString fromList: list values: listValues lines: maxLines
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three')
values:#(1 2 3)
lines:4
)
|
-
choose: aString fromList: list values: listValues lines: maxLines cancel: cancelBlock
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:4
cancel:nil
)
Transcript showCR:(
Dialog
choose:'choose example'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:4
cancel:[Transcript flash. #aborted]
)
|
-
choose: aString fromList: list values: values lines: maxLines cancel: cancelBlock title: windowTitle
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
title:'Choose'
)
|
-
choose: aString fromList: list values: values lines: maxLines initialSelection: initialSelection title: windowTitle
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
title:'Choose'
)
|
-
choose: aString fromList: list values: values lines: maxLines title: windowTitle
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection is treated like cancel.
usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(1 2 3 4 5 6 7)
lines:4
title:'Choose'
)
|
-
choose: aString label: windowLabel image: imageOrNil labels: buttonLabels values: values default: default onCancel: cancelValue
-
launch a Dialog, which allows user to enter any of buttonLabels.
Returning a corresponding value from the values-array.
The default entries button is marked as a return button and entering
return will choose that value; hitting escape returns cancelValue.
For a good userInterface style, we recommend this being the last
entry (to make the right-most button the default button).
usage example(s):
no good style (default button is not the rightmost one)
Dialog
choose:'choose any'
label:'Foo Bar Baz'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:2
onCancel:1
Dialog
choose:'choose any'
labels:#('cancel' 'foo' 'bar' 'baz')
values:#(nil foo bar baz)
default:#baz
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:nil
|
-
choose: aString label: windowLabel labels: buttonLabels values: values default: default
-
launch a Dialog, which allows user to enter any of buttonLabels.
Returning a corresponding value from the values-array.
The default entries button is marked as a return button and entering
return will choose that value; hitting escape returns nil.
For a good userInterface style, we recommend this being the last
entry (to make the right-most button the default button).
usage example(s):
no good style (default button is not the rightmost one)
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:2
Dialog
choose:'choose any'
labels:#('cancel' 'foo' 'bar' 'baz')
values:#(nil foo bar baz)
default:#baz
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:nil
|
-
choose: aString label: windowLabel labels: buttonLabels values: values default: default onCancel: cancelValue
-
launch a Dialog, which allows user to enter any of buttonLabels.
Returning a corresponding value from the values-array.
The default entries button is marked as a return button and entering
return will choose that value; hitting escape returns cancelValue.
For a good userInterface style, we recommend this being the last
entry (to make the right-most button the default button).
usage example(s):
no good style (default button is not the rightmost one)
Dialog
choose:'choose any'
label:'Foo Bar Baz'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:2
onCancel:1
Dialog
choose:'choose any'
labels:#('cancel' 'foo' 'bar' 'baz')
values:#(nil foo bar baz)
default:#baz
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:nil
|
-
choose: aString labels: buttonLabels values: values default: default
-
launch a Dialog, which allows user to enter any of buttonLabels.
Returning a corresponding value from the values-array.
The default entries button is marked as a return button and entering
return will choose that value.
For a good userInterface style, we recommend this being the last
entry (to make the right-most button the default button).
usage example(s):
no good style (default button is not the rightmost one)
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:2
Dialog
choose:'choose any'
labels:#('cancel' 'foo' 'bar' 'baz')
values:#(nil foo bar baz)
default:#baz
Dialog
choose:'choose any'
labels:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
default:nil
|
-
chooseMultiple: aString fromList: list lines: maxLines
-
launch a Dialog showing the message and list.
The user can select any combination of items and click ok;
in this case, the values from list is returned (doubleclick works as well).
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns an empty collection.
usage example(s):
Transcript showCR:(
Dialog
chooseMultiple:'choose any combination'
fromList:#(1 2 3 4 5 6 7)
lines:4
)
|
-
chooseMultiple: aString fromList: list values: listValues buttons: buttonLabels values: buttonValues lines: maxLines cancel: cancelBlock
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns an empty collection.
usage example(s):
full example:
Transcript showCR:(
Dialog
chooseMultiple:'choose selected'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:nil
values:nil
lines:10
cancel:nil
)
Transcript showCR:(
Dialog
chooseMultiple:'choose selected'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#()
values:#()
lines:10
cancel:nil
)
|
-
chooseMultiple: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil lines: maxLines
-
launch a Dialog showing the message and list.
The user can select an item and click ok; in this case, the corresponding value
from listValues is returned (doubleclick works as well).
The list may be suppressed (if the list arg is nil).
Below the list, an optional row of buttons is shown, which can also be
clicked upon, and a corresponding value from buttonValues is returned.
If cancel is pressed, the value of cancelBlock is returned.
Pressing ok without a selection returns an empty collection.
usage example(s):
full example:
Transcript showCR:(
Dialog
chooseMultiple:'choose selected'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
initialSelection:#(2 4)
lines:10
)
Transcript showCR:(
Dialog
chooseMultiple:'choose selected'
fromList:#('one' 'two' 'three' 'four')
values:#('one' 'two' 'three' 'four')
initialSelection:#( 'two' 'three')
lines:10
)
|
on the fly modifications
-
modifyingBoxWith: modifyBlock do: openingBlock
-
perform openingBlock (which usually creates a standard dialog box),
but call modifyBlock right before the dialog is actually opened.
This allows modifyBlock to add additional controls to the dialog.
ModifyBlock is called with the box as argument.
usage example(s):
DialogBox
modifyingBoxWith:[:box |
box allViewBackground:Color red.
] do:[
Dialog information:'hello'
].
|
-
withAdditionalOKButtonLabeled: label1 action: action1 andOKButtonLabeled: label2 action: action2 do: boxOpeningBlock
-
launch a Dialog.
Add two additional ok-like buttons to the bottom panel.
These will invoke the corresponding actions before closing the box with ok
-
withAdditionalOKButtonLabeled: label1 action: action1 do: boxOpeningBlock
-
launch a Dialog.
Add an additional ok-like button to the bottom panel.
This will invoke the corresponding actions before closing the box with ok
-
withCheckBoxFor: checkModelOrNil labelled: checkLabel do: boxOpeningBlock
-
launch a Dialog to warn or request something.
If checkModelOrNil is not nil,
then add a checkbox on a value holder.
-
withOptoutHolder: aValueHolderOrNil labelled: labelString do: boxOpeningBlock
-
launch a Dialog to warn user.
If aValueHolderOrNil is not nil,
then add a 'do not show this dialog again'-like checkbox,
and change aValueHolder if the checkbox was checked.
usage example(s):
Dialog
withOptoutHolder:nil
labelled:'opt out'
do:[ Dialog confirm:'some question' ].
|
-
withOptoutOption: optOutAction1OrNil labelled: labelString1 andOptoutOption: optOutAction2OrNil labelled: labelString2 do: boxOpeningBlock
-
launch a Dialog to warn user.
If the corresponding optOutActionXOrNil is notNil,
add a 'do not show this dialog again'-like checkbox,
and call optOutActionX after the dialog, if the checkbox was indeed checked.
usage example(s):
Dialog
withOptoutOption:[Transcript flash] labelled:'opt out1'
andOptoutOption:[Transcript show:'wow'] labelled:'opt out2'
do:[ Dialog confirm:'some question' ].
|
-
withOptoutOption: optOutActionOrNil labelled: labelString do: boxOpeningBlock
-
launch a Dialog to warn user.
If optOutActionOrNil is not nil,
then add a 'do not show this dialog again'-like checkbox,
and call optOutAction after the dialog, if the checkbox was indeed checked.
usage example(s):
Dialog
withOptoutOption:[Transcript flash]
labelled:'opt out'
do:[ Dialog confirm:'some question' ].
|
usage example(s):
Dialog
withOptoutOption:nil
labelled:'opt out'
do:[ Dialog confirm:'some question' ].
|
-
withOptoutOption: optOutActionOrNil labelled: labelString warn: warnString
-
launch a Dialog to warn user.
If optOutActionOrNil is not nil,
then add a 'do not show this dialog again'-like checkbox,
and call optOutAction after the warning, if the checkbox was indeed checked.
usage example(s):
Dialog
withOptoutOption:[Transcript flash]
labelled:'opt out'
warn:'some warning'.
|
private
-
showAndThenDestroyBox: aBox
-
-
showBox: aBox
-
central method to finally open a dialog box;
determine where to show it:
if ForceModalBoxesToOpenAtCenter is true, it is always opened at the center of the screen
if ForceModalBoxesToOpenAtPointer is true, it is always opened under the mouse pointer
otherwise:
open it centered above the opening application,
or - if opened from another modal box - centered above the current modal box.
If there is no current application (i.e. box is opened from a background thread),
then open it centered on the screen
queries
-
defaultOKButtonAtLeft
-
somewhat of a kludge:
some viewStyles have ok at left (motif), others at right...
usage example(s):
DialogBox defaultOKButtonAtLeft
|
-
defaultParentWindow
-
return a default parent (top-) window for the dialog.
Here, the currently active view is returned, if there
is one; otherwise, the first encountered topView is
returned.
usage example(s):
-
patternForFilters: filtersOrNil
-
argument #filtersOrNil is window specific,
it is an array of arrays with filter (*.zip) and its description (ZIP compressed archive file)
to support a call with just #filtersOrNil and no #patternOrNil the pattern will be extracted from the #filtersOrNil for linux
which is done here
smalltalk dialogs
-
imageSaveDialog: title image: image default: defaultFileName pattern: pattern
-
a complete bitmap image save dialog.
Offers edit and save as button options.
Returns the fileName if saved, nil if not
usage example(s):
Dialog
imageSaveDialog:'save screen image'
image:(Image fromScreen:(0@0 corner:100@100))
default:'screen.png'
pattern:'*.png;*.gif;*.bmp'
|
-
requestClass: aString
-
launch a Dialog, which allows user to enter an existing classes name.
Return the entered class or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClass:'Enter a class:'
|
-
requestClass: aString initialAnswer: initialAnswer
-
launch a Dialog, which allows user to enter an existing classes name.
Return the entered class or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClass:'Enter a class:'
initialAnswer:'Array'
|
-
requestClass: aString list: list okLabel: okLabel initialAnswer: initial
-
launch a Dialog, which allows user to enter an existing classes name.
Return the entered class or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClass:'Enter a class:'
list:(View withAllSubclasses copy sortBySelector:#name)
okLabel:'OK'
initialAnswer:'Arr'
|
-
requestClass: aString okLabel: okLabel initialAnswer: initial
-
launch a Dialog, which allows user to enter an existing class's name.
Return the entered class or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClass:'Enter a class:'
okLabel:'OK'
initialAnswer:'Arr'
|
-
requestClassName: aString initialAnswer: initial
-
launch a Dialog, which allows user to enter a class name.
Return the entered string (may be empty string) or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClassName:'enter a class:'
initialAnswer:'Arr'
|
-
requestClassName: aString list: list okLabel: okLabel initialAnswer: initial
-
launch a Dialog, which allows user to enter a class name.
Return the entered string (may be empty string) or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClassName:'Enter a class:'
list:(Array with:Array with:String with:Point)
okLabel:'OK'
initialAnswer:'Arr'
|
-
requestClassName: aString okLabel: okLabel initialAnswer: initial
-
launch a Dialog, which allows user to enter a class name.
Return the entered string (may be empty string) or nil (if cancel was pressed).
The entryField does classNameCompletion on TAB.
usage example(s):
Dialog
requestClassName:'enter a class:'
okLabel:'OK'
initialAnswer:'Arr'
|
-
requestName: title fromList: nameList title: boxTitle initialAnswer: initialTextOrNil
-
Ask for a name from a list (used for namespaces and sharedPools)
usage example(s):
Dialog
requestName:'Select a Name'
fromList:#('foo' 'bar' 'baz')
title:'blabla'
initialAnswer:nil
|
-
requestNameSpace: title initialAnswer: initialTextOrNil
-
Ask for a namespaces name
usage example(s):
Dialog
requestNameSpace:'Select a NameSpace'
initialAnswer:nil
|
-
requestNameSpace: title title: boxTitle initialAnswer: initialTextOrNil
-
Ask for a namespaces name
usage example(s):
Dialog
requestNameSpace:'Select a NameSpace'
initialAnswer:nil
|
-
requestProject: title from: listOfProjectsIn initialAnswer: initialTextOrNil suggestions: suggestionsOrNil
-
Ask for a project (package-id)
usage example(s):
Dialog
requestProject:'enter a project'
initialAnswer:'stx:libbasic'
suggestions:#('foo' 'bar' 'baz')
|
-
requestProject: title initialAnswer: initialTextOrNil suggestions: suggestions
-
Ask for a project (package-id)
-
requestSelector: aString initialAnswer: initial
-
launch a Dialog, which allows user to enter a method selector.
Return the entered string (may be empty string) or nil (if cancel was pressed).
The entryField does selectorCompletion on TAB.
usage example(s):
Dialog
requestSelector:'enter a selector:'
initialAnswer:'at:p'
|
-
requestSelector: aString okLabel: okLabel initialAnswer: initial
-
launch a Dialog, which allows user to enter a method selector.
Return the entered string (may be empty string) or nil (if cancel was pressed).
The entryField does selectorCompletion on TAB.
usage example(s):
Dialog
requestSelector:'enter a selector:'
initialAnswer:'at:p'
|
-
requestSharedPool: title title: boxTitle initialAnswer: initialTextOrNil
-
Ask for a sharedPools name
usage example(s):
Dialog
requestSharedPool:'Select a SharedPool'
title:nil
initialAnswer:nil
|
accessing-behavior
-
abortAction: aBlock
-
define the action to be performed when abort is pressed
-
acceptCheck: aBlock
-
if nonNil, the acceptCheck-block is evaluated when the dialog is
accepted (ok-button or Return-key). If it returns true, the box is closed,
otherwise not. Of course, you may also use a valueHolder instead of a block
to provide the check value.
-
acceptOnLeave: aBoolean
-
define the behavior when the last input field is left via cursor keys.
The default is to accept & close the dialog (i.e. true).
-
acceptReturnAsOK: aBoolean
-
turn on/off interpretation of return-key as ok.
Default is on
-
action: aBlock
-
set the action to be performed when user presses ok-button;
aBlock must be nil or a block. This method simply
reuses okAction: and has been added for a consistent action-setting
protocol.
-
focusOnField: anInputField
-
arrange for the argument to get the focus (initially)
-
focusToOKOnLeave: aBoolean
-
define the behavior when the last input field is left via a return
or cursor key.
The default is to shift the focus to the OK button (i.e. true).
If turned off, the OK is immediately performed, i.e.
the dialog is accepted & closed.
-
hideOnAccept: aBoolean
-
control if the dialog should close when accepted.
The default is true
-
makeTabable: aComponentOrSubcomponent
-
add a component (usually a subcomponent, of which the dialog
does not know) to the list of tabable ones (i.e. those, that can be
stepped through via FocusNext/FocusPrevious).
Toplevel tabable components are usually added with #addComponent:tabable:
-
makeTabable: aComponentOrSubcomponent after: anotherComponent
-
add a component (usually a subcomponent, of which the dialog
does not know) to the list of tabable ones (i.e. those, that can be
stepped through via FocusNext/FocusPrevious).
Toplevel tabable components are usually added with #addComponent:tabable:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
makeUntabable: aComponentOrSubcomponent
-
(tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[
-
noAction: aBlock
-
define the action to be performed when 'no' is pressed
-
okAction: aBlock
-
define the action to be performed when ok is pressed
-
title: aString yesAction: yesBlock noAction: noBlock
-
define title and actions
-
yesAction: aBlock
-
define the action to be performed when 'yes' is pressed
-
yesAction: yesBlock noAction: noBlock
-
define both actions
accessing-channels
-
acceptChannel
-
same as #accept: return the valueHolder which is set to true when the box
is accepted
-
acceptChannel: aValueHolder
-
set the valueHolder which is set to true when the box
is accepted
accessing-components
-
abortButton
-
return the abortButton - this access is provided to allow
setting the buttons look (for example: colors or font)
-
buttonPanel
-
return the buttonPanel - this access is provided to allow
setting the buttons look (for example: colors or font)
-
cancelButton
-
same as #abortButton;
return the abortButton - this access is provided to allow
setting the buttons look (for example: colors or font)
-
noButton
-
return the no-button
-
okButton
-
return the okButton - this access is provided to allow
setting the buttons look (for example: colors or font)
-
verticalPanel
-
if there is none yet, create and add a vertical panel.
This can be used to add additional components in an aboutToOpen hook callback.
usage example(s):
-
verticalPanelIfPresent
-
-
yesButton
-
return the 'yes'-button
accessing-elements
-
componentAt: name
-
retrieve a component by name - to access it, it must have been
named previously with #name:as:
-
name: element as: name
-
assign a name to a component. This can be done during construction,
to allow later access to the components (i.e. without a need to
remember them in some instVars)
accessing-look
-
abortText: aString
-
define the label in the abort-button
-
hideButtons
-
hides the buttonPanel (i.e. the ok and cancel buttons if any)
-
noLabel: aString
-
define the label of the 'no'-button.
And alias for #noText: - for backward compatibility
-
noText: aString
-
define the label of the no-button.
If not set, it defaults to the resource-string for 'no'.
-
okText: aString
-
define the text in the ok-button
-
okText: okString abortText: abortString
-
set both texts displayed in the buttons
-
okText: yesString noText: noString
-
define the labels of both buttons.
Alias for yesText:noText: for backward compatibility.
-
title: aString
-
define title
usage example(s):
DialogBox new open
(DialogBox new title:'Foo') open
|
-
title: aString yesText: yesString noText: noString
-
define title and button labels
-
yesLabel: aString
-
define the label of the 'yes'-button.
An alias for #yesText: for backward compatibility.
-
yesText: aString
-
define the label of the 'yes'-button
-
yesText: yesString noText: noString
-
define the labels of both buttons
accessing-models
-
accept
-
return the valueHolder holding true when the box
is accepted, false if closed via the windowManager or
the cancel button.
This is confusing: this method was originally called #acceptValue,
but renamed for compatibility with ST-80.
This looks like a bad name to me, since in most other situations, #accept
is used to force an accept, not to return some valueHolder ...).
-
aspectAt: anAspectSymbol put: aDataModel
-
return the dataModel for some aspect, nil if no such dataModel was defined;
requires that a corresponding dataModel has been set (usually during
initialization) via the #aspectAt:put: message.
Allows users of boxes to access individual values - especially useful,
in multi-field dialogs.
-
aspectFor: anAspectSymbol
-
return the dataModel for some aspect, nil if no such dataModel was defined;
requires that a corresponding dataModel has been set (usually during
initialization) via the #aspectAt:put: message.
Allows users of boxes to access individual values - especially useful,
in multi-field dialogs.
-
cancel
-
construction-adding
-
addComponent: aComponent
-
add any component with its preferred height and full width.
Returns the component.
-
addComponent: aComponent indent: indent
-
add any component with its preferred height and full width.
The indent is temporarily changed to indent.
Returns the component.
-
addComponent: aComponent indent: indent tabable: tabable
-
add any component with its preferred height and full width.
The indent is temporarily changed to indent.
Returns the component.
-
addComponent: aComponent indent: indent withExtent: ext
-
add any component with some given extent.
Returns the component.
-
addComponent: aComponent indent: indent withHeight: height
-
add any component with some given height and full width.
Returns the component.
-
addComponent: aComponent tabable: tabable
-
add any component with its preferred height and full width.
Returns the component.
-
addComponent: aComponent tabable: tabable tabbedComponent: subComponent
-
add any component with its preferred height and full width.
Returns the component.
-
addComponent: aComponent withExtent: ext
-
add any component with some given extent.
Returns the component.
-
addComponent: aComponent withHeight: height
-
add any component with some given height and full width.
Returns the component.
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable from: leftX to: rightX separateAtX: relativeX
-
add a label and some view side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable from: leftX to: rightX separateAtX: relativeX nameAs: aName
-
add a label and some view side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable from: leftX to: rightX separateAtX: relativeX nameAs: aName foregroundColor: fgColor
-
add a label and some view side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable separateAtX: relativeX
-
add a label and some view side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
-
addMessage: labelString centered: centered
-
-
addMessage: labelString textLine: valueHolder boundary: fraction
-
-
addMessage: labelString textLine: valueHolder type: typeSymbolOrNil boundary: fraction
-
-
addTextLabel: aString
-
create a text label - the name has been choosen for ST-80 compatibility;
however, ST/X labels allow image labels too.
Returns the label.
-
addTextLabel: aString adjust: how
-
create a text label - the name has been choosen for ST-80 compatibility;
however, ST/X labels allow image labels too.
Returns the label.
The adjust argument must be one of #left, #right or #center (see Label for details)
-
addTextLabelOn: aValueHolder
-
create a text label showing the contents of a valueHolder.
Returns the label.
-
addTextLabelOn: aStringHolder adjust: how
-
create a text label - the name has been choosen for ST-80 compatibility;
however, ST/X labels allow image labels too.
Returns the label.
The adjust argument must be one of #left, #right or #center (see Label for details)
-
addToInputFieldGroup: aComponentOrSubcomponent
-
add a component to the input group.
The argument, aComponentOrSubcomponent may even be a nested subcomponent of
a topLevel component.
-
addToInputFieldGroup: aComponentOrSubcomponent before: anotherComponent
-
add a component to the input group.
The argument, aComponentOrSubcomponent may even be a nested subcomponent of
a topLevel component.
-
removeFromInputFieldGroup: aComponentOrSubcomponent
-
remove a component from the input group.
The argument, aComponentOrSubcomponent may even be a nested subcomponent of
a topLevel component.
construction-buttons
-
addAbortAndOkButtons
-
create both abort- (i.e. cancel) and Ok Buttons
-
addAbortButton
-
create an abortButton - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
Returns the button.
-
addAbortButton: aButton
-
add an already created abortButton - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
Returns the button.
-
addAbortButtonLabelled: buttonLabel
-
create an abortButton with a label - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
A nil argument creates one with the default label.
Returns the button.
-
addButton: aButton
-
add a button into the buttonPanel.
Returns the button.
usage example(s):
^ self addButton:aButton after:nil
|
-
addButton: aButton after: someOtherButtonOrNil
-
add a button into the buttonPanel.
If the argument someOtherButtonOrNil is nil, the button is
added at the end.
Returns the button
-
addButton: aButton before: someOtherButtonOrNil
-
add a button into the buttonPanel.
If the argument someOtherButtonOrNil is nil, the button is
added upFront.
Returns the button
-
addHelpButtonFor: pathToHelpText
-
add a help button to the buttonPanel.
The argument, pathToHelpText should specify the path to the help
text under either the doc/online/<language> or the help/<language>
directory.
Returns the button
-
addHelpButtonWithAction: helpAction
-
add a help button to the buttonPanel.
The argument, helpAction is avaluated when clicked.
Returns the button
-
addOK: checkBlock
-
Visualworks compatibility method. Here, checkBlock is ignored
-
addOkButton
-
create an okButton - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
Returns the button.
-
addOkButton: aButton
-
add an already created okButton - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
Returns the button.
-
addOkButtonLabelled: buttonLabel
-
create an okButton with a label - to be sent from redefined initialize
methods in subclasses or when creating a box programmatically.
A nil argument creates one with the default text.
Returns the button.
-
removeAbortButton
-
remove an already added okButton - only useful to change some already created
dialog afterwards
-
removeOkButton
-
remove an already added okButton - only useful to change some already created
dialog afterwards
construction-check & comboboxes
-
addCheckBox: label on: aModel
-
create a checkBox with label on aModel and add it.
Returns the checkBox widget.
-
addCheckBox: label on: aModel tabable: tabable
-
create a checkBox with label on aModel and add it.
Returns the checkBox widget.
-
addCheckBoxAtBottom: checkLabel on: aValueHolder
-
add a checkbox and make it stick at the bottom.
Returns the checkBox widget.
-
addComboBoxOn: aModel
-
create a comboBoxView on aModel and add it.
Returns the comboBox widget.
-
addComboBoxOn: aModel list: list tabable: tabable
-
create a comboBoxView on aModel and add it.
Returns the comboBox widget.
-
addComboBoxOn: aModel tabable: tabable
-
create a comboBoxView on aModel and add it.
Returns the comboBox widget.
-
addComboListOn: aModel
-
create a comboListView on aModel and add it.
Returns the comboList widget.
-
addComboListOn: aModel list: list tabable: tabable
-
create a comboListView on aModel and add it.
Returns the comboList widget.
-
addComboListOn: aModel tabable: tabable
-
create a comboListView on aModel and add it.
Returns the comboList widget.
-
addTriggerBox: label action: aBlock
-
create a triggerBox with label and action and add it.
Returns the triggerBox widget
construction-inputfields
-
addFilenameInputFieldOn: aModel in: aDirectory tabable: tabable
-
create a fileName input field on aModel and add it.
Returns the field. This is much like a normal input field,
but supports filename completion.
-
addInputField: aField
-
add an already created input field.
Returns the field.
-
addInputField: aField tabable: tabable
-
add an already created input field.
If tabable is true, the field is put into a group, to allow
stepping through the fields with #Cursor/#Return keys.
Returns the field.
-
addInputFieldOn: aModel
-
create an input field on aModel and add it.
Returns the field.
-
addInputFieldOn: aModel tabable: tabable
-
create an input field on aModel and add it.
If tabable is false, the field cannot be tabbed into
and return does not close the box.
(pointer must be moved into it).
Returns the field.
-
addLabelledInputField: labelString adjust: labelAdjust on: model tabable: tabable from: leftX to: rightX separateAtX: relativeX
-
add a label and an inputField side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
-
addLabelledInputField: labelString adjust: labelAdjust on: model tabable: tabable separateAtX: relativeX
-
add a label and an inputField side-by-side.
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
construction-layout
-
addGap
-
VW compatibility
-
addGap: pixels
-
VW compatibility
-
addHorizontalLine
-
add a horizontal line as separator
-
addVerticalSpace
-
add a default vertical space (1 mm)
-
addVerticalSpace: nPixel
-
add some pixels of space to the next component
construction-lists
-
addList: listHolder lines: nLines validation: validateionBlock
-
-
addListBoxOn: aModel
-
add a selectionInListView to the box.
The listViews ScrollWrapper is returned
-
addListBoxOn: aModel class: aListViewClass
-
create & add an instance of aListViewClass to the box.
The listViews ScrollWrapper is returned
-
addListBoxOn: aModel class: aListViewClass withNumberOfLines: numLines
-
create and add an instance of aListViewClass to the box.
The list has numLines (if nonNil) number of lines shown.
The listViews ScrollWrapper is returned
-
addListBoxOn: aModel class: aListViewClass withNumberOfLines: numLines hScrollable: hs vScrollable: vs
-
add an instance of aListViewClass (selectionInListView) to the box.
The list has numLines (if nonNil) number of lines shown.
If scrolled, the ScrollWrapper is returned - otherwise the listView.
-
addListBoxOn: aModel withNumberOfLines: numLines
-
add a selectionInListView to the box.
The list has numLines (if nonNil) number of lines shown.
The listViews ScrollWrapper is returned
-
addListBoxOn: aModel withNumberOfLines: numLines hScrollable: hs vScrollable: vs
-
add a selectionInListView to the box.
The list has numLines (if nonNil) number of lines shown.
If scrolled, the ScrollWrapper is returned - otherwise the listView.
-
addPopUpList: labelString on: aModel
-
create a popUpList with a label on aModel and add it.
Returns the box.
-
addPopUpList: labelString on: aModel tabable: tabable
-
create a popUpList on aModel and add it.
Returns the popUpList.
-
addPopUpListOn: aModel
-
create a popUpList on aModel and add it.
Returns the box.
-
addPopUpListOn: aModel tabable: tabable
-
create a popUpList on aModel and add it.
Returns the popUpList.
-
addRadioButton: labelString on: aRadioButtonGroupModel value: radioValue tabable: tabable
-
create a radio button on aModel and add it.
Returns the radio button.
-
addTextBoxOn: aModel class: aListViewClass withNumberOfLines: numLines hScrollable: hs vScrollable: vs
-
add an instance of aListViewClass to the box.
The list has numLines (if nonNil) number of lines shown.
If scrolled, the ScrollWrapper is returned - otherwise the listView.
construction-rows & columns
-
addColumn: aRow fromX: leftX toX: rightX collect: aBlock
-
add some elements in a vertical column.
Equally space elements as returned from aBlock.
-
addColumn: aRow fromX: leftX toX: rightX collect: aBlock tabable: tabable
-
add some elements in a vertical column.
Equally space elements as returned from aBlock.
-
addColumn: aRow fromX: leftX toX: rightX collect: aBlock tabable: tabable horizontalLayout: hLayout
-
add some elements in a vertical column.
Equally space elements as returned from aBlock.
-
addRow: aCol fromX: leftX toX: rightX collect: aBlock
-
add some elements in a horizontal row.
Equally space elements as returned from aBlock.
Advance y.
-
addRow: aCol fromX: leftX toX: rightX collect: aBlock tabable: tabable
-
add some elements in a horizontal row.
Equally space elements as returned from aBlock.
Advance y.
-
addRow: aCol fromX: leftX toX: rightX collect: aBlock tabable: tabable horizontalLayout: hLayout
-
add some elements in a horizontal row.
Equally space elements as returned from aBlock.
Advance y.
-
addRow: aCol fromX: leftX toX: rightX collect: aBlock tabable: tabable horizontalLayout: hLayout verticalLayout: vLayout
-
add some elements in a horizontal row.
Equally space elements as returned from aBlock.
Advance y.
explicit focus control
-
focusOnOk
-
initialization & release
-
defaultExtent
-
redefined to return my last extent
as default for the open
-
initialize
-
must be called if redefined
-
reAdjustGeometry
-
sent late in snapin processing - gives me a chance
to resize for changed font dimensions.
-
rememberLastExtent
-
can be redefined in subclasses to return true
iff the default size should be the same as the size when last closed.
If false is returned, the default size is computed from the contents.
Remembering is useful for file-selection boxes,
when the user resized the box for many files.
It is NOT useful for generic box (like information:) which should just
adopt to their contents.
Here, false is returned as default, because I am abstract, not knowing what is
shown in me.
layout control
-
bottomAlign: widgets
-
mhmh - seems similar to our stickAtBottom functionality - to be checked
-
bottomAlignLowerEdge: widget
-
mhmh - seems similar to our stickAtBottom functionality - to be checked
-
leftIndent
-
return the current indent
(current x position - that's where the next component will be positioned).
-
leftIndent: aNumber
-
set the left indent
(current x position - that's where the next component(s) will be located).
Setting this before adding a component will place it indented
-
rightIndent
-
return the current right indent.
-
rightIndent: aNumber
-
set the right indent
-
setInitialGap
-
-
stickAtBottomWithFixHeight: aComponent
-
arrange for a component to be positioned at a constant offset
from the bottom of the box and its height to remain the same.
This will keep the component at a constant distance from the bottom
(without this setup, it would stay at a constant offset from the top).
ATTENTION: use this as a last step, after all components have been added.
-
stickAtBottomWithFixHeight: aComponent left: left right: right
-
arrange for a component to be positioned at a constant offset
from the bottom of the box and its height to remain the same.
This will keep the component at a constant distance from the bottom
(without this setup, it would stay at a constant offset from the top).
ATTENTION: use this as a last step, after all components have been added.
-
stickAtBottomWithVariableHeight: aComponent
-
arrange for a component to be positioned at a constant offset
from the bottom of the box and its height to be adjusted.
This will resize the component for a constant distance from the top,
and the bottom.
(without this setup, its height would remain constant).
ATTENTION: use this as a last step, after all components have been added.
-
yPosition
-
return the current y position
(that's where the next component will be positioned).
-
yPosition: aNumber
-
set the current y position
(that's where the next component will be positioned).
private
-
assignKeyboardFocusToFirstKeyboardConsumer
-
disabled - the focus might have already been changed
-
basicAddComponent: aComponent
-
add a component, don't change its size
-
forceResize
-
force a recomputation of my size.
Call this, when elements where added to a subcomponent,
of which I cannot know.
Eg. when someone gets the buttonPanel or the verticalPanel and adds an element to it
-
hideAndEvaluate: aBlock
-
if I am modal, make myself invisible and evaluate aBlock.
If nonModal, stay up, but also evaluate the block.
-
preOpen
-
-
realize
-
if any inputFields where added, activate the first one
-
resize
-
verticalPanel notNil ifTrue:[
queries
-
accepted
-
after the box has closed:
return true if accepted, false if canceled
-
computePreferredExtent
-
return my preferred extent.
That is the max component width, or my current width (default);
whichever is larger, by the sum of the component's heights.
-
interfaceSpecFor: aSelector
-
return an interface spec.
Notice - Dialog should be moved under AppModel so this becomes obsolete.
-
maxPreferredWidthOfAddedComponents
-
helper for computing my preferred extent.
That is the max component width
-
positionOffset
-
return the delta, by which the box should be displayed
from the mouse pointer. Here, an offset is returned, which
makes the center of the first return-Button in the panel
appear under the cursor. If there is no such button,
use my superclasses offset.
-
specificationFor: aKey
-
return an interface spec's literal encoding.
Notice - Dialog should be moved under AppModel so this becomes obsolete.
testing
-
isDialogBox
-
user actions
-
abortPressed
-
sent by the cancel button; user pressed abort button
- hide myself and evaluate okAction
-
actionArgument
-
-
closeCancel
-
closed via escape
-
doAccept
-
let all components accept (i.e. update their model from the values),
then set my accept value to true.
This is confusing: this method was originally called #accept,
but renamed for compatibility with ST-80, where #accept returns the
accept-valueHolder (which looks like a bad name to me ...).
-
hide
-
redefined to remember my last extent;
used as default for the next open
-
keyPress: aKey x: x y: y
-
return-key duplicates ok-function if acceptReturnAsOK is true
-
lastFieldLeft
-
if the dialog involves input fields, this is called
when the last field is left by Return-key or NextField-key
-
okPressed
-
sent by the okButton; user pressed ok-button
- make myself invisible and if an action was specified do it
-
openDialog
-
historically, DialogBox was used as an abstract class as a base for InfoBox,
YesNoBox etc.
However, the programmatic construction protocol (#addComponent:)
now allows those classes to be easily replaced and future versions of
ST/X may do this and make those subclasses obsolete.
However, dummy stubs will remain to exist for backward compatibility
(i.e. do not fear using YesNoBox, EnterBox etc.)
For most simple standard dialogs, there are ready to use
methods in the class protocol.
For example:
info & warnings:
Dialog information:'hi there'
|
yes/no questions:
(Dialog confirm:'is this simple ?')
ifTrue:[
Transcript showCR:'thats what I expected'
] ifFalse:[
Transcript showCR:'read more examples and documentation'
]
|
yes/no question with cancel option:
|answer|
answer := Dialog confirmWithCancel:'is this simple ?'.
answer isNil ifTrue:[
Transcript showCR:'no easy decision'
] ifFalse:[
answer ifTrue:[
Transcript showCR:'thats what I expected'
] ifFalse:[
Transcript showCR:'read more examples and documentation'
]
]
|
asking for a string:
|s|
s := Dialog request:'enter your name, please:'.
s notEmpty ifTrue:[
Transcript showCR:'you entered: ' , s.
]
|
asking for a string with given default:
|s|
s := Dialog
request:'enter your name, please:'
initialAnswer:(OperatingSystem getLoginName).
s notEmpty ifTrue:[
Transcript showCR:'you entered: ' , s.
]
|
asking for a filename:
|s|
s := Dialog
requestFileName:'select a file, please:'
default:''.
Transcript show:'you entered: '; showCR:s.
|
with a namefiler pattern:
|s|
s := Dialog
requestFileName:'select a file, please:'
default:''
pattern:'*.rc'.
Transcript show:'you entered: '; showCR:s.
|
another namefiler pattern:
|s|
s := Dialog
requestFileName:'select a file, please:'
default:''
pattern:'*.rc;*.st;*.h'.
Transcript show:'you entered: '; showCR:s.
|
with changed button label and pattern:
|s|
s := Dialog
requestFileName:'select a file, please:'
default:''
ok:'show'
abort:'cancel'
pattern:'*.rc'.
Transcript show:'you entered: '; showCR:s.
|
asking for a password:
|s|
s := Dialog
requestPassword:'enter your secret, please:'.
Transcript show:'you entered: '; showCR:s.
|
multiple choice dialogs:
Dialog
choose:'choose any'
fromList:nil
values:nil
buttons:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
lines:nil
cancel:nil
|
multiple choice dialog, with list & buttons:
Transcript showCR:(
Dialog
choose:'choose example'
fromList:#('one' 'two' 'three' 'four')
values:#(1 2 3 4)
buttons:#('five' 'six' 'seven')
values:#(5 6 7)
lines:4
cancel:[Transcript flash. #aborted]
)
|
You can (and often have to) construct custom dialogs programmatically,
from individual components. As shown in the following examples:
basic (unusable) example:
still unusable - only an ok-button:
DialogBox new addOkButton; open
|
both ok- and abortButtons:
DialogBox new addAbortButton; addOkButton; open
|
with different ok-label:
DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open
|
adding a (centered by default) textlabel gives an infoBox:
DialogBox new
addTextLabel:'hello';
addOkButton;
open
|
a textlabel with abort- and okButton gives a yesNoBox:
DialogBox new
addTextLabel:'hello';
addAbortButton;
addOkButton;
open
|
the same, adjusting the labels contents to the left:
|box|
box := DialogBox new.
(box addTextLabel:'hello') adjust:#left.
box addAbortButton;
addOkButton;
open
|
with modified buttons:
|box|
box := DialogBox new.
(box addTextLabel:'are you certain ?') adjust:#left.
box addAbortButtonLabelled:'not really'.
(box addOkButtonLabelled:'yes, absolutely')
activeBackgroundColor:Color red.
box open
|
mswindows style (different up/down bitmaps in buttons):
((try tabbing ...)
|b box|
box := DialogBox new.
(box addTextLabel:'are you certain ?') adjust:#left.
b := Button new.
b activeLogo:(Image fromFile:'cancel_down.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b passiveLogo:(Image fromFile:'cancel_up.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b focusLogo:(Image fromFile:'cancel_focus.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b beImageButton.
box addAbortButton:b.
b := Button new.
b activeLogo:(Image fromFile:'ok_down.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b passiveLogo:(Image fromFile:'ok_up.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b focusLogo:(Image fromFile:'ok_focus.bmp' inPackage:'stx:goodies/bitmaps/winImages').
b beImageButton.
box addOkButton:b.
box open
|
two textlabels:
DialogBox new
addTextLabel:'hello';
addTextLabel:'world';
addAbortButton;
addOkButton;
open
|
fixing the dialog's size (suppress it calculating its size from the
preferredExtents of its components):
DialogBox new
label:'a simple dialog';
addTextLabel:'hello';
addAbortButton;
addOkButton;
extent:200@200;
sizeFixed:true;
open
|
asking the box if it was closed via ok:
(DialogBox new
label:'a simple dialog';
addTextLabel:'hello';
addAbortButton;
addOkButton;
extent:200@200;
sizeFixed:true;
open
) accepted ifTrue:[
Transcript showCR:'yes'
] ifFalse:[
Transcript showCR:'no'
]
|
textLabels are not limited to strings (although, the name which is
used for ST-80 compatibility, suggests it):
DialogBox new
addTextLabel:(Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages');
addOkButton;
open
|
DialogBox new
addTextLabel:'hello';
addTextLabel:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages')
magnifiedTo:200@150);
addTextLabel:'world';
addAbortButton;
addOkButton;
open
|
adding an input field (on a string model):
|stringModel|
stringModel := '' asValue.
(DialogBox new
addTextLabel:'Please enter a string:';
addInputFieldOn:stringModel;
addAbortButton;
addOkButton;
open
) accepted ifTrue:[
Transcript showCR:'entered: ', stringModel value
]
|
multiple input fields (notice, that the dialog connects the fields
in a group, so stepping is allowed via Cursor and Return keys):
|firstName lastName|
firstName := '' asValue.
lastName := '' asValue.
(DialogBox new
addTextLabel:'Please enter your name:';
addInputFieldOn:firstName;
addVerticalSpace;
addInputFieldOn:lastName;
addAbortButton;
addOkButton;
open
) accepted ifTrue:[
Transcript showCR:'entered: ', firstName value , ' ' , lastName value
]
|
of course, the model may contain a value initially:
|firstName lastName p line i name|
firstName := '' asValue.
lastName := '' asValue.
p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName.
p notNil ifTrue:[
line := p nextLine.
(i := line findString:'Name:') ~~ 0 ifTrue:[
name := line copyFrom:(i + 'Name:' size).
] ifFalse:[
(i := line findString:'real life:') == 0 ifTrue:[
line := p nextLine.
].
(i := line findString:'real life:') ~~ 0 ifTrue:[
name := line copyFrom:(i + 'real life:' size).
]
].
name notNil ifTrue:[
firstName value: name asCollectionOfWords first.
lastName value: name asCollectionOfWords last.
Transcript showCR:'initially ' , firstName value , ' ' , lastName value.
].
p close.
].
(DialogBox new
addTextLabel:'Please enter your name:';
addInputFieldOn:firstName;
addVerticalSpace;
addInputFieldOn:lastName;
addAbortButton;
addOkButton;
open
) accepted ifTrue:[
Transcript showCR:'entered: ', firstName value , ' ' , lastName value
]
|
validated password entry:
|box firstEntry secondEntry|
firstEntry := '' asValue.
secondEntry := '' asValue.
box := DialogBox new.
(box addTextLabel:'Please enter your secret:') adjust:#left.
(box addInputFieldOn:firstEntry) passwordCharacter:$*.
box addVerticalSpace.
(box addInputFieldOn:secondEntry) passwordCharacter:$*.
box addAbortButton.
box addOkButton.
box open.
box accepted ifTrue:[
firstEntry value ~= secondEntry value ifTrue:[
Transcript showCR:'wrong input - try again'
] ifFalse:[
Transcript showCR:'entered: ', firstEntry value
]
]
|
input fields with a label:
|box firstNameHolder middleNameHolder lastNameHolder|
firstNameHolder := 'John' asValue.
middleNameHolder := 'F' asValue.
lastNameHolder := 'Peters' asValue.
box := DialogBox new.
box
addLabelledInputField:'first name:'
adjust:#right
on:firstNameHolder
tabable:true
separateAtX:0.4.
box
addLabelledInputField:'middle initial:'
adjust:#right
on:middleNameHolder
tabable:true
separateAtX:0.4.
box
addLabelledInputField:'last name:'
adjust:#right
on:lastNameHolder
tabable:true
separateAtX:0.4.
box addOkButton.
box open.
|
constructing a dialog from other elements:
adding a fileSelectionList:
(since the dialog adds the component with its preferred extent,
ignoring the 300-height, this looks ugly ...
... especially when resized vertically)
|top l scr fileName|
fileName := '' asValue.
top := DialogBox new.
l := FileSelectionList new.
l useIndex:false.
l doubleClickAction:[:name | top okPressed].
l action:[:name | fileName value:name].
scr := ScrollableView forView:l.
scr extent:(1.0 @ 300).
top addComponent:scr.
top addAbortButton; addOkButton.
top openModal.
top accepted ifTrue:[
Transcript show:'fileName: '; showCR:fileName value storeString.
]
|
same, looks better, since the height is made larger (not using
fileLists preferredExtent):
|top l scr fileName|
fileName := '' asValue.
top := DialogBox new.
l := FileSelectionList new.
l useIndex:false.
l doubleClickAction:[:name | top okPressed].
l action:[:name | fileName value:name].
scr := ScrollableView forView:l.
top addComponent:scr withExtent:300@300.
top addAbortButton; addOkButton.
top openModal.
top accepted ifTrue:[
Transcript show:'fileName: '; showCR:fileName value storeString.
]
|
again, setting the boxes initial size and fixing it
(let it ignore the components' preferredExtent):
|top fixFrame l scr fileName|
fileName := '' asValue.
top := DialogBox new.
top extent:300@300.
fixFrame := View new.
fixFrame extent:(1.0 @ 300).
l := FileSelectionList new.
l useIndex:false.
l doubleClickAction:[:name | top okPressed].
l action:[:name | fileName value:name].
scr := ScrollableView forView:l.
scr origin:0.0@0.0 corner:1.0@1.0.
fixFrame add:scr.
top addComponent:fixFrame.
top addAbortButton; addOkButton.
top openModal.
top accepted ifTrue:[
Transcript show:'fileName: '; showCR:fileName value storeString.
]
|
adding a panel with checkBoxes:
|top panel b value1 value2 value3 value4|
value1 := true asValue.
value2 := false asValue.
value3 := false asValue.
value4 := true asValue.
top := DialogBox new.
top extent:200@300.
panel := VerticalPanelView new.
b := CheckBox on:value1. b label:'check1'.
panel addSubView:b.
b := CheckBox on:value2. b label:'check2'.
panel addSubView:b.
b := CheckBox on:value3. b label:'check3'.
panel addSubView:b.
b := CheckBox on:value4. b label:'check4'.
panel addSubView:b.
top addComponent:panel.
top addAbortButton; addOkButton.
top open.
top accepted ifTrue:[
Transcript show:'value1: '; showCR:value1 value.
Transcript show:'value2: '; showCR:value2 value.
Transcript show:'value3: '; showCR:value3 value.
Transcript show:'value4: '; showCR:value4 value.
]
|
same, using a more convenient interface:
|box value1 value2 value3 value4|
value1 := true asValue.
value2 := false asValue.
value3 := false asValue.
value4 := true asValue.
box := DialogBox new.
box extent:200@300.
box addCheckBox:'check1' on:value1.
box addVerticalSpace.
box addCheckBox:'check2' on:value2.
box addVerticalSpace.
box addCheckBox:'check3' on:value3.
box addVerticalSpace.
box addCheckBox:'check4' on:value4.
box addAbortButton; addOkButton.
box open.
box accepted ifTrue:[
Transcript show:'value1: '; showCR:value1 value.
Transcript show:'value2: '; showCR:value2 value.
Transcript show:'value3: '; showCR:value3 value.
Transcript show:'value4: '; showCR:value4 value.
]
|
same, using an even better interface:
|box values labels|
values := #(true false false true) collect:[:val | val asValue].
labels := #('check1' 'check2' 'check3' 'check4').
box := Dialog new.
box
addColumn:(1 to:labels size)
fromX:0.0
toX:1.0
collect:[:index | CheckBox label:(labels at:index) model:(values at:index)]
tabable:true.
box addAbortButton; addOkButton.
box open.
box accepted ifTrue:[
values with:labels do:[:val :lbl |
Transcript show:(lbl , ': '); showCR:val value.
]
]
|
adding two panels in a frame:
|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef|
box := Dialog new.
box label:'example'.
frame := FramedBox label:'frame'.
vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame.
vPanel1 horizontalLayout:#leftSpace.
vPanel1 verticalLayout:#spreadSpace.
vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame.
vPanel2 horizontalLayout:#leftSpace.
vPanel2 verticalLayout:#spreadSpace.
m1 := true asValue.
m2 := true asValue.
m3 := true asValue.
m4 := 'hello' asValue.
vPanel1 add:(Label label:'check1').
vPanel1 add:(Label label:'m2').
vPanel1 add:(Label label:'m3').
vPanel1 add:(Label label:'enter').
vPanel1 add:(Label label:'lbl1').
vPanel1 add:(Label label:'lbl2').
vPanel2 add:(chk := CheckToggle on:m1).
box makeTabable:chk.
vPanel2 add:(chk := CheckToggle on:m2).
box makeTabable:chk.
vPanel2 add:(chk := CheckToggle on:m3).
box makeTabable:chk.
vPanel2 add:(chk := CheckToggle on:m3).
box makeTabable:chk.
vPanel2 add:(chk := CheckToggle on:m3).
box makeTabable:chk.
vPanel2 add:(ef := EditField on:m4).
ef immediateAccept:true.
box makeTabable:ef.
box addComponent:frame.
box addAbortButton; addOkButton.
box openModal.
box accepted ifTrue:[
Transcript showCR:'accepted with:'.
Transcript showCR:' m1: ' , m1 value printString.
Transcript showCR:' m2: ' , m2 value printString.
Transcript showCR:' m3: ' , m3 value printString.
Transcript showCR:' m4: ' , m4 value printString.
]
|
a full example (combined settings dialog - as in launcher):
|box warnSTX allowUnderscore immutableArrays logDoits
listOfLanguages listOfStyles styleNames
frame panel c resourceDir dir |
warnSTX := Compiler warnSTXSpecials asValue.
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue.
immutableArrays := Compiler arraysAreImmutable asValue.
logDoits := Smalltalk logDoits asValue.
listOfLanguages := SelectionInList with:#('english'
'french'
'german'
'italian'
'spanish'
).
listOfLanguages selection:(Language asString).
resourceDir := Smalltalk getSystemFileName:'resources'.
dir := FileDirectory directoryNamed:resourceDir.
styleNames := dir select:[:aFileName | aFileName endsWith:'.style'].
styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6].
listOfStyles := SelectionInList with:styleNames sort.
listOfStyles selection:(View defaultStyle asString).
box := Dialog new.
box label:'Settings'.
frame := FramedBox label:'Compiler'.
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
panel horizontalLayout:#leftSpace.
panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize).
panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize).
panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize).
box addComponent:frame.
frame := FramedBox label:'Misc'.
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
panel horizontalLayout:#leftSpace.
panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize).
box addComponent:frame.
frame := FramedBox label:'Language'.
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
panel horizontalLayout:#leftSpace.
panel add:((PopUpList on:listOfLanguages) width:0.5).
box addComponent:frame.
frame := FramedBox label:'Style'.
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame.
panel horizontalLayout:#leftSpace.
panel add:((PopUpList on:listOfStyles) width:0.5).
box addComponent:frame.
box addAbortButton; addOkButton.
box showAtPointer.
box accepted ifTrue:[
Transcript topView withCursor:Cursor wait do:[
Compiler warnSTXSpecials:warnSTX value.
Compiler allowUnderscoreInIdentifier:allowUnderscore value.
Compiler arraysAreImmutable:immutableArrays value.
Smalltalk logDoits:logDoits value.
Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'.
Smalltalk at:#Language put:listOfLanguages selection asSymbol.
Smalltalk changed:#Language.
ResourcePack flushCachedResourcePacks.
Transcript showCR:'change style to ' , listOfStyles selection , ' ...'.
View defaultStyle:listOfStyles selection asSymbol.
]
]
| an example from Hopkins/Horan:
|aText index|
aText := 'Smalltalk/X: An Introduction to Application Development' asText.
index := aText findString:'Smalltalk/X' startingAt:1.
aText emphasizeFrom:index
to:'Smalltalk/X' size + index - 1
with:#bold.
index := aText findString:'Introduction' startingAt:index.
aText emphasizeFrom:index
to:'Introduction' size + index - 1
with:#italic.
Dialog warn:aText
| the same, with colors:
|aText index|
aText := 'Smalltalk/X: An Introduction to Application Development' asText.
index := aText findString:'Smalltalk/X' startingAt:1.
aText emphasizeFrom:index
to:'Smalltalk/X' size + index - 1
with:(Array with:#bold with:#underline with:(#color->Color red)).
index := aText findString:'Introduction' startingAt:index.
aText emphasizeFrom:index
to:'Introduction' size + index - 1
with:#italic.
Dialog warn:aText
|
|