ComboBoxView.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5815 1c36d4e19708
child 5922 25b4077842e2
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5815
1c36d4e19708 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
     1
"{ Encoding: utf8 }"
1c36d4e19708 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
     2
332
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     3
"
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     4
 COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
     5
              All Rights Reserved
332
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     6
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     7
 This software is furnished under a license and may be used
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     8
 only in accordance with the terms of that license and with the
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    10
 be provided or otherwise made available to, or used by, any
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    11
 other person.  No title to or ownership of the software is
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    12
 hereby transferred.
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    13
"
2108
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
    15
5815
1c36d4e19708 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
    16
"{ NameSpace: Smalltalk }"
1c36d4e19708 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
    17
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    18
ComboView subclass:#ComboBoxView
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
    19
	instanceVariableNames:'menuSelectAction'
2585
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
    20
	classVariableNames:''
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
    21
	poolDictionaries:''
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
    22
	category:'Views-Interactors'
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
275
da88b7732dff commentary
Claus Gittinger <cg@exept.de>
parents: 230
diff changeset
    25
!ComboBoxView class methodsFor:'documentation'!
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
332
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    27
copyright
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    28
"
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    29
 COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    30
              All Rights Reserved
332
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    31
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    32
 This software is furnished under a license and may be used
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    33
 only in accordance with the terms of that license and with the
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    35
 be provided or otherwise made available to, or used by, any
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    36
 other person.  No title to or ownership of the software is
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    37
 hereby transferred.
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    38
"
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    39
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    40
!
78dcd3cacbfd documentation
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
    41
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    44
    A ComboBoxView combines an inputField with a drop down list of default inputs;
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
    45
    choosing any from the pulled list presets the string in the field.
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    46
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
    47
    In contrast to a PopUpList or ComboListView, the string can still be edited -
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
    48
    the list is actually only a set of values for the convenience of the user.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
    49
275
da88b7732dff commentary
Claus Gittinger <cg@exept.de>
parents: 230
diff changeset
    50
    [author:]
1281
94b22cb9c19f documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    51
        Claus Gittinger
181
31e8f8ab2fb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    52
31e8f8ab2fb8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    53
    [see also:]
1281
94b22cb9c19f documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    54
        ComboView
94b22cb9c19f documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    55
        PopUpList SelectionInListView
94b22cb9c19f documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    56
        ComboListView ExtendedComboBox
94b22cb9c19f documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    57
        PullDownMenu Label EntryField
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
"
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
examples
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
"
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    63
  non MVC operation:
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    64
                                                                        [exBegin]
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
     |top b|
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
     top := StandardSystemView new.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
     top extent:(300 @ 200).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
     b := ComboBoxView in:top.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
     b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
     b bottomInset:(b preferredExtent y negated).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
     b list:#('hello' 'world' 'this' 'is' 'st/x').
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
     top open.
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    76
                                                                        [exEnd]
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    80
  with action:
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    81
                                                                        [exBegin]
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    82
     |top b|
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    83
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    84
     top := StandardSystemView new.
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    85
     top extent:(300 @ 200).
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    86
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    87
     b := ComboBoxView in:top.
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    88
     b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    89
     b bottomInset:(b preferredExtent y negated).
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    90
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    91
     b list:#('hello' 'world' 'this' 'is' 'st/x').
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    92
     b action:[:entry | Transcript showCR:entry].
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    93
     top open.
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    94
                                                                        [exEnd]
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    95
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    96
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
    97
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
  model operation:
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
    99
                                                                        [exBegin]
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
     |model top b|
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
     model := 'foo' asValue.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
     top := StandardSystemView new.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
     top extent:(300 @ 200).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
     b := ComboBoxView in:top.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
     b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
     b bottomInset:(b preferredExtent y negated).
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
     b list:#('hello' 'world' 'this' 'is' 'st/x').
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
     b model:model.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
     top openModal.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
   115
     Transcript showCR:('comboBox''s value: ' , model value).
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   116
                                                                        [exEnd]
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   117
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   118
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   119
  in a dialog:
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   120
                                                                        [exBegin]
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   121
     |model1 model2 dialog b|
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   122
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   123
     model1 := 'foo' asValue.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   124
     model2 := 'bar' asValue.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   125
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   126
     dialog := Dialog new.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   127
     (dialog addTextLabel:'ComboBox example:') adjust:#left.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   128
     dialog addVerticalSpace.
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   130
     (b := dialog addComboBoxOn:model1 tabable:true).
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   131
     b list:#('fee' 'foe' 'foo').
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   132
     dialog addVerticalSpace.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   133
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   134
     (b := dialog addComboBoxOn:model2 tabable:true).
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   135
     b list:#('bar' 'baz' 'baloo').
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   136
     dialog addVerticalSpace.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   137
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   138
     dialog addOkButton.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   139
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   140
     dialog open.
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   141
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
   142
     Transcript showCR:('1st comboBox''s value: ' , model1 value).
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
   143
     Transcript showCR:('2nd comboBox''s value: ' , model2 value).
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   144
                                                                        [exEnd]
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
"
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
! !
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
4637
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   148
!ComboBoxView class methodsFor:'defaults'!
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   149
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   150
defaultFont
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   151
    ^ EditField defaultFont.
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   152
    "/ ^ SelectionInListView defaultFont.
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   153
! !
2d3667c6acc0 class: ComboBoxView
Claus Gittinger <cg@exept.de>
parents: 4493
diff changeset
   154
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   155
!ComboBoxView methodsFor:'accessing-components'!
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   156
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   157
editor
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   158
    "return the inputField component"
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   159
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   160
    ^ field
126
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   161
888d8ccd35af better sizing; forward unknown messages to my inputField
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   162
    "Created: 9.2.1996 / 20:18:03 / cg"
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   163
    "Modified: 28.2.1996 / 15:10:50 / cg"
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   164
!
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   165
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   166
menuSelectAction:aBlock
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   167
    menuSelectAction := aBlock
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   168
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   169
    "Created: / 15-10-2006 / 15:10:25 / cg"
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
! !
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
!ComboBoxView methodsFor:'accessing-mvc'!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
model
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   175
    ^ field model
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    "Created: 9.2.1996 / 00:50:18 / cg"
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   178
    "Modified: 28.2.1996 / 15:10:59 / cg"
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
model:aModel
679
bd0e422aab67 fixed model setting & useIndex: handling (aspect)
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   182
    super model:aModel.
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   183
    field model:aModel.
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "Created: 9.2.1996 / 00:50:12 / cg"
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   186
    "Modified: 28.2.1996 / 15:11:03 / cg"
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
! !
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
2585
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   189
!ComboBoxView methodsFor:'change & update'!
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   190
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   191
update:something with:aParameter from:changedObject
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   192
    changedObject == field model ifTrue:[
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   193
        action notNil ifTrue:[
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   194
           action value:(changedObject value)
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   195
        ].
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   196
        ^ self.
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   197
    ].
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   198
    super update:something with:aParameter from:changedObject
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   199
! !
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   200
1312
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   201
!ComboBoxView methodsFor:'event handling'!
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   202
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   203
hasKeyboardFocus:aBoolean
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   204
    super hasKeyboardFocus:aBoolean.
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   205
    field hasKeyboardFocus:aBoolean
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   206
!
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   207
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   208
showFocus:explicit
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   209
    super showFocus:explicit.
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   210
    field showCursor.
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   211
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   212
!
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   213
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   214
showNoFocus:explicit
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   215
    super showNoFocus:explicit.
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   216
    field hideCursor.
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   217
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   218
! !
4c706bd30a5c tabbing (cursor display)
Claus Gittinger <cg@exept.de>
parents: 1281
diff changeset
   219
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
!ComboBoxView methodsFor:'initialization'!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
2108
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   222
editFieldClass
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   223
    ^ EditField
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   224
!
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   225
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   226
initializeField
2585
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   227
    |m|
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   228
2108
cbba33be6ac0 allow for fields class to be redefined by a subclass
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   229
    field := self editFieldClass in:self.
519
9ab4fc771a7f better look with 2D styles
Claus Gittinger <cg@exept.de>
parents: 332
diff changeset
   230
    field borderWidth:0.
2585
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   231
    field model:(m := ValueHolder newString).
eb641403010a action was not evaluated when the models
Claus Gittinger <cg@exept.de>
parents: 2114
diff changeset
   232
    m addDependent:self.
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
   233
    field acceptOnLostFocus:true.
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
   234
    field acceptOnLeave:true.
3196
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   235
    field 
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   236
        leaveAction:[:key | 
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   237
            self fieldLeft.
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   238
            field handleFocusKey:key.
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   239
        ].
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    "
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
     all of my input goes to the enterfield
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   244
    self delegate:(KeyboardForwarder toView:field).
3311
0899e8423c9a Allow ComboList/Box selection with the mouse wheel
Stefan Vogel <sv@exept.de>
parents: 3196
diff changeset
   245
    field delegate:self.    "delegate mouseWheel events to myself"
4493
c149fd42e738 class: ComboBoxView
Stefan Vogel <sv@exept.de>
parents: 3535
diff changeset
   246
    field font:self font.
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   248
    menuSelectAction := [:menuValue | field contents:menuValue].
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   249
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    "
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
     |b|
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
     b := ComboBoxView new.
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
     b list:#('hello' 'world' 'this' 'is' 'st/x').
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
     b open
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    "
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   258
    "Created: / 28-02-1996 / 15:07:51 / cg"
3196
195bfa3ddf8e tab handling
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
   259
    "Modified: / 06-03-2007 / 20:19:32 / cg"
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
! !
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
1183
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   262
!ComboBoxView methodsFor:'private'!
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   263
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   264
setFieldsFont:aFont
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   265
    "ignored - the inputFields font remains unchanged"
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   266
! !
667132091c2f ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   267
291
65229309ad5e specClass
ca
parents: 279
diff changeset
   268
!ComboBoxView methodsFor:'queries'!
65229309ad5e specClass
ca
parents: 279
diff changeset
   269
65229309ad5e specClass
ca
parents: 279
diff changeset
   270
specClass
597
ebb7dc78e670 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   271
    "XXX no longer needed (inherited default works here)"
ebb7dc78e670 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   272
291
65229309ad5e specClass
ca
parents: 279
diff changeset
   273
    self class == ComboBoxView ifTrue:[
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   274
        ^ ComboBoxSpec
291
65229309ad5e specClass
ca
parents: 279
diff changeset
   275
    ].
301
edddd206a2e5 specClass query
ca
parents: 291
diff changeset
   276
    ^ super specClass
edddd206a2e5 specClass query
ca
parents: 291
diff changeset
   277
597
ebb7dc78e670 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
   278
    "Modified: / 31.10.1997 / 19:49:39 / cg"
291
65229309ad5e specClass
ca
parents: 279
diff changeset
   279
! !
65229309ad5e specClass
ca
parents: 279
diff changeset
   280
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
!ComboBoxView methodsFor:'user interaction'!
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
311
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   283
fieldLeft
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   284
    "the edit field was left (via cursor keys or focus change)"
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   285
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   286
    field acceptOnLeave ifTrue:[
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   287
        field accept.
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   288
        action notNil ifTrue:[
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   289
            action value:(field contents)
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   290
        ].
311
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   291
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   292
    ].
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   293
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   294
    "Created: / 26-02-1997 / 19:42:30 / cg"
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   295
    "Modified: / 15-10-2006 / 15:20:14 / cg"
311
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   296
!
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   297
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
   298
select:index
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   299
    "a menu item (index) was selected"
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   300
230
0c32e90e689b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   301
    |what|
0c32e90e689b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   302
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   303
    pullDownButton turnOff.
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   304
230
0c32e90e689b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   305
    what := list at:index.
3311
0899e8423c9a Allow ComboList/Box selection with the mouse wheel
Stefan Vogel <sv@exept.de>
parents: 3196
diff changeset
   306
    currentIndex := index.
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   307
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   308
    menuSelectAction value:what.
130
5cad43b11fb5 inserted abstract ComboView class
Claus Gittinger <cg@exept.de>
parents: 127
diff changeset
   309
    field accept.
3534
9b243b355789 Update through pulldown now Works with EditField V1.196
Stefan Vogel <sv@exept.de>
parents: 3491
diff changeset
   310
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
   311
    action notNil ifTrue:[
2114
40cfff7c7efc acceptIfUnchanged fixed (implemented)
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   312
        action value:what
305
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
   313
    ].
7dd100869f7b cleaned up model interface
Claus Gittinger <cg@exept.de>
parents: 301
diff changeset
   314
3124
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   315
    "Created: / 28-02-1997 / 14:01:53 / cg"
3060c3f4246d added a hook for the menu-select-action
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
   316
    "Modified: / 15-10-2006 / 15:19:53 / cg"
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
! !
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
275
da88b7732dff commentary
Claus Gittinger <cg@exept.de>
parents: 230
diff changeset
   319
!ComboBoxView class methodsFor:'documentation'!
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
version
5815
1c36d4e19708 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   322
    ^ '$Header$'
124
4244606d3a06 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
! !
4493
c149fd42e738 class: ComboBoxView
Stefan Vogel <sv@exept.de>
parents: 3535
diff changeset
   324