eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ListSelectionBox':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ListSelectionBox


Inheritance:

   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

Description:


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.


Class protocol:

defaults
o  defaultExtent
return the default extent of my instances.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.

o  listViewType
return the type of listView
- for easier redefinition in subclasses

instance creation
o  title: titleString okText: okText abortText: abortText list: aList action: aBlock
create and return a new listSelectionBox with list already defined


Instance protocol:

accessing
o  contents
return my contents

o  initialSelection: selected
select some item in the list

o  initialText: someString selected: selected
in addition to showing the initial text; optionally also select it in the list

o  list: aList
set the list to be displayed in selection list

o  selectionChangeCallback: aBlock
allows special actions to be hooked in, when the selection changes

o  selectionIndex

o  selectionList

accessing-behavior
o  clearEntryFieldOnDeselect
normally, the entryfield's contents is not cleared,
when the list is deselected.
This can be changed here.

o  clearEntryFieldOnDeselect: aBoolean
normally, the entryfield's contents is not cleared,
when the list is deselected.
This can be changed here.

o  useIndex: aBoolean

accessing-components
o  listView
return the listView component

o  panelView

accessing-look
o  noEnterField
suppress the enterField - now only existing items are selectable;
the default is to present an enterField.

o  useComboBoxWithList: list
change the enterField to be a ComboList

initialization
o  beLiveSearchBox
Jan, please comment what it does and who needs it

o  initialize
label := resources string:'Select or Enter'.

o  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

o  setupEditfieldToMoveToListOnCursorDown

o  updateList
setup contents of list;
nothing done here but typically redefined in subclasses.

private
o  filterList

queries
o  computePreferredExtent
return my preferred extent
- that's the minimum size I like to have, to make everything visible

user actions
o  actionArgument

o  doubleClick
doubleClick on an entry is select & ok

o  selectionChanged
selections in list get forwarded to enterfield


Examples:


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


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 18:54:23 GMT