eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ComboBoxView':

Home

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

Class: ComboBoxView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ComboView
                  |
                  +--ComboBoxView
                     |
                     +--ComboBoxViewWithCompletion
                     |
                     +--FilenameComboBoxView
                     |
                     +--FilenameEditFieldV2

Package:
stx:libwidg2
Category:
Views-Interactors
Version:
rev: 1.41 date: 2023/06/15 07:04:56
user: cg
file: ComboBoxView.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


A ComboBoxView combines an inputField with a drop down list of default inputs;
choosing any from the pulled list presets the string in the field.

In contrast to a PopUpList or ComboListView, the string can still be edited -
the list is actually only a set of values for the convenience of the user.

copyright

COPYRIGHT (c) 1996 by eXept Software AG / 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  defaultFont
^ SelectionInListView defaultFont.


Instance protocol:

accessing-components
o  editor
return the inputField component

o  entryCompletionBlock: aZeroOneOrTwoArgBlock
define an action to be evaluated when Tab (EntryCompletionCharacter) is pressed.
The block gets the current contents and the field itself as optional arguments
(i.e. it can be a 0, 1 or 2-arg block).

o  menuSelectAction: aBlock

accessing-contents
o  emptyFieldReplacementText

o  emptyFieldReplacementText: aString

accessing-mvc
o  model
(comment from inherited method)
return the model, for non-MVC views,
this is nil or the receiver

o  model: aModel
(comment from inherited method)
set the model, which is supposed to provide the boxes value.
If a listMessage was defined, it is also responsible for providing
the list

change & update
o  update: something with: aParameter from: changedObject

event handling
o  hasKeyboardFocus: aBoolean
(comment from inherited method)
notification from the windowGroup that I got the keyboardFocus.

o  showFocus: explicit
(comment from inherited method)
highlight myself somehow to tell user that I have the focus.
If explicit is true, the focus came via focusStepping (i.e. tabbing);
if false, it came via the window manager (i.e. pointer entering).
Only change my border, if this is an explicit focusChange.

o  showNoFocus: explicit
(comment from inherited method)
undo the effect of showFocus.
Explicit tells if the focus came via focusStepping (i.e. tabbing)
or via the window manager (i.e. pointer entering).
Only change my border, if this is an explicit focusChange.

initialization
o  editFieldClass

o  initializeField
all of my input goes to the enterfield

private
o  setFieldsFont: aFont
ignored - the inputFields font remains unchanged

queries
o  specClass
returns my spec class (for UI editor)

user interaction
o  fieldLeft
the edit field was left (via cursor keys or focus change)

o  select: index
a menu item (index) was selected


Examples:


non MVC operation:
   |top b|

   top := StandardSystemView new.
   top extent:(300 @ 200).

   b := ComboBoxView in:top.
   b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
   b bottomInset:(b preferredExtent y negated).

   b list:#('hello' 'world' 'this' 'is' 'st/x').
   top open.
with action:
   |top b|

   top := StandardSystemView new.
   top extent:(300 @ 200).

   b := ComboBoxView in:top.
   b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
   b bottomInset:(b preferredExtent y negated).

   b list:#('hello' 'world' 'this' 'is' 'st/x').
   b action:[:entry | Transcript showCR:entry].
   top open.
model operation:
   |model top b|

   model := 'foo' asValue.

   top := StandardSystemView new.
   top extent:(300 @ 200).

   b := ComboBoxView in:top.
   b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
   b bottomInset:(b preferredExtent y negated).

   b list:#('hello' 'world' 'this' 'is' 'st/x').
   b model:model.

   top openModal.
   Transcript showCR:('comboBox''s value: ' , model value).
in a dialog:
   |model1 model2 dialog b|

   model1 := 'foo' asValue.
   model2 := 'bar' asValue.

   dialog := Dialog new.
   (dialog addTextLabel:'ComboBox example:') adjust:#left.
   dialog addVerticalSpace.

   (b := dialog addComboBoxOn:model1 tabable:true).
   b list:#('fee' 'foe' 'foo').
   dialog addVerticalSpace.

   (b := dialog addComboBoxOn:model2 tabable:true).
   b list:#('bar' 'baz' 'baloo').
   dialog addVerticalSpace.

   dialog addOkButton.

   dialog open.

   Transcript showCR:('1st comboBox''s value: ' , model1 value).
   Transcript showCR:('2nd comboBox''s value: ' , model2 value).


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:37:47 GMT