FilenameEditFieldV2.st
changeset 8798 7c48ce02da90
parent 6446 5d2119be7b34
child 12117 d12665ccf213
child 12123 4bde08cebd48
equal deleted inserted replaced
8797:6df38a6057e3 8798:7c48ce02da90
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
       
    13 "{ Package: 'stx:libtool' }"
    12 "{ Package: 'stx:libtool' }"
    14 
    13 
    15 ComboBoxView subclass:#FilenameEditFieldV2
    14 ComboBoxView subclass:#FilenameEditFieldV2
    16 	instanceVariableNames:'directoriesOnly filesOnly directory acceptOnExpand activeMenu
    15 	instanceVariableNames:'directoriesOnly filesOnly directory acceptOnExpand activeMenu
    17 		completitionList'
    16 		completitionList'
   217 
   216 
   218 processEvent:anEvent
   217 processEvent:anEvent
   219     "catch keyEvents in pulled menu (see redefined pullMenu-method).
   218     "catch keyEvents in pulled menu (see redefined pullMenu-method).
   220      Return true, if I have eaten the event"
   219      Return true, if I have eaten the event"
   221 
   220 
   222     |wg|
       
   223 
       
   224     activeMenu notNil ifTrue:[
   221     activeMenu notNil ifTrue:[
   225         anEvent isKeyPressEvent ifTrue:[
   222         anEvent isKeyPressEvent ifTrue:[
   226             anEvent key isCharacter ifTrue:[
   223             "/ typing into the pulled menu behaves like typing into the field
       
   224             "/ followed by a TAB (to reopen the menu)
       
   225             (anEvent key isCharacter 
       
   226             or:[ anEvent key == #BackSpace]) ifTrue:[
   227                 "/ activeMenu windowGroup removePreEventHook:self.
   227                 "/ activeMenu windowGroup removePreEventHook:self.
   228 
   228                 field dispatchEvent:anEvent.
   229                 wg := self windowGroup.
   229 
   230                 wg focusView:field.
       
   231                 wg sensor pushEvent:anEvent.
       
   232                 WindowGroup leaveSignal raiseRequest.
   230                 WindowGroup leaveSignal raiseRequest.
   233                 self error:'should not be reached'.
   231                 self error:'should not be reached'.
   234             ]
   232             ].
   235         ].
   233         ].
   236     ].
   234     ].
   237     ^ false.
   235     ^ false.
   238 !
   236 !
   239 
   237 
   240 pullMenu
   238 pullMenu
   241     "pull the menu - triggered from the button"
   239     "pull the menu - triggered from the button"
   242 
   240 
   243     |menu origin plug acceptOnLostFocus|
   241     |menu origin plug acceptOnLostFocus|
   244 
       
   245     
   242     
   246     completitionList notNil ifTrue:[
   243     completitionList notNil ifTrue:[
   247         self list:completitionList
   244         self list:completitionList
   248     ] ifFalse:[
   245     ] ifFalse:[
   249         self list:(listHolder value collect:[:el| el path]).
   246         self list:(listHolder value collect:[:el| el path]).
   266                                          menu removeDependent:plug]).
   263                                          menu removeDependent:plug]).
   267     activeMenu := menu.
   264     activeMenu := menu.
   268     "prevent editfield from acceptOnLostFocus events so no accept happen while menue is open"
   265     "prevent editfield from acceptOnLostFocus events so no accept happen while menue is open"
   269     acceptOnLostFocus := field acceptOnLostFocus. 
   266     acceptOnLostFocus := field acceptOnLostFocus. 
   270     field acceptOnLostFocus:false.
   267     field acceptOnLostFocus:false.
       
   268     menu sensor addEventListener:self.
   271     menu showAt:origin.
   269     menu showAt:origin.
   272     field acceptOnLostFocus:acceptOnLostFocus.
   270     field acceptOnLostFocus:acceptOnLostFocus.
   273     activeMenu := nil.
   271     activeMenu := nil.
   274     pullDownButton turnOff.
   272     pullDownButton turnOff.
   275 ! !
   273 ! !
   276 
   274 
   277 !FilenameEditFieldV2 class methodsFor:'documentation'!
   275 !FilenameEditFieldV2 class methodsFor:'documentation'!
   278 
   276 
   279 version
   277 version
   280     ^ '$Header: /cvs/stx/stx/libtool/FilenameEditFieldV2.st,v 1.12 2005-12-21 16:33:39 cg Exp $'
   278     ^ '$Header: /cvs/stx/stx/libtool/FilenameEditFieldV2.st,v 1.13 2009-09-29 07:57:23 cg Exp $'
   281 ! !
   279 ! !