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.77 date: 2023/11/07 16:26:15
user: cg
file: ListSelectionBox.st directory: libwidg
module: stx stc-classLibrary: libwidg

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.

copyright

COPYRIGHT (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.

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
the panelView is the container for the listView;
can be accessed to add more components

o  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
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
(comment from inherited method)
fetch the entered string, optionally trim spaces and return it

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
    |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


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 22 Dec 2024 01:49:30 GMT