|
Class: ListSelectionBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--EnterBox
|
+--ListSelectionBox
|
+--FileSelectionBox
- Package:
- stx:libwidg
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.71
date: 2019/07/16 14:40:47
- user: cg
- file: ListSelectionBox.st directory: libwidg
- module: stx stc-classLibrary: libwidg
- Author:
- Claus Gittinger
this class implements boxes for selection from a list. It offers
both an ok- and abort-buttons. The ok-button, if pressed will
evaluate the okAction (see EnterBox>>action).
see examples for typical uses.
Notice, for file selections there is a specialized FileSelectionBox,
which supports matchPatterns, changing directory etc.
defaults
-
defaultExtent
-
return the default extent of my instances.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.
-
listViewType
-
return the type of listView
- for easier redefinition in subclasses
instance creation
-
title: titleString okText: okText abortText: abortText list: aList action: aBlock
-
create and return a new listSelectionBox with list already defined
accessing
-
contents
-
return my contents
-
initialSelection: selected
-
select some item in the list
-
initialText: someString selected: selected
-
in addition to showing the initial text; optionally also select it in the list
-
list: aList
-
set the list to be displayed in selection list
-
selectionChangeCallback: aBlock
-
allows special actions to be hooked in, when the selection changes
-
selectionIndex
-
-
selectionList
-
accessing-behavior
-
clearEntryFieldOnDeselect
-
normally, the entryfield's contents is not cleared,
when the list is deselected.
This can be changed here.
-
clearEntryFieldOnDeselect: aBoolean
-
normally, the entryfield's contents is not cleared,
when the list is deselected.
This can be changed here.
-
useIndex: aBoolean
-
accessing-components
-
listView
-
return the listView component
-
panelView
-
accessing-look
-
noEnterField
-
suppress the enterField - now only existing items are selectable;
the default is to present an enterField.
-
useComboBoxWithList: list
-
change the enterField to be a ComboList
initialization
-
beLiveSearchBox
-
Jan, please comment what it does and who needs it
-
initialize
-
label := resources string:'Select or Enter'.
-
postRealize
-
update the list now.
This was not done in #initialize to allow settings to be changed before,
in case list-updating is a slow operation - such as reading a directory
-
setupEditfieldToMoveToListOnCursorDown
-
-
updateList
-
setup contents of list;
nothing done here but typically redefined in subclasses.
private
-
filterList
-
queries
-
computePreferredExtent
-
return my preferred extent
- that's the minimum size I like to have, to make everything visible
user actions
-
actionArgument
-
-
doubleClick
-
doubleClick on an entry is select & ok
-
selectionChanged
-
selections in list get forwarded to enterfield
simple:
|box|
box := ListSelectionBox new.
box title:'select something:'.
box list:#('foo' 'bar' 'baz').
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel].
box showAtPointer
|
with index (instead of list-entry) and without an enterField:
|box|
box := ListSelectionBox new.
box title:'select something:'.
box list:#('foo' 'bar' 'baz').
box useIndex:true.
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel].
box showAtPointer
|
with a default:
|box|
box := ListSelectionBox new.
box title:'select something:'.
box list:#('foo' 'bar' 'baz').
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel].
box initialText:'foo'.
box showAtPointer
|
opening the box modeless (a stand-by box):
(in this case, the default ok- and abortActions do not hide the box;
therefore, we have to set those explicitely)
|box|
box := ListSelectionBox new.
box title:'select something:'.
box list:#('foo' 'bar' 'baz').
box abortText:'close'.
box okText:'apply'.
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel].
box abortAction:[:dummy | box hide].
box openModeless
|
showing fileNames:
|box|
box := ListSelectionBox new.
box title:'select something:'.
box list:('.' asFilename directoryContents).
box okAction:[:sel | Transcript show:'the selection was:' ; showCR:sel].
box showAtPointer
|
|