ComboListView.st
changeset 131 ee1b6e7cdf75
child 181 31e8f8ab2fb8
equal deleted inserted replaced
130:5cad43b11fb5 131:ee1b6e7cdf75
       
     1 ComboView subclass:#ComboListView
       
     2 	instanceVariableNames:''
       
     3 	classVariableNames:''
       
     4 	poolDictionaries:''
       
     5 	category:'Views-Interactors'
       
     6 !
       
     7 
       
     8 !ComboListView class methodsFor:'documentation'!
       
     9 
       
    10 documentation
       
    11 "
       
    12     A ComboListView combines an label with a drop down list of default inputs;
       
    13     choosing any from the pulled list sets the string in the label.
       
    14 
       
    15     This is the same as a PopUpList or SelectionInListView, bit looks different.
       
    16 
       
    17     Not yet finished.
       
    18 "
       
    19 !
       
    20 
       
    21 examples
       
    22 "
       
    23      |top b|
       
    24 
       
    25      top := StandardSystemView new.
       
    26      top extent:(300 @ 200).
       
    27 
       
    28      b := ComboListView in:top.
       
    29      b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
       
    30      b bottomInset:(b preferredExtent y negated).
       
    31 
       
    32      b list:#('hello' 'world' 'this' 'is' 'st/x').
       
    33      top open.
       
    34 
       
    35 
       
    36 
       
    37   model operation:
       
    38 
       
    39      |model top b|
       
    40 
       
    41      model := 'foo' asValue.
       
    42 
       
    43      top := StandardSystemView new.
       
    44      top extent:(300 @ 200).
       
    45 
       
    46      b := ComboListView in:top.
       
    47      b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
       
    48      b bottomInset:(b preferredExtent y negated).
       
    49 
       
    50      b list:#('hello' 'world' 'this' 'is' 'st/x').
       
    51      b model:model.
       
    52 
       
    53      top openModal.
       
    54      Transcript showCr:('comboBox''s value: ' , model value).
       
    55 
       
    56 
       
    57   in a dialog:
       
    58 
       
    59      |model1 model2 dialog b|
       
    60 
       
    61      model1 := 'foo' asValue.
       
    62      model2 := 'bar' asValue.
       
    63 
       
    64      dialog := Dialog new.
       
    65      (dialog addTextLabel:'ComboList example:') adjust:#left.
       
    66      dialog addVerticalSpace.
       
    67 
       
    68      (b := dialog addComboListOn:model1 tabable:true).
       
    69      b list:#('fee' 'foe' 'foo').
       
    70      dialog addVerticalSpace.
       
    71 
       
    72      (b := dialog addComboListOn:model2 tabable:true).
       
    73      b list:#('bar' 'baz' 'baloo').
       
    74      dialog addVerticalSpace.
       
    75 
       
    76      dialog addOkButton.
       
    77 
       
    78      dialog open.
       
    79 
       
    80      Transcript showCr:('1st comboBox''s value: ' , model1 value).
       
    81      Transcript showCr:('2nd comboBox''s value: ' , model2 value).
       
    82 "
       
    83 ! !
       
    84 
       
    85 !ComboListView methodsFor:'accessing-components'!
       
    86 
       
    87 label 
       
    88     "return the inputField component"
       
    89 
       
    90     ^ field
       
    91 
       
    92     "Modified: 28.2.1996 / 15:10:50 / cg"
       
    93     "Created: 28.2.1996 / 15:13:51 / cg"
       
    94 ! !
       
    95 
       
    96 !ComboListView methodsFor:'initialization'!
       
    97 
       
    98 initializeField
       
    99     field := Label in:self.
       
   100     field level:-1.
       
   101     field adjust:#left.
       
   102 
       
   103     "
       
   104      |b|
       
   105 
       
   106      b := ComboListView new.
       
   107      b list:#('hello' 'world' 'this' 'is' 'st/x').
       
   108      b open
       
   109     "
       
   110 
       
   111     "Created: 28.2.1996 / 15:13:46 / cg"
       
   112     "Modified: 28.2.1996 / 15:18:40 / cg"
       
   113 ! !
       
   114 
       
   115 !ComboListView methodsFor:'user interaction'!
       
   116 
       
   117 entryChanged:what
       
   118     field label:what.
       
   119     model notNil ifTrue:[model value:what].
       
   120     pullDownButton turnOff.
       
   121 
       
   122     "Created: 28.2.1996 / 15:13:46 / cg"
       
   123     "Modified: 28.2.1996 / 15:19:00 / cg"
       
   124 ! !
       
   125 
       
   126 !ComboListView class methodsFor:'documentation'!
       
   127 
       
   128 version
       
   129     ^ '$Header: /cvs/stx/stx/libwidg2/ComboListView.st,v 1.1 1996-02-28 14:26:06 cg Exp $'
       
   130 ! !