EditFieldWithCompletion.st
author Stefan Vogel <sv@exept.de>
Thu, 04 Aug 2011 16:25:07 +0200
changeset 10445 70c71811bd97
parent 10443 eed0953d70a6
child 10885 9509463c1702
permissions -rw-r--r--
comment/format in: #initialize #keyPress:x:y: changed: #showOptionsWindow Allow double click on selctionList entry
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
EditField subclass:#EditFieldWithCompletion
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'showOptions optionsHolder optionsView optionsWindow
10443
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
    16
		focusEventsToIgnore hadFocus completionJob'
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Views-Text'
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!EditFieldWithCompletion class methodsFor:'documentation'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 2006 by eXept Software AG
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	      All Rights Reserved
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    documentation to be added.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    [author:]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
        Jan Vrany (janfrog@bruxa)
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    [instance variables:]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    [class variables:]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [see also:]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
example_1
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    |top field label value|
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    top := StandardSystemView new.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    top
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
        extent:300 @ 300;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        label:'Live class completion field'.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    value := '' asValue.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    field := (EditFieldWithCompletion new)
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
                origin:10 @ 135 corner:280 @ 165;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
                entryCompletionBlock:[:content | Smalltalk classnameCompletion:content ];
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
                model:value.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    label := (Label new)
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
                origin:10 @ 95 corner:280 @ 115;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
                labelChannel:value.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    top
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
        add:field;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
        add:label.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    top open
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
examples
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    Opens a LiveCompletionEditField on a class name
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
                                                        [exBegin]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    LiveCompletionEditField example_1
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
                                                        [exEnd]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
!EditFieldWithCompletion methodsFor:'accepting'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
accept
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    self unselect.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    super accept.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    "Created: / 27-07-2009 / 09:38:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    "Modified: / 12-02-2010 / 11:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
!EditFieldWithCompletion methodsFor:'accessing-behavior'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
showOptions
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    ^ showOptions
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
showOptions:aBoolean
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    showOptions := aBoolean.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
!EditFieldWithCompletion methodsFor:'accessing-dimensions'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
absoluteLeft
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    | absoluteLeft view |
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    absoluteLeft := 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    view := self.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    [ view notNil ] whileTrue:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        [absoluteLeft := absoluteLeft + view left - 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
        view := view superView].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    ^absoluteLeft
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    "Created: / 08-08-2009 / 22:30:07 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
absoluteTop
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    | absoluteTop view |
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    absoluteTop := 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    view := self.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    [ view notNil ] whileTrue:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        [absoluteTop := absoluteTop + view top - 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        view := view superView].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    ^absoluteTop
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    "Created: / 08-08-2009 / 22:30:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!EditFieldWithCompletion methodsFor:'accessing-mvc'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
optionsHolder
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    ^ optionsHolder
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    "Created: / 09-08-2009 / 08:14:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
optionsHolder:aValueHolder
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    "set the 'options' value holder (automatically generated)"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    optionsHolder := aValueHolder.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    "Created: / 09-08-2009 / 08:14:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
!EditFieldWithCompletion methodsFor:'event handling'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
completion:best options:options 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    |newContent oldContent|
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    "
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    oldContent := ((self contents ? '') asString).
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    newContent := ((best isNil or:[ best = oldContent ]) 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
                and:[ options isNilOrEmptyCollection not ]) 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
                    ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
                        options first
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
                        ""options inject:options anyOne
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
                            into:[:shortest :each | 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
                                shortest asString size > each asString size ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
                                    each
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
                                ] ifFalse:[ shortest ]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
                            ]""
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
                    ]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
                    ifFalse:[ best ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    self contents:newContent asString.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    self cursorCol:oldContent size + 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    oldContent size < newContent size ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
        self 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
            selectFromLine:1
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
            col:oldContent size + 1
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
            toLine:1
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
            col:newContent size
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    "
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    options size > 1 ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
        optionsHolder value:options.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
        self showOptionsWindow
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    ]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "Created: / 08-08-2009 / 22:02:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "Modified: / 09-08-2009 / 08:16:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    "Modified: / 13-02-2010 / 09:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
handleNonCommandKey: char
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    super handleNonCommandKey: char.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    self startCompletion
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    "Modified: / 26-07-2009 / 17:41:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
handlesKeyPress:key inView:aView
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    ^aView == optionsView and:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
        [(#( #CursorDown #CursorUp ) includes: key) not].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    "Created: / 09-12-2010 / 21:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
hasKeyboardFocus:aBoolean
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    focusEventsToIgnore > 0 ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
        focusEventsToIgnore := focusEventsToIgnore - 1.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
        "
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
        xxx == 0 ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
            Transcript showCR:'--> taking focus'.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
            self takeFocus.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
            self assert: self windowGroup focusView == self.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
            hadFocus := true.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
        ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
        "            
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
        ^self].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    hadFocus == aBoolean ifTrue:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
        ^self
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    aBoolean 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
        ifTrue:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
            [self selectAll]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
        ifFalse:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
            [self unselect.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
            self hideOptionsWindow].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    hadFocus := aBoolean.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ^ super hasKeyboardFocus:aBoolean
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "Created: / 08-08-2009 / 23:28:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "Modified: / 09-08-2009 / 10:14:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    "Modified: / 09-12-2010 / 22:05:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
keyPress:key x:x y:y 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    "Forward certain events to optionsView if any"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    (optionsView notNil and:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
        [(#( #CursorDown #CursorUp ) includes:key)]) 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
            ifTrue:[^ optionsView keyPress:key x:x y:y].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    key = #Accept ifTrue:[self hideOptionsWindow].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    key = #Return ifTrue:[self hideOptionsWindow].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    key = #Escape ifTrue:[self hideOptionsWindow].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    key = #BackSpace ifTrue:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
        [super 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
            keyPress:#Delete x:x y:y;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
            keyPress:#BackSpace x:x y:y.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
        ^ self startCompletion].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
    
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
    ^ super 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
        keyPress:key
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
        x:x
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
        y:y
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Created: / 08-08-2009 / 22:02:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "Modified: / 09-08-2009 / 14:06:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
    "Modified: / 09-02-2010 / 20:47:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
keyPress:key x:x y:y view:aView
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    self keyPress: key x:x y:y
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    "Created: / 09-12-2010 / 21:32:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!EditFieldWithCompletion methodsFor:'initialization & release'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
destroy
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    self hideOptionsWindow.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    super destroy.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
    "Created: / 08-08-2009 / 22:16:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    "Modified: / 09-08-2009 / 08:50:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
initialize
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
    super initialize.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    showOptions := true.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    optionsHolder := ValueHolder new.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    focusEventsToIgnore := 0.
10443
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   290
    completionJob := BackgroundJob 
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   291
                        named: 'Edit Field Completion Job'
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   292
                        on:[self doCompletion].
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
    "Created: / 08-08-2009 / 20:24:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    "Modified: / 09-08-2009 / 08:17:09 / Jan Vrany <vranyj1@fel.cvut.cz>"
10443
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   296
    "Modified: / 03-08-2011 / 17:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
!EditFieldWithCompletion methodsFor:'private'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
doCompletion
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    |oldContents options best|
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
    oldContents := (self contents ? '') asString.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    options := self entryCompletionBlock 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
                valueWithOptionalArgument:oldContents
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
                and:self.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    options ifNil:[ ^ self ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    best := options first.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    options := options second.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    (options includes: best) ifFalse:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
        [best := options detect:[:e|e asString startsWith: best asString] ifNone:[best]].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    options isSortedCollection ifFalse:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
        [options := options asSortedCollection:
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
            [:a :b|a asString < b asString]].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    self sensor 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
        pushUserEvent: #completion:options: for: self 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
        withArguments: (Array with: best with: options).
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
    "Created: / 26-07-2009 / 17:45:09 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    "Modified: / 09-08-2009 / 02:51:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    "Modified: / 09-02-2010 / 20:46:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
hideOptionsWindow
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    optionsWindow
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
        ifNotNil:[
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
            optionsWindow destroy.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
            optionsWindow := nil.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
        ]
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
    "Created: / 08-08-2009 / 23:23:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
    "Modified: / 09-08-2009 / 09:00:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
showOptionsWindow
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
    showOptions ifFalse:[^ self].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    optionsWindow ifNotNil:[ ^ self ].
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
    optionsView := SelectionInListModelView new
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
                    textStartLeft: textStartLeft - 2;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
                    listHolder: optionsHolder;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
                    action:[:value | self contents:value asString ];
10445
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   345
                    doubleClickAction:[:index | 
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   346
                            self contents:(optionsView at:index) asString.
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   347
                            self hideOptionsWindow.
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   348
                            self accept
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   349
                        ];
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
                    useIndex: false;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
                    " JV: Looks good to me "
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
                    highlightMode: #line;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
                    font:self font;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
                    backgroundColor:self backgroundColor;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
                    delegate: self.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
    optionsWindow := StandardSystemView new
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
        bePopUpView;
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
        beSlave;        
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
        origin:(self absoluteLeft + 5" - optionsView textStartLeft") 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
                    @ (self absoluteTop + self height + 1 + 5)
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
        extent:(width + 0"((optionsView textStartLeft) * 2)") @ (fontHeight * 10).
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
    ScrollableView   
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
        forView:optionsView 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
        hasHorizontalScrollBar:false 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
        hasVerticalScrollBar:true 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
        miniScrollerH:true 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
        miniScrollerV:false 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
        origin:0.0@0.0 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        corner:1.0@1.0 
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
        in:optionsWindow.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
    focusEventsToIgnore := 4.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
    optionsWindow open.
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
    "Created: / 09-08-2009 / 08:12:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    "Modified: / 09-08-2009 / 09:28:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
    "Modified: / 09-12-2010 / 22:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
startCompletion
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
10443
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   384
    completionJob restart.
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
    "Created: / 26-07-2009 / 17:41:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
10443
eed0953d70a6 Use BackgroundJob to do the search in background
vrany
parents: 10025
diff changeset
   387
    "Modified (format): / 03-08-2011 / 17:50:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
! !
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
!EditFieldWithCompletion class methodsFor:'documentation'!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
version_CVS
10445
70c71811bd97 comment/format in:
Stefan Vogel <sv@exept.de>
parents: 10443
diff changeset
   393
    ^ '$Header: /cvs/stx/stx/libtool/EditFieldWithCompletion.st,v 1.3 2011-08-04 14:25:07 stefan Exp $'
10025
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
!
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
version_SVN
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    ^ '§Id: EditFieldWithCompletion.st 7662 2010-12-09 21:05:19Z vranyj1 §'
cdf041762f27 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
! !