ComboBoxV.st
author Claus Gittinger <cg@exept.de>
Wed, 28 Feb 1996 15:25:23 +0100
changeset 130 5cad43b11fb5
parent 127 9d5cc59863e8
child 135 1c113f77460e
permissions -rw-r--r--
inserted abstract ComboView class

ComboView subclass:#ComboBoxView
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Views-Interactors'
!

!ComboBoxView class methodsFor:'documentation'!

documentation
"
    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.

    Not yet finished.
"
!

examples
"
     |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.



  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).
"
! !

!ComboBoxView methodsFor:'accessing-components'!

editor
    "return the inputField component"

    ^ field

    "Created: 9.2.1996 / 20:18:03 / cg"
    "Modified: 28.2.1996 / 15:10:50 / cg"
! !

!ComboBoxView methodsFor:'accessing-mvc'!

action:aBlock 
    field action:aBlock

    "Created: 9.2.1996 / 01:44:20 / cg"
    "Modified: 28.2.1996 / 15:10:55 / cg"
!

model
    ^ field model

    "Created: 9.2.1996 / 00:50:18 / cg"
    "Modified: 28.2.1996 / 15:10:59 / cg"
!

model:aModel
    field model:aModel.

    "Created: 9.2.1996 / 00:50:12 / cg"
    "Modified: 28.2.1996 / 15:11:03 / cg"
! !

!ComboBoxView methodsFor:'initialization'!

initializeField
    field := EditField in:self.
    field model:('' asValue).

    "
     all of my input goes to the enterfield
    "
    self delegate:(KeyboardForwarder toView:field).

    "
     |b|

     b := ComboBoxView new.
     b list:#('hello' 'world' 'this' 'is' 'st/x').
     b open
    "

    "Modified: 9.2.1996 / 20:06:08 / cg"
    "Created: 28.2.1996 / 15:07:51 / cg"
! !

!ComboBoxView methodsFor:'user interaction'!

entryChanged:what
    field contents:what.
    field accept.
    pullDownButton turnOff.

    "Created: 9.2.1996 / 01:06:01 / cg"
    "Modified: 28.2.1996 / 15:08:14 / cg"
! !

!ComboBoxView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboBoxV.st,v 1.5 1996-02-28 14:25:23 cg Exp $'
! !