|
Class: DialogBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--ActionWaitBox
|
+--Dolphin::ListPrompter
|
+--Dolphin::MessageBox
|
+--Dolphin::Prompter
|
+--EnterBox
|
+--FontPanel
|
+--InfoBox
|
+--LicenceBox
|
+--MorphicUIManager
|
+--OptionBox
|
+--Tools::SearchDialog
- Package:
- stx:libwidg
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.547
date: 2024/04/19 15:04:35
- user: cg
- file: DialogBox.st directory: libwidg
- module: stx stc-classLibrary: libwidg
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).
copyrightCOPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
inputFocusa DialogBox with multiple input fields can be configured on how it
shall behave if the RETURN key is pressed.
The default is to shift the focus to the ok-button - thus, another return
has to be entered (as confirmation) to close & accept the box.
This can be changed to force an automatic OK with:
aBox focusToOKOnLeave:false
Then, leaving the last field with return, automatically accepts the box,
as if ok was pressed. (useful for simple - single entry dialogs).
All simple dialogs (like 'enter a searchString') behave this way.
With:
aBox acceptReturnAsOK:false
any focusShift or automatic OK is turned off, and the input group
switches its focus back to the topMost field.
The default for this is true.
(useful, if you want an explicit ok from the user, or need all fields
to be handled somehow).
Simply leaving the group with a cursor movement may also be either
interpreted as a return (the default), or again wrap back to the top
of the group.
With:
aBox acceptOnLeave:false
this is turned off, so that with cursor-down, the focus is moved back
to the first entry field. The default is true.
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
|
-
informationHTML: aString title: windowTitle
-
launch a Dialog to tell user something.
The argument aString is html text
-
informationHTML: aString title: windowTitle selfInDoitExpressions: someone
-
launch a Dialog to tell user something.
The argument aString is html text
-
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
-
warn: aString title: windowTitle image: anImage
-
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))
Dialog warn:('some ',('text' withColor:Color blue),' with ',
('color' withColor:Color red),' emphasis')
Dialog warn:(1 to:10 collect:[:i | e'line {i}']) asStringCollection
Dialog warn:(1 to:100 collect:[:i | e'line {i}']) asStringCollection
|
-
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 or escape key
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
|
Usage example(s):
Dialog
confirm:(1 to:100 collect:[:i | e'line {i}'])
title:'fooBar'
yesLabel:'Oh well'
noLabel:'Nope'
initialAnswer:false
Dialog
confirm:(1 to:100 collect:[:i | e'line {i}'])
title:'fooBar'
yesLabel:'Oh well'
noLabel:'Nope'
initialAnswer:true
|
-
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 button labels are given in labelArray with order
#(cancel, no, yes)
(notice that the order may be presented in reverse order in some GUI 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).
(notice that the order may be presented in reverse order in some GUI styles)
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 be presented in reverse order in some GUI 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).
(notice that the order may be presented in reverse order in some GUI styles)
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).
(notice that the order may be presented in reverse order in some GUI styles)
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).
(notice that the order may be presented in reverse order in some GUI styles)
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 ?'
)
|
-
confirmWithRaiseAbortOnCancel: aString default: default title: titleOrNil
-
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
-
defaultFileDialogClass
-
-
defaultFileDialogClassForSave
-
-
defaultLabel
-
return the boxes default window title.
-
defaultMinWidthForListBoxes
-
-
defaultStringMaxLengthForNonScrollableText
-
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
file name dialogs
-
requestDirectoryName
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog requestDirectoryName
|
-
requestDirectoryName: title
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog
requestDirectoryName:'which directory ?'
|
-
requestDirectoryName: title default: aFileName
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
|
-
requestDirectoryName: title default: aFileName acceptReturnAsOK: aBoolean
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
|
-
requestDirectoryName: title default: aFileName ifFail: failValueProvider
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
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.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
ok:'Yes' abort:'No'
|
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failValueProvider
-
Same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
-
requestDirectoryName: title default: aFileName ok: okText abort: abortText ifFail: failValueProvider acceptReturnAsOK: aBoolean
-
Same as requestFileName, but only show directories.
Extended to accept return as ok if wanted.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
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: failValueProvider whenBoxCreatedEvaluate: boxCreatedCallback asLoadDialog: aBoolean
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
-
requestDirectoryName: titleString default: aFileName pattern: pattern fromDirectory: aDirectoryPath
-
same as requestFileName, but only show directories.
Returns nil if cancel was pressed,
empty string if name was cleared but ok was pressed
Usage example(s):
Dialog
requestDirectoryName:'which directory ?'
default:'/etc'
pattern:'*'
fromDirectory:'/'
|
-
requestFileName
-
launch a Dialog, which lets the user 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 lets the user enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or nil (no longer: 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 lets the user 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 nil (was: 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 lets the user 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 nil (was: 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 lets the user 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 the vlue from cancelBlockOrValue 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: cancelBlockOrValue pattern: pattern fromDirectory: dir
-
launch a Dialog, which lets the user 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 orthe value of cancelBlockOrValue if cancel was pressed.
-
requestFileName: titleString default: defaultName ok: okText abort: abortText
-
launch a Dialog, which lets the user 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 lets the user 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 lets the user 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 lets the user 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 lets the user 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 lets the user 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 lets the user 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 lets the user 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 the value from 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 pattern: pattern
-
launch a Dialog, which lets the user 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 lets the user 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 lets the user enter a filename.
The box will not allow pressing 'ok' without an entered string.
Return the pathname string or nil (was: 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 lets the user 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 lets the user 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 lets the user 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 lets the user 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 file name:'
default:''
version:nil
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
Usage example(s):
Dialog
requestFileName:'Enter a file name:'
default:''
version:#old
ifFail:['none']
pattern:'*.conf'
fromDirectory:'/etc'
|
Usage example(s):
Dialog
requestFileName:'Enter a file name:'
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 lets the user 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'
|
-
requestFileName: titleString whenBoxCreatedEvaluate: aBlockOrNil
-
launch a Dialog, which allows user to enter a filename.
Return the pathname string consisting of the full pathname of the filename,
or nil (was: an empty string) if cancel was pressed.
Usage example(s):
Dialog requestFileName:'enter a fileName:'
Dialog requestFileName:'enter a fileName:'
|
-
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 nil (was: 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 nil (was: 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 nil (was: 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 nil (was: 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:'Select multiple files'
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 nil (was: 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 and: string2 label: label
-
launch a Dialog, asking for 2 string values, labelled string1 and string2,
without initial values.
Above the fields, label is shown.
Returns the entered strings as a pair or nil on cancel.
Useful to ask for host+port
Usage example(s):
Dialog
request:'Host:' and:'Port'
label:'Enter Host and Port:'
Dialog
request:'Host:'
|
-
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: string2OrNil asPassWord: isPassword2 on: holder2OrNil label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for (up to) 2 string values, labelled string1 and string2,
with corresponding initial values.
If holder2OrNil isNil, only one field is shown.
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.
If holder2OrNil isNil, only one value is returned.
Useful to ask for user+password or host+port
Usage example(s):
Dialog
request:'UserName:' asPassWord:false on:('tim' asValue)
and:'Password' asPassWord:true on:(nil asValue)
label:'Please Login'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
Usage example(s):
Dialog
request:'UserName:' asPassWord:false on:('tim' asValue)
and:nil asPassWord:nil on:nil
label:'Please Login'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
-
request: string asPassWord: isPassword on: holder label: label title: boxTitle okLabel: okLabel cancelLabel: cancelLabel onCancel: cancelValue
-
launch a Dialog, asking for a string value, labelled string.
Above the field, label is shown, and the window title will be boxTitle.
Returns the entered string or the value from cancelValue.
Useful to ask for a string with an additional help text
Usage example(s):
Dialog
request:'UserName:' asPassWord:false on:('tim' asValue)
label: c'Please Login\nBla bla bla\nmore bla bla bla'
title:'Login'
okLabel:'Login' cancelLabel:'Cancel'
onCancel:nil
|
-
request: string1 initialAnswer: initial1 and: string2 initialAnswer: initial2 label: label
-
launch a Dialog, asking for 2 string values, labelled string1 and string2,
with corresponding initial values.
Above the fields, label is shown.
Returns the entered strings as a pair or nil on cancel.
Useful to ask for host+port
Usage example(s):
Dialog
request:'Host:' initialAnswer:'localhost'
and:'Port' initialAnswer:'8859'
label:'Enter Host and Port:'
Dialog
request:'Host:' initialAnswer:'localhost'
|
-
request: string1 initialAnswer: initial1 and: string2 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:'Host:' initialAnswer:'localhost'
and:'Port' initialAnswer:'8859'
label:'Enter Host and Port'
title:'Host and Port'
okLabel:'OK' 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
Usage example(s):
(Dialog
forRequestText:'Hello'
editViewClass:CodeView
lines:10 columns:80
initialAnswer:'abc'
initialSelection:nil
model:('' asValue)
) open
|
-
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
Usage example(s):
|dialog textHolder|
textHolder := ValueHolder new.
dialog := Dialog
forRequestText:'foo'
editViewClass:EditTextView
lines:10 columns:40
initialAnswer:'hello' model:textHolder.
dialog open.
dialog accepted ifTrue:[
^ textHolder value
].
^ nil
|
Usage example(s):
|dialog textHolder|
textHolder := ValueHolder new.
dialog := Dialog
forRequestText:'foo'
editViewClass:CodeView
lines:10 columns:40
initialAnswer:'hello' model:textHolder.
dialog open.
dialog accepted ifTrue:[
^ textHolder value
].
^ nil
|
-
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
Usage example(s):
|dialog textHolder|
textHolder := ValueHolder new.
dialog := Dialog forRequestText:'foo' lines:10 columns:40 initialAnswer:'hello' model:textHolder.
dialog open.
dialog accepted ifTrue:[
^ textHolder value
].
^ nil
|
-
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
Usage example(s):
|dialog textHolder|
textHolder := ValueHolder new.
dialog := Dialog forRequestText:'foo' lines:10 columns:40 initialAnswer:'hello' model:textHolder.
dialog open.
dialog accepted ifTrue:[
^ textHolder value
].
^ nil
|
-
request: aString
-
launch a Dialog, which allows user to enter something.
Return the entered string (may be empty string)
or nil (no longer: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 the value from 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 the value from 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 the value from 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 the value from 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 nil *was: 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 nil 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 nil 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 title: title
-
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 nil 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 nil 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'
|
-
requestInteger: aString
-
launch a Dialog, which allows user to enter an integer number.
Return the numeric value or nil
(for an invalid number or if cancel was pressed)
Usage example(s):
Dialog requestInteger:'Enter your Age:'
|
-
requestInteger: aString initialAnswer: aNumber
-
launch a Dialog, which allows user to enter an integer.
Return the numeric value or nil
(for an invalid number or if cancel was pressed)
Usage example(s):
Dialog requestInteger:'Enter your Age:' initialAnswer: 25
|
-
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.
Initially, the value given by initialSelection is selected (a value from list, not an index)
Usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(0 10 20 30 40 50 60 70)
lines:4
initialSelection:40
)
|
-
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.
Initially, the value given by initialSelection is selected (a value from list, not an index)
Usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(10 20 30 40 50 60 70)
lines:4
initialSelection:30
title:'Choose'
)
|
-
choose: aString fromList: list lines: maxLines initialSelection: initialSelection title: windowTitle onSelect: selectCallback
-
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.
While the dialog is open, whenever the user
clicks on an item,selectCallback is invoked passing the index as argument
(nil when deselecting)
Usage example(s):
Transcript showCR:(
Dialog
choose:'choose any'
fromList:#(10 20 30 40 50 60 70)
lines:4
initialSelection:40
title:'Choose'
onSelect:[:idx | Transcript showCR: e'You clicked on {idx}']
)
|
-
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:#(10 20 30 40 50 60 70)
lines:4
initialSelection:40
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: buttonLabelsOrNil values: buttonValuesOrNil 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, nil 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, nil 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, nil 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:nil
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
|
-
choose: aString labels: buttonLabels values: values default: default title: windowTitle
-
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
title:'How many Pizzas'
|
-
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, nil 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, nil 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
)
|
-
chooseMultiple: aString fromList: list values: listValues initialSelection: initialListSelectionOrNil lines: maxLines title: boxTitle
-
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, nil 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'
].
|
Usage example(s):
DialogBox
modifyingBoxWith:[:box |
box allViewBackground:Color red.
] do:[
Dialog information:'hello'.
Dialog information:'hello again (should be red)'.
].
|
-
withAdditionalActionButtonLabeled: label1 action: action1 do: boxOpeningBlock
-
launch a Dialog.
Add an additional action button to the button panel at the bottom.
This will invoke action1 and keep the box open (unless it does a hide inside)
Usage example(s):
Dialog
withAdditionalActionButtonLabeled:'Flash Transcript'
action:[Transcript flash]
do:[ Dialog confirm:'some question' ].
|
Usage example(s):
Dialog
withAdditionalActionButtonLabeled:'Flash Transcript'
action:[:dlg | Transcript flash. dlg hide.]
do:[ Dialog confirm:'some question' ].
|
Usage example(s):
Dialog
withAdditionalActionButtonLabeled:'Oh,yes'
action:[Dialog information:'This one without ''Oh yes''']
do:[ Dialog confirm:'some question' ].
|
-
withAdditionalHelpButtonForAction: action1 do: boxOpeningBlock
-
launch a Dialog.
Add an additional Help-like button to the button panel at the bottom.
This will invoke action1 when clicked
Usage example(s):
Dialog
withAdditionalHelpButtonForAction:[Transcript showCR:'help']
do:[ Dialog confirm:'some question' ].
|
Usage example(s):
Dialog
withAdditionalHelpButtonForAction:[Smalltalk openHelp]
do:[ Dialog confirm:'some question' ].
|
-
withAdditionalOKButtonLabeled: label1 action: action1 andOKButtonLabeled: label2 action: action2 do: boxOpeningBlock
-
launch a Dialog.
Add two additional ok-like buttons to the button panel at the bottom.
These will invoke the corresponding action before closing the box with ok
Usage example(s):
Dialog
withAdditionalOKButtonLabeled:'Oh,yes' action:[Transcript flash]
andOKButtonLabeled:'Oh, yes too' action:[Transcript flash]
do:[ Dialog confirm:'some question' ].
|
-
withAdditionalOKButtonLabeled: label1 action: action1 do: boxOpeningBlock
-
launch a Dialog.
Add an additional ok-like button to the button panel at the bottom.
This will invoke action1 before closing the box with ok
Usage example(s):
Dialog
withAdditionalOKButtonLabeled:'Oh,yes'
action:[Transcript flash]
do:[ Dialog confirm:'some question' ].
|
Usage example(s):
Dialog
withAdditionalOKButtonLabeled:'Oh,yes'
action:[Dialog information:'This one without ''Oh yes''']
do:[ Dialog confirm:'some question' ].
|
-
withAutoAcceptAfter: autoAcceptTimeOrNil do: aBoxCreationAction
-
patch the dialog, adding a label for the remaining time
-
withAutoAcceptOrCancel: isCancelBoolean after: autoTimeOrNil do: aBoxCreationAction
-
patch the dialog, adding a label for the remaining time
-
withAutoCancelAfter: autoAcceptTimeOrNil do: aBoxCreationAction
-
patch the dialog, adding a label for the remaining time
-
withCheckBoxFor: checkModelOrNil1 labelled: checkLabel1 and: checkModelOrNil2 labelled: checkLabel2 do: boxOpeningBlock
-
launch a Dialog with boxOpeningBlock.
Either checkModelOrNil is not nil,
then add a corresponding checkbox on a value holder to the dialog.
Usage example(s):
|h1 h2|
h1 := true asValue.
h2 := true asValue.
Dialog
withCheckBoxFor:h1 labelled:'a choice'
and:h2 labelled:'another choice'
do:[ Dialog confirm:'some question' ].
|
-
withCheckBoxFor: checkModelOrNil labelled: checkLabel do: boxOpeningBlock
-
launch a Dialog with boxOpeningBlock.
If checkModelOrNil is not nil, then add a checkbox on a value holder
to the dialog.
Usage example(s):
|h|
h := true asValue.
Dialog
withCheckBoxFor:h
labelled:'another choice'
do:[ Dialog confirm:'some question' ].
|
-
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):
|holder|
holder := false asValue.
Dialog
withOptoutHolder:holder
labelled:'opt out'
do:[ Dialog confirm:'some question' ].
Transcript showCR:(holder value)
|
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'.
|
-
withPopUpList: aSelectionInList labelled: listLabel do: boxOpeningBlock
-
launch a Dialog with boxOpeningBlock.
In addition, at a labelled combolist selecting an item from list
which is held as index in indexHolder.
Usage example(s):
|s|
s := SelectionInList with:#('one' 'two' 'three') initialSelection:2.
Dialog
withPopUpList:s
labelled:'Please choose:'
do:[ Dialog confirm:'some question' ].
Transcript showCR:s selection.
|
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 list: list okLabel: okLabel initialAnswer: initial allowCreateIfAbsent: allowCreateIfAbsent
-
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'
allowCreateIfAbsent:true
|
-
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 (returns a string)
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 forClass: aClassOrNil 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 (in Array):'
forClass:Array
okLabel:'ok'
initialAnswer:'at'.
Dialog
requestSelector:'Enter a selector (in Array):'
forClass:nil
okLabel:'ok'
initialAnswer:'at'.
|
-
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:'
okLabel:'Yes'
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),
and/or to add buttons on the fly via the modifyingBox:do: hook
-
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 (or via the modifyingBox:do: hook).
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
-
marked as obsolete by exept MBP at 23-09-2021
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
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
-
marked as obsolete by exept MBP at 23-09-2021
** This is an obsolete interface - do not use it (it may vanish in future versions) **
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: sepX
-
add a label and some view side-by-side.
The label goes from 0.0 to sepX; the inputField from sepX to 1.0.
sepX may be relative (0.0 .. 1.0) or in absolute pixels.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:(EditField on:model) label:'input here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := SelectionInList new.
model list:#('foo' 'bar' 'baz').
model selectionIndex:2.
dialog := DialogBox new.
field := dialog
addLabelledField:(PopUpList on:model) label:'select here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable from: leftX to: rightX separateAtX: sepX nameAs: aName
-
add a label and some view side-by-side.
The label goes from 0.0 to sepX; the inputField from sepX to 1.0.
sepX may be relative (0.0 .. 1.0) or in absolute pixels.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:(EditField on:model)
label:'input here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz'))
label:'select foo:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := SelectionInList new.
model list:#('foo' 'bar' 'baz').
model selectionIndex:2.
dialog := DialogBox new.
field := dialog
addLabelledField:(PopUpList on:model)
label:'select here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable from: leftX to: rightX separateAtX: sepX nameAs: aName foregroundColor: fgColor
-
add a label and some view side-by-side.
The label goes from 0.0 to sepX; the inputField from sepX to 1.0.
sepX may be relative (0.0 .. 1.0) or in absolute pixels.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:(EditField on:model)
label:'input here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz'))
label:'select foo:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := SelectionInList new.
model list:#('foo' 'bar' 'baz').
model selectionIndex:2.
dialog := DialogBox new.
field := dialog
addLabelledField:(PopUpList on:model)
label:'select here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
-
addLabelledField: aView label: labelString adjust: labelAdjust tabable: tabable separateAtX: sepX
-
add a label and some view side-by-side.
The label goes from 0.0 to sepX; the inputField from sepX to 1.0.
sepX may be relative (0.0 .. 1.0) or in absolute pixels.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledField:(EditField on:model) label:'input here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model field|
model := SelectionInList new.
model list:#('foo' 'bar' 'baz').
model selectionIndex:2.
dialog := DialogBox new.
field := dialog
addLabelledField:(PopUpList on:model) label:'select here:'
adjust:#left
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
-
addMessage: labelString centered: centered
-
similar to addTextLabel; adds a label only.
For ST80 compatibility
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addMessage:'hello' centered:true.
dialog addMessage:'world' centered:false.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'Yeah'].
|
-
addMessage: labelString textLine: valueHolder boundary: fraction
-
similar to addInputField; adds a label PLUS an inputField.
For ST80 compatibility
-
addMessage: labelString textLine: valueHolder type: typeSymbolOrNil boundary: fraction
-
similar to addInputField; adds a label PLUS an inputField.
For ST80 compatibility
-
addTextLabel: aStringOrHolder
-
create a text label - the name has been choosen for ST-80 compatibility;
however, ST/X labels allow image labels too.
Returns the label.
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello'.
b showAtPointer
|
Usage example(s):
|b v|
v := 'hello' asValue.
b := DialogBox new.
b addTextLabel:v.
[
Delay waitForSeconds:1.
v value:'world'
] fork.
b showAtPointer.
|
Usage example(s):
|b|
b := DialogBox new.
b leftIndent:100.
b addTextLabel:'hello'.
b leftIndent:0.
b addTextLabel:'world'.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello'.
b addTextLabel:'world'.
b addOkButton.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello'.
(b addTextLabel:'world') foregroundColor:Color red.
b addOkButton.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello world\\How about this ?' withCRs.
b addOkButton.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello world\\How about this ?' withCRs.
b addTextLabel:'not bad'.
b addAbortButton.
b addOkButton.
b showAtPointer
|
-
addTextLabel: aStringOrHolder 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)
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello' adjust:#left.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b addTextLabel:'hello' adjust:#right.
b showAtPointer
|
-
addTextLabelOn: aValueHolder
-
create a text label showing the contents of a valueHolder.
Returns the label.
Usage example(s):
|holder b|
holder := ValueHolder with:'hello'.
b := DialogBox new.
b addTextLabelOn:holder asValue.
[ Delay waitForSeconds:2. holder value:'world' ] fork.
b showAtPointer
|
Usage example(s):
|b|
b := DialogBox new.
b leftIndent:100.
b addTextLabelOn:'hello' asValue.
b leftIndent:0.
b addTextLabelOn:'world' asValue.
b showAtPointer
|
-
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)
Usage example(s):
|holder b|
holder := ValueHolder with:'hello'.
b := DialogBox new.
b addTextLabelOn:holder asValue adjust:#left.
[ Delay waitForSeconds:2. holder value:'world' ] fork.
b showAtPointer
|
-
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.
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButtonLabelled:'get out of here'.
dialog addOkButtonLabelled:'yes thats ok'.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
addButton: aButton
-
add a button into the buttonPanel.
Returns the button.
Usage example(s):
^ self addButton:aButton after:nil
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']).
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']).
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']).
dialog addAbortButton.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
addButton: aButton after: someOtherButtonOrNilOrIntegerIndex
-
add a button into the buttonPanel.
If the argument someOtherButtonOrNil is nil, the button is
added at the end.
Returns the button
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addOkButton.
dialog addButton:(Button
label:'foo'
action:[dialog hide. Transcript showCR:'foo'])
after:(dialog okButton).
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addOkButton.
dialog addButton:(Button
label:'foo'
action:[dialog hide. Transcript showCR:'foo'])
after:(dialog abortButton).
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addOkButton.
dialog addButton:(Button
label:'foo'
action:[dialog hide. Transcript showCR:'foo'])
after:nil.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
addButton: aButton before: someOtherButtonOrNil
-
add a button into the buttonPanel.
If the argument someOtherButtonOrNil is nil, the button is
added upFront.
Returns the button
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addOkButton.
dialog addButton:(Button
label:'foo'
action:[dialog hide. Transcript showCR:'foo'])
before:(dialog okButton).
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addAbortButton.
dialog addOkButton.
dialog addButton:(Button
label:'foo'
action:[dialog hide. Transcript showCR:'foo'])
before:nil.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
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
Usage example(s):
|box|
box := DialogBox new.
box
addHelpButtonFor:'Launcher/compilerSettings.html';
addAbortButton;
addOkButton.
box open
|
-
addHelpButtonWithAction: helpAction
-
add a help button to the buttonPanel.
The argument, helpAction is avaluated when clicked.
Returns the button
Usage example(s):
|box|
box := DialogBox new.
box
addHelpButtonWithAction:[ Transcript flash ];
addAbortButton;
addOkButton.
box open
|
-
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.
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
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.
Usage example(s):
|dialog b|
b := Button label:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedBy:0.5).
dialog := DialogBox new.
dialog addOkButton:b.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
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.
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addOkButtonLabelled:'get out of here'.
dialog open.
dialog accepted ifTrue:[Transcript showCR:'yes'].
|
-
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.
Usage example(s):
|dialog check|
check := true asValue.
dialog := DialogBox new.
dialog addCheckBox:'on or off' on:check.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:check value].
|
-
addCheckBox: label on: aModel tabable: tabable
-
create a checkBox with label on aModel and add it.
Returns the checkBox widget.
Usage example(s):
|dialog check1 check2 check3|
check1 := true asValue.
check2 := false asValue.
check3 := true asValue.
dialog := DialogBox new.
dialog addCheckBox:'on or off' on:check1 tabable:false.
dialog addHorizontalLine.
dialog addCheckBox:'on or off' on:check2 tabable:true.
dialog addCheckBox:'on or off' on:check3 tabable:true.
dialog addOkButton.
dialog open.
|
-
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.
Usage example(s):
|box val|
val := '' asValue.
box := Dialog new.
(box addTextLabel:'combo box example') adjust:#left.
box addVerticalSpace.
(box addComboListOn:val list:#('one' 'two' 'three' 'four') tabable:true).
box addOkButton.
box open.
box accepted ifTrue:[
Transcript showCR:val value
].
|
-
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
Usage example(s):
|dialog trigger1 trigger2 trigger3|
trigger1 := true asValue.
trigger2 := false asValue.
trigger3 := true asValue.
dialog := DialogBox new.
dialog addTriggerBox:'go' action:[Transcript showCR:'1'].
dialog addHorizontalLine.
dialog addTriggerBox:'go go' action:[Transcript showCR:'2'].
dialog addTriggerBox:'trigger' action:[Transcript showCR:'3'].
dialog addOkButton.
dialog open.
|
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.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
(dialog addTextLabel:'enter a string') adjust:#left.
field := dialog addInputFieldOn:model.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
-
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.
-
addLabelledFilenameField: 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.
-
addLabelledInputField: labelString adjust: labelAdjust on: model tabable: tabable from: leftX to: rightX separateAtX: sepX
-
add a label and an inputField side-by-side.
The label goes from 0.0 to sepX; the inputField from sepX to 1.0.
sepX may be relative (0.0 .. 1.0) or in absolute pixels.
The label's string is defined by labelString and adjusted according to labelAdjust.
The inputField gets model as its model.
Return the inputField.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledInputField:'enter a string'
adjust:#left
on:model
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model1 model2 field|
model1 := '' asValue.
model2 := '' asValue.
dialog := DialogBox new.
dialog addTextLabel:'a two-input box'.
dialog addHorizontalLine.
field := dialog
addLabelledInputField:'string1:'
adjust:#right
on:model1
tabable:true
separateAtX:0.4.
field := dialog
addLabelledInputField:'string2:'
adjust:#right
on:model2
tabable:true
separateAtX:0.4.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:model1 value.
Transcript showCR:model2 value.
].
|
-
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.
Usage example(s):
|dialog model field|
model := '' asValue.
dialog := DialogBox new.
field := dialog
addLabelledInputField:'enter a string'
adjust:#left
on:model
tabable:true
separateAtX:0.3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript showCR:model value].
|
Usage example(s):
|dialog model1 model2 field|
model1 := '' asValue.
model2 := '' asValue.
dialog := DialogBox new.
dialog addTextLabel:'a two-input box'.
dialog addHorizontalLine.
field := dialog
addLabelledInputField:'string1:'
adjust:#right
on:model1
tabable:true
separateAtX:0.4.
field := dialog
addLabelledInputField:'string2:'
adjust:#right
on:model2
tabable:true
separateAtX:0.4.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:model1 value.
Transcript showCR:model2 value.
].
|
construction-layout
-
addGap
-
VW compatibility
-
addGap: pixels
-
VW compatibility
-
addHorizontalLine
-
add a horizontal line as separator
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog
addTextLabel:'some title string';
addHorizontalLine;
addTextLabel:'more text';
addOkButton;
open.
|
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog
addTextLabel:'some title string';
addHorizontalLine;
addTextLabel:'more text'.
(dialog addHorizontalLine) width:20.
dialog addTextLabel:'more text'.
(dialog addHorizontalLine) width:20.
dialog
addTextLabel:'more text';
addHorizontalLine;
addOkButton;
open.
|
-
addVerticalSpace
-
add a default vertical space (1 mm)
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addTextLabel:'some title string'.
dialog addVerticalSpace.
dialog addTextLabel:'more text'.
dialog addOkButton.
dialog open.
|
-
addVerticalSpace: nPixel
-
add some pixels of space to the next component
Usage example(s):
|dialog|
dialog := DialogBox new.
dialog addTextLabel:'some title string'.
dialog addVerticalSpace:50.
dialog addTextLabel:'more text'.
dialog addOkButton.
dialog open.
|
construction-lists
-
addList: listHolder lines: nLines validation: validateionBlock
-
-
addListBoxOn: aModel
-
add a selectionInListView to the box.
The listViews ScrollWrapper is returned
Usage example(s):
|dialog model listView|
model := SelectionInList new.
model list:#('one' 'two' 'three' 'four').
model selectionIndex:2.
dialog := DialogBox new.
(dialog addTextLabel:'select any') adjust:#left.
listView := dialog addListBoxOn:model.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
|
-
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.
Usage example(s):
|dialog listView|
dialog := DialogBox new.
(dialog addTextLabel:'select any') adjust:#left.
listView := dialog
addListBoxOn:nil
class:FileSelectionList
withNumberOfLines:10
hScrollable:false
vScrollable:false.
listView directory:'/etc'.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue].
|
-
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
Usage example(s):
|dialog model listView|
model := SelectionInList new.
model list:#('one' 'two' 'three' 'four').
model selectionIndex:2.
dialog := DialogBox new.
(dialog addTextLabel:'select any') adjust:#left.
listView := dialog addListBoxOn:model withNumberOfLines:3.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
|
-
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.
Usage example(s):
|dialog model listView|
model := SelectionInList new.
model list:#('one' 'two' 'three' 'four').
model selectionIndex:2.
dialog := DialogBox new.
(dialog addTextLabel:'select any') adjust:#left.
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
|
Usage example(s):
|dialog model listView|
model := SelectionInList new.
model list:#('one' 'two' 'three' 'four').
model selectionIndex:2.
dialog := DialogBox new.
(dialog addTextLabel:'select any') adjust:#left.
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection].
|
-
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.
Usage example(s):
|dialog listView|
dialog := DialogBox new.
(dialog addTextLabel:'Enter Text:') adjust:#left.
listView := dialog
addTextBoxOn:nil
class:EditTextView
withNumberOfLines:10
hScrollable:true
vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript show:'text is:'; showCR:listView contents
].
|
-
addTextBoxOn: aModel view: aListView withHeight: heightInPixels hScrollable: hs vScrollable: vs
-
add a ListView instance to the box.
The list has heightInPixels (if nonNil) height shown.
If scrolled, the ScrollWrapper is returned - otherwise the listView.
Usage example(s):
|dialog listView|
dialog := DialogBox new.
(dialog addTextLabel:'enter text') adjust:#left.
listView := dialog
addTextBoxOn:nil
view:EditTextView new
withHeight:50
hScrollable:true
vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript show:'entered text is:'; showCR:listView contents
].
|
Usage example(s):
|model dialog listView|
model := SelectionInList with:#('a' 'b' 'c' 'd' 'e').
dialog := DialogBox new.
(dialog addTextLabel:'enter text') adjust:#left.
listView := dialog
addTextBoxOn:model
view:SelectionInListView new
withHeight:50
hScrollable:true
vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript show:'you selected:'; showCR:listView selection
].
|
-
addTextBoxOn: aModel view: aListView withNumberOfLines: numLines hScrollable: hs vScrollable: vs
-
add a ListView instance to the box.
The list has numLines (if nonNil) number of lines shown.
If scrolled, the ScrollWrapper is returned - otherwise the listView.
Usage example(s):
|dialog listView|
dialog := DialogBox new.
(dialog addTextLabel:'enter text') adjust:#left.
listView := dialog
addTextBoxOn:nil
class:EditTextView
withNumberOfLines:10
hScrollable:true
vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript show:'you entered:'; showCR:listView contents
].
|
Usage example(s):
|model dialog listView|
model := SelectionInList with:#('a' 'b' 'c' 'd' 'e').
dialog := DialogBox new.
(dialog addTextLabel:'enter text') adjust:#left.
listView := dialog
addTextBoxOn:model
class:SelectionInListView
withNumberOfLines:10
hScrollable:true
vScrollable:true.
dialog addAbortButton; addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript show:'you selected:'; showCR:listView selection
].
|
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.
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5')
fromX:0.0
toX:1.0
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5')
fromX:0.25
toX:0.75
collect:[:label | (Label label:label) adjust:#left].
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog y|
dialog := Dialog new.
y := dialog yPosition.
dialog
addColumn:#('a1' 'b1' 'c1' 'd1')
fromX:0
toX:(1/3)
collect:[:label | Label label:label].
dialog yPosition:y.
dialog
addColumn:#('a2' 'b2' 'c2' 'd2')
fromX:(1/3)
toX:(2/3)
collect:[:label | Label label:label].
dialog yPosition:y.
dialog
addColumn:#('a3' 'b3' 'c3' 'd3')
fromX:(2/3)
toX:1
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
-
addColumn: aRow fromX: leftX toX: rightX collect: aBlock tabable: tabable
-
add some elements in a vertical column.
Equally space elements as returned from aBlock.
Usage example(s):
|dialog y values|
values := (1 to:4) collect:[:dummy | '' asValue].
dialog := Dialog new.
y := dialog yPosition.
dialog
addColumn:#('one' 'two' 'three' 'four')
fromX:0
toX:0.3
collect:[:label | Label label:label].
dialog yPosition:y.
dialog
addColumn:values
fromX:0.3
toX:1.0
collect:[:value | EditField on:value]
tabable:true.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:(values collect:[:holder | holder value])
]
|
Usage example(s):
|dialog y values|
values := #(true true false false false true false true) collect:[:val | val asValue].
dialog := Dialog new.
y := dialog yPosition.
dialog
addColumn:(1 to:4)
fromX:0
toX:0.5
collect:[:idx | CheckToggle on:(values at:idx)]
tabable:true
horizontalLayout:#center.
dialog yPosition:y.
dialog
addColumn:(5 to:8)
fromX:0.5
toX:1.0
collect:[:idx | CheckToggle on:(values at:idx)]
tabable:true
horizontalLayout:#center.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:(values collect:[:holder | holder value])
]
|
-
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.
Usage example(s):
|dialog y values|
values := (1 to:4) collect:[:dummy | '' asValue].
dialog := Dialog new.
y := dialog yPosition.
dialog
addColumn:#('one' 'two' 'three' 'four')
fromX:0
toX:0.3
collect:[:label | Label label:label].
dialog yPosition:y.
dialog
addColumn:values
fromX:0.3
toX:1.0
collect:[:value | EditField on:value]
tabable:true.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:(values collect:[:holder | holder value])
]
|
Usage example(s):
|dialog y values|
values := #(true true false false false true false true) collect:[:val | val asValue].
dialog := Dialog new.
y := dialog yPosition.
dialog
addColumn:(1 to:4)
fromX:0
toX:0.5
collect:[:idx | CheckToggle on:(values at:idx)].
dialog yPosition:y.
dialog
addColumn:(5 to:8)
fromX:0.5
toX:1.0
collect:[:idx | CheckToggle on:(values at:idx)]
tabable:true.
dialog addOkButton.
dialog open.
dialog accepted ifTrue:[
Transcript showCR:(values collect:[:holder | holder value])
]
|
-
addRow: aCol fromX: leftX toX: rightX collect: aBlock
-
add some elements in a horizontal row.
Equally space elements as returned from aBlock.
Advance y.
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a' 'b' 'c' 'd')
fromX:0
toX:1
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a1' 'b1' 'c1' 'd1')
fromX:0
toX:1
collect:[:label | Label label:label].
dialog
addRow:#('a2' 'b2' 'c2' 'd2')
fromX:0
toX:0.5
collect:[:label | Label label:label].
dialog
addRow:#('a3' 'b3' 'c3' 'd3')
fromX:0.5
toX:1
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
-
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.
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a' 'b' 'c' 'd')
fromX:0
toX:1
collect:[:label | Label label:label]
tabable:false
horizontalLayout:#fit.
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('one' 'two' 'three' 'four')
fromX:0
toX:1
collect:[:label | Button label:label]
tabable:false
horizontalLayout:#fit.
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a1' 'b1' 'c1' 'd1')
fromX:0
toX:1
collect:[:label | Label label:label].
dialog
addRow:#('a2' 'b2' 'c2' 'd2')
fromX:0
toX:0.5
collect:[:label | Label label:label].
dialog
addRow:#('a3' 'b3' 'c3' 'd3')
fromX:0.5
toX:1
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
-
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.
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a' 'b' 'c' 'd')
fromX:0
toX:1
collect:[:label | Label label:label]
tabable:false
horizontalLayout:#fit.
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('one' 'two' 'three' 'four')
fromX:0
toX:1
collect:[:label | Button label:label]
tabable:false
horizontalLayout:#fit.
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog|
dialog := Dialog new.
dialog
addRow:#('a1' 'b1' 'c1' 'd1')
fromX:0
toX:1
collect:[:label | Label label:label].
dialog
addRow:#('a2' 'b2' 'c2' 'd2')
fromX:0
toX:0.5
collect:[:label | Label label:label].
dialog
addRow:#('a3' 'b3' 'c3' 'd3')
fromX:0.5
toX:1
collect:[:label | Label label:label].
dialog addOkButton.
dialog open.
|
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
Usage example(s):
|dialog|
dialog := DialogBox new.
(dialog addTextLabel:'label1') adjust:#left.
dialog leftIndent:20.
(dialog addTextLabel:'label2') adjust:#left.
dialog leftIndent:40.
(dialog addTextLabel:'label3') adjust:#left.
dialog leftIndent:60.
(dialog addTextLabel:'label4') adjust:#left.
dialog addOkButton.
dialog open.
|
-
rightIndent
-
return the current right indent.
-
rightIndent: aNumber
-
set the right indent
Usage example(s):
|dialog|
dialog := DialogBox new.
(dialog addTextLabel:'label1') adjust:#right.
dialog rightIndent:20.
(dialog addTextLabel:'label2') adjust:#right.
dialog rightIndent:40.
(dialog addTextLabel:'label3') adjust:#right.
dialog rightIndent:60.
(dialog addTextLabel:'label4') adjust:#right.
dialog addOkButton.
dialog open.
|
-
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).
Usage example(s):
|dialog pos|
dialog := DialogBox new.
pos := dialog yPosition.
(dialog addTextLabel:'label1') width:0.5.
dialog yPosition:pos.
(dialog addTextLabel:'label2') width:0.5; left:0.5.
dialog addOkButton.
dialog open.
|
Usage example(s):
|dialog pos|
dialog := DialogBox new.
pos := dialog yPosition.
#('one' 'two' 'three' 'four')
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x |
dialog yPosition:pos.
(dialog addComponent:(Button label:lbl) tabable:true)
width:0.25; left:x.
].
dialog addOkButton.
dialog open.
|
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 were 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 were added, activate the first one
-
resize
-
verticalPanel notNil ifTrue:[
queries
-
accepted
-
after the box has closed:
return true if accepted, false if canceled
-
canceled
-
after the box has closed:
return true if canceled, false if accepted
-
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
-
(comment from inherited method)
answer true, if my view represents a Dialog
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 ...).
-
handlesKeyPress: key inView: view
-
delegated
-
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
-
keyPress: aKey x: x y: y view: someView
-
delegated
-
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, then do it
-
openDialog
-
open the dialog modal; then return true if accepted, false if canceled
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 label's 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
|
|