eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ExtendedComboBox':

Home

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

Class: ExtendedComboBox


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ExtendedComboBox

Package:
stx:libwidg2
Category:
Views-Interactors
Version:
rev: 1.99 date: 2024/03/18 12:54:40
user: cg
file: ExtendedComboBox.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


An ExtendedComboBox looks much like a ComboBox, but allows for any view
to be popped up 
(in contrast to a ComboBox, which has a hardWired selectionInListmenu).

The popped view may optionally be decorated with scrollBars.
As a side effect, an ExtendedComboBox with a SelectionInListView or Menu
can now be used as a replacement for ComboBoxes when long-lists are to be shown,
since those can now be scrolled or defined as hierarchical lists.

copyright

COPYRIGHT (c) 1998 by eXept Software AG 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.

Instance protocol:

accessing
o  contents
return the value of the field (the model's value)

o  contents: aValue
set the value of the field (the models value)

o  menuExtent

o  menuExtent: anExtent

o  menuWidget
get the menu widget or nil

o  menuWidget: aWidgetOrFilenameOrSequenceableCollectionOrNil
set the menu widget or nil.
In addition (this is a hack), a fileName, seqCollection or menu
can be given. In those cases, a corresponding widget is created on the fly and set.

accessing-actions
o  openAction
returns the action, called before opening the pulldown menu

o  openAction: aOneArgBlock
set the action, called before opening the pulldown menu;
the argument to the action is the menu widget

accessing-behavior
o  closeOnSelect
if true, then the comboList is closed when the model value/selection changed

o  closeOnSelect: aBoolean
if true, then the comboList is closed when the model value/selection changed

o  enabled
returns true, if enabled

o  enabled: aBoolean
enable/disable me and my components

o  readOnly
returns true if the menuField is readonly

o  readOnly: aBoolean
set the menuField to be readonly or writable

accessing-bg & border
o  backgroundColor
get the background color of the menu field

o  backgroundColor: aColor
set the background color of the menu field

o  foregroundColor
return the foreground color of the menu field

o  foregroundColor: aColor
set the foreground color of the menu field

accessing-channels
o  enableChannel
return a valueHolder for enable/disable

o  enableChannel: aValueHolder
set a valueHolder for enable/disable

o  menuWidgetHolder
returns the menu widget or nil

o  menuWidgetHolder: aHolder
returns the menu widget or nil

o  model: aModel
set the model

accessing-components
o  editor

o  menuButton
return the menuButton component

o  menuField

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  menuHolder: anObject
change the one that provides the menu (via menuMsg).

accessing-default menus
o  directory: aDirectory
creates a FileSelectionTree as menuWidget - menu, setting the root to the directory

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  list: aList
creates a SelectionInListView as menuWidget - menu setting the list

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  setupMenuWidgetForDirectory: aDirectory
creates a FileSelectionTree as menuWidget - setting the root to the directory

o  setupMenuWidgetForList: aList
creates a SelectionInListView as menuWidget - menu setting the list

o  setupMenuWidgetForMenu: aMenu
creates a MenuView as menuWidget

accessing-dimension
o  computePreferredExtent
compute & return the preferredExtent from the components' preferrences

o  menuHeight
get the maximum height of the menu widget or nil

o  menuHeight: aHeight
set the maximum height of the menu widget or nil

o  usePreferredWidthForMenu
returns true if the menu is to be opened with its menu preferred width

o  usePreferredWidthForMenu: aBoolean
open the menu with its preferred width

accessing-look
o  adjust
returns the button-adjust symbol, which is one of
#left -> left adjust
#right -> right adjust

o  adjust: how
set the button-adjust, which must be one of
#left -> left adjust
#right -> right adjust

o  font: aFont
set the font of the menu field

accessing-scrollbars
o  autoHideScrollBars
set/clear the flag which controls if scrollBars should
be made invisible dynamically, when there is nothing to scroll
(and shown if there is)

o  autoHideScrollBars: aBoolean
set/clear the flag which controls if scrollBars should
be made invisible dynamically, when there is nothing to scroll
(and shown if there is)

o  hasHorizontalScrollBar
return the horizontal scrollability.
If disabled, the horizontal scrollBar is made invisible.

o  hasHorizontalScrollBar: aBool
enable/disable horizontal scrollability.
If disabled, the horizontal scrollBar is made invisible.

o  hasVerticalScrollBar
return the vertical scrollability.
If disabled, the vertical scrollBar is made invisible.

o  hasVerticalScrollBar: aBool
enable/disable vertical scrollability.
If disabled, the vertical scrollBar is made invisible.

o  miniScrollerHorizontal
return the flag which controls if the horizontal scrollBar is either a miniScroller,
or a full scrollBar.

o  miniScrollerHorizontal: aBool
control the horizontal scrollBar to be either a miniScroller,
or a full scrollBar.

o  miniScrollerVertical
return the flag which controls if the vertical scrollBar is either a miniScroller,
or a full scrollBar.

o  miniScrollerVertical: aBool
control the vertical scrollBar to be either a miniScroller,
or a full scrollBar.

change & update
o  update: what with: aPara from: aModel
one of my models changed

error handling
o  doesNotUnderstand: aMessage
delegate messages to the widget

event handling
o  keyPress: key x: x y: y
handle a key press event

o  processEvent: anEvent
return true, if I have consumed the event

initialization
o  createEditField

o  destroy
(comment from inherited method)
unmap & destroy - make me invisible, destroy subviews then
make me unknown to the device

o  initStyle
(comment from inherited method)
this method sets up all style dependent things.
If redefined, make sure that super initStyle is sent

o  initialize
setup defaults

o  initializeButton

o  realize
(comment from inherited method)
realize - make visible;
realizing is done very late (after layout is fixed) to avoid
visible rearranging of windows on the screen

o  release
release dependencies

queries
o  menuIsScrollable
returns true if the menu is scrollable

testing
o  isComboView
yes, I am a comboBox-like widget

user interaction
o  closeMenu
close the menu

o  openMenu
pull the menu - triggered from the button


Private classes:

    MenuWrapper

Examples:


example: SelectionInListView
|top menu widget list sidx|

top  := StandardSystemView extent:200@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
list := #('foo' 'bar' 'baz' 'hjh' 'kk' 'claus' 'gjhj').
sidx := 4.
menu bottomInset:(menu preferredExtent y negated).
menu contents:(list at:sidx).

widget := SelectionInListView new.
widget list:list.
widget doubleClickAction:[:i| menu contents:(widget at:i) ].
widget selection:sidx.
menu menuWidget:widget.
top open.
example: FileSelectionTree
|top menu widget|

top  := StandardSystemView extent:200@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).

widget := FileSelectionTree new.
widget directory:(Filename homeDirectory).

widget doubleClickAction:[:i||n|
    n := widget selectedNode.
    n isDirectory ifFalse:[menu contents:(n pathName)]
].
menu menuHeight:400.
menu menuWidget:widget.
top  open.
example: SelectionInTreeView
|top menu widget|

top  := StandardSystemView extent:200@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).
menu contents:'foo'.

widget := SelectionInTreeView new.
widget root:(TreeItem newAsTreeFromSmalltalkClass:Object).

widget doubleClickAction:[:i||n|
    n := widget selectedNode.
    n hasChildren ifFalse:[menu contents:(n name)]
].
menu menuHeight:300.
menu menuWidget:widget.
top  open.
example: a menu from elsewhere
|top menu widget models|

models := Expecco::Browser openBrowsers 
                collectAll:[:b | b project 
                                    ifNil:[#()]
                                    ifNotNil:[:p | p allBlockDescriptions]].

top  := StandardSystemView extent:250@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).
menu contents:'lets do the timeWarp again...'.

widget := Workflow::AbstractEditor
    dataTypeMenuFor:models receiver:nil selector:[:type | menu contents:type] 
    editorSelector:nil 
    withTemplateTypes:false 
    withUserTypeDefinition:false
    forFreeze:false.
menu menuWidget:widget.
top open.
example: Funny
|top menu widget|

Smalltalk loadPackage:'stx:libwidg3'.
top  := StandardSystemView extent:250@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).
menu contents:'lets do the timeWarp again...'.

widget := ClockView new.
menu menuHeight:[menu width].
menu menuWidget:widget.
top open.
example: Funny - again (use widgets pref-width; even if the combo-box is smaller)
|top menu widget|

top  := StandardSystemView extent:80@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).
menu contents:'time...'.

widget := ClockView new.
menu menuWidget:widget.
menu usePreferredWidthForMenu:true.
top open.
example: Funny - again (use widgets pref-width; even if the combo-box is smaller, adjust the height for the width)
|top menu widget|

top  := StandardSystemView extent:80@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
menu bottomInset:(menu preferredExtent y negated).
menu contents:'time...'.

widget := ClockView new.
menu menuWidget:widget.
menu usePreferredWidthForMenu:true.
menu menuHeight:[widget width].
top open.
example: Subcanvas with a spec
|top menu widget list sidx spec|

spec :=  #(#FullSpec
      #window: 
       #(#WindowSpec
          #name: 'Define Color'
          #layout: #(#LayoutFrame 13 0 29 0 352 0 159 0)
          #label: 'Define Color'
          #min: #(#Point 340 110)
          #max: #(#Point 1152 900)
          #bounds: #(#Rectangle 13 29 353 160)
          #usePreferredExtent: false
      )
      #component: 
       #(#SpecCollection
          #collection: 
           #(
             #(#VerticalPanelViewSpec
                #name: 'VerticalPanel1'
                #layout: #(#LayoutFrame 0 0.0 0 0.0 58 0 -40 1.0)
                #component: 
                 #(#SpecCollection
                    #collection: 
                     #(
                       #(#LabelSpec
                          #name: 'RedLabel'
                          #label: 'Red:'
                          #translateLabel: true
                          #adjust: #right
                          #extent: #(#Point 58 26)
                      )
                       #(#LabelSpec
                          #name: 'GreenLabel'
                          #label: 'Green:'
                          #translateLabel: true
                          #adjust: #right
                          #extent: #(#Point 58 27)
                      )
                       #(#LabelSpec
                          #name: 'BlueLabel'
                          #label: 'Blue:'
                          #translateLabel: true
                          #adjust: #right
                          #extent: #(#Point 58 26)
                      )
                    )
                )
                #horizontalLayout: #fit
                #verticalLayout: #fitSpace
                #horizontalSpace: 3
                #verticalSpace: 3
            )
             #(#VerticalPanelViewSpec
                #name: 'VerticalPanel2'
                #layout: #(#LayoutFrame 60 0 0 0.0 -160 1.0 -40 1.0)
                #component: 
                 #(#SpecCollection
                    #collection: 
                     #(
                       #(#SliderSpec
                          #name: 'RedSlider'
                          #tabable: true
                          #model: #red
                          #orientation: #horizontal
                          #stop: 255
                          #step: 1
                          #backgroundColor: #(#Color 100.0 0.0 0.0)
                          #extent: #(#Point 118 16)
                      )
                       #(#SliderSpec
                          #name: 'GreenSlider'
                          #tabable: true
                          #model: #green
                          #orientation: #horizontal
                          #stop: 255
                          #step: 1
                          #backgroundColor: #(#Color 0.0 100.0 0.0)
                          #extent: #(#Point 118 16)
                      )
                       #(#SliderSpec
                          #name: 'BlueSlider'
                          #tabable: true
                          #model: #blue
                          #orientation: #horizontal
                          #stop: 255
                          #step: 1
                          #backgroundColor: #(#Color 0.0 0.0 100.0)
                          #extent: #(#Point 118 16)
                      )
                    )
                )
                #horizontalLayout: #fit
                #verticalLayout: #spreadSpace
                #horizontalSpace: 3
                #verticalSpace: 3
            )
             #(#VerticalPanelViewSpec
                #name: 'VerticalPanel3'
                #layout: #(#LayoutFrame -158 1 0 0.0 -120 1 -40 1.0)
                #component: 
                 #(#SpecCollection
                    #collection: 
                     #(
                       #(#InputFieldSpec
                          #name: 'RedField'
                          #model: #red
                          #type: #numberInRange
                          #numChars: 3
                          #minValue: 0
                          #maxValue: 255
                          #extent: #(#Point 38 20)
                      )
                       #(#InputFieldSpec
                          #name: 'GreenField'
                          #model: #green
                          #type: #numberInRange
                          #numChars: 3
                          #minValue: 0
                          #maxValue: 255
                          #extent: #(#Point 38 20)
                      )
                       #(#InputFieldSpec
                          #name: 'BlueField'
                          #model: #blue
                          #type: #numberInRange
                          #numChars: 3
                          #minValue: 0
                          #maxValue: 255
                          #extent: #(#Point 38 20)
                      )
                    )
                )
                #horizontalLayout: #fit
                #verticalLayout: #spreadSpace
                #horizontalSpace: 3
                #verticalSpace: 3
            )
             #(#LabelSpec
                #name: 'PreviewBox'
                #layout: #(#LayoutFrame -116 1 0 0.0 -2 1.0 -40 1.0)
                #label: 'Preview'
                #translateLabel: true
                #level: -1
            )
             #(#HorizontalPanelViewSpec
                #name: 'HorizontalPanel1'
                #layout: #(#LayoutFrame 0 0.0 -32 1 0 1.0 0 1.0)
                #component: 
                 #(#SpecCollection
                    #collection: 
                     #(
                       #(#ActionButtonSpec
                          #name: 'CancelButton'
                          #label: 'Cancel'
                          #translateLabel: true
                          #model: #doCancel
                          #extent: #(#Point 165 26)
                      )
                       #(#ActionButtonSpec
                          #name: 'OKButton'
                          #label: 'OK'
                          #translateLabel: true
                          #model: #doAccept
                          #extent: #(#Point 166 26)
                      )
                    )
                )
                #horizontalLayout: #fitSpace
                #verticalLayout: #centerMax
                #horizontalSpace: 3
                #verticalSpace: 3
            )
          )
      )
  ).

top  := StandardSystemView extent:200@35.
menu := ExtendedComboBox origin:5 @ 5 corner:1.0 @ 0.0 in:top.
list := #('foo' 'bar' 'baz' 'hjh' 'kk' 'claus' 'gjhj').
sidx := 4.
menu bottomInset:(menu preferredExtent y negated).
menu contents:(list at:sidx).

widget := SubCanvas new.
widget client:(SimpleDialog new).
widget spec:spec.
menu menuWidget:widget.
top open.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 23 Nov 2024 13:36:48 GMT