#REFACTORING by cg
class: Tools::NewSystemBrowser
changed:
#processEvent:
#searchFieldCreated:
ctrl-l in search field gives focus back to codeView
--- a/Tools__NewSystemBrowser.st Wed May 23 11:56:03 2018 +0200
+++ b/Tools__NewSystemBrowser.st Thu May 24 09:00:29 2018 +0200
@@ -61502,11 +61502,11 @@
searchFieldCreated:anInputField
anInputField font:(ListView defaultFont).
anInputField emptyFieldReplacementText:
- "/(resources string:'Class Search & History').
- (resources string:'Search Class/Selector (Ctrl-L)').
+ (resources string:'Search Class/Selector (Ctrl-l)').
"Modified: / 09-02-2010 / 21:56:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 07-03-2012 / 11:59:16 / cg"
+ "Modified (comment): / 24-05-2018 / 08:50:32 / Claus Gittinger"
!
searchFieldPanelCreated:aPanel
@@ -64475,7 +64475,7 @@
<resource: #keyboard (#Ctrll #FindNext #FindPrev)>
- |codeView evView key rawKey sensor|
+ |codeView evView key rawKey sensor searchField eventInSearchField|
codeView := self codeView.
(codeView isCodeView2) ifTrue:[
@@ -64487,10 +64487,26 @@
key := anEvent key.
rawKey := anEvent rawKey.
- rawKey == #Ctrll ifTrue:
- [(self componentAt: #SearchedClassNameComboBox) takeFocus.
- ^true].
-
+ searchField := self componentAt: #SearchedClassNameComboBox.
+ eventInSearchField := evView isSameOrComponentOf:searchField.
+
+ "/ ctrl gives the keyboard focus to the search field, another ctrl gives it back.
+ rawKey == #Ctrll ifTrue:[
+ eventInSearchField ifTrue:[
+ "/ give back focus to the codeView
+ codeView takeFocus
+ ] ifFalse:[
+ searchField takeFocus.
+ ].
+ ^ true
+ ].
+ "/ esc moves back into the codeView
+ (eventInSearchField and:[rawKey == #Escape]) ifTrue:[
+ "/ give back focus to the codeView
+ codeView takeFocus.
+ ^ true
+ ].
+
(evView isSameOrComponentOf:codeView) ifTrue:[
^ self keyInCodeView:key rawKey:rawKey
].
@@ -64577,6 +64593,7 @@
"Modified: / 09-08-2009 / 09:40:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 17-08-2011 / 13:29:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 09-11-2017 / 20:53:33 / cg"
+ "Modified: / 24-05-2018 / 08:57:55 / Claus Gittinger"
! !
!NewSystemBrowser methodsFor:'user actions-helpers'!