FilenameEditField.st
changeset 289 032b49184de6
parent 163 c9235372f589
child 473 b219215b326b
equal deleted inserted replaced
288:5dc19e8bc5ae 289:032b49184de6
   106      Bug: it completes the last word; it should complete the
   106      Bug: it completes the last word; it should complete the
   107           word before the cursor."
   107           word before the cursor."
   108 
   108 
   109     <resource: #keyboard ( #Tab #FilenameCompletion ) >
   109     <resource: #keyboard ( #Tab #FilenameCompletion ) >
   110 
   110 
   111     |s|
   111     |oldContents newContents|
   112 
   112 
   113     enabled ifTrue:[
   113     enabled ifTrue:[
   114         ((key == #Tab)
   114         ((key == entryCompletionCharacter)
   115         or:[key == #FilenameCompletion]) ifTrue:[
   115         or:[key == #FilenameCompletion]) ifTrue:[
   116             s := self contents.
   116             oldContents := self contents.
   117             s isNil ifTrue:[
   117             oldContents isNil ifTrue:[
   118                 s := ''
   118                 oldContents := ''
   119             ] ifFalse:[
   119             ] ifFalse:[
   120                 s := s asString
   120                 oldContents := oldContents asString
   121             ].
   121             ].
   122             entryCompletionBlock value:s.
   122 
       
   123             entryCompletionBlock value:oldContents.
       
   124 
       
   125             newContents := self contents.
       
   126             newContents isNil ifTrue:[
       
   127                 newContents := ''
       
   128             ] ifFalse:[
       
   129                 newContents := newContents asString
       
   130             ].
       
   131             newContents ~= oldContents ifTrue:[
       
   132                 self textChanged
       
   133             ].
   123             ^ self
   134             ^ self
   124         ]
   135         ]
   125     ].
   136     ].
   126     ^ super keyPress:key x:x y:y.
   137     ^ super keyPress:key x:x y:y.
   127 
   138 
   166 ! !
   177 ! !
   167 
   178 
   168 !FilenameEditField class methodsFor:'documentation'!
   179 !FilenameEditField class methodsFor:'documentation'!
   169 
   180 
   170 version
   181 version
   171     ^ '$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.22 1996-04-30 08:48:07 cg Exp $'
   182     ^ '$Header: /cvs/stx/stx/libwidg2/FilenameEditField.st,v 1.23 1997-01-28 11:50:40 ca Exp $'
   172 ! !
   183 ! !