|
Class: ListSelectionBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--EnterBox
|
+--ListSelectionBox
|
+--FileSelectionBox
- Package:
- stx:libwidg
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.77
date: 2023/11/07 16:26:15
- user: cg
- file: ListSelectionBox.st directory: libwidg
- module: stx stc-classLibrary: libwidg
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.
copyrightCOPYRIGHT (c) 1990 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.
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
-
the panelView is the container for the listView;
can be accessed to add more components
-
verticalPanel
-
for protocol compatibility with Info/Dialog boxes.
the panelView is the container for the listView;
can be accessed to add more components
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
-
(comment from inherited method)
fetch the entered string, optionally trim spaces and return it
-
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
|
|box|
box := ListSelectionBox new.
box title:'some\multiline\title' withCRs.
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 label:'bla bla'.
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
|
|