class: MultiViewToolApplication
authorClaus Gittinger <cg@exept.de>
Tue, 24 Feb 2015 16:27:46 +0100
changeset 15407 7c5e7b454c1a
parent 15406 a784c5d4cea0
child 15408 ff62d43d5a1a
class: MultiViewToolApplication comment/format in: #tabMenuAt: changed: #addWindow:named:tabIcon:asFirst: #tabMenu
MultiViewToolApplication.st
--- a/MultiViewToolApplication.st	Tue Feb 24 16:08:21 2015 +0100
+++ b/MultiViewToolApplication.st	Tue Feb 24 16:27:46 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libtool' }"
 
+"{ NameSpace: Smalltalk }"
+
 ToolApplicationModel subclass:#MultiViewToolApplication
 	instanceVariableNames:'workspaces tabList selectedWorkspaceIndexHolder workspaceHolder'
 	classVariableNames:'DefaultInfoVisible DefaultEditToolBarVisible
@@ -439,7 +441,6 @@
             "/ #triggerOnDown: true
             #value: #removeAllWorkspacesExcept:
             #enabled: #canRemoveAllWorkspacesExcept:
-            #isVisible: false
           )
          #(#MenuItem
             #label: '-'
@@ -926,7 +927,7 @@
 !
 
 addWindow:aWindow named:name tabIcon:iconOrNil asFirst:asFirst
-    |tabList tabItem wsIndex newSelectedIndex w|
+    |tabList tabItem wsIndex newSelectedIndex initialFocusView|
 
     tabList := self tabList.
     wsIndex := tabList size + 1.
@@ -951,9 +952,17 @@
         newSelectedIndex := wsIndex.
     ].
 
-    w := aWindow scrolledView.
-    (w notNil and:[w isKeyboardConsumer]) ifTrue:[
-        w takeFocusWhenMapped:true.
+    (aWindow isKeyboardConsumer) ifTrue:[
+        initialFocusView := aWindow.
+    ] ifFalse:[
+        (aWindow scrolledView isKeyboardConsumer) ifTrue:[
+            initialFocusView := aWindow scrolledView
+        ] ifFalse:[
+            initialFocusView := aWindow scrolledView allSubViewsDetect:[:v | v isKeyboardConsumer] ifNone:nil.
+        ]
+    ].
+    (initialFocusView notNil "and:[w isKeyboardConsumer]") ifTrue:[
+        initialFocusView takeFocusWhenMapped:true.
     ].
 
     workspaces at:newSelectedIndex put:aWindow.
@@ -1402,6 +1411,6 @@
 !MultiViewToolApplication class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/MultiViewToolApplication.st,v 1.51 2014-10-25 13:01:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/MultiViewToolApplication.st,v 1.52 2015-02-24 15:27:46 cg Exp $'
 ! !