#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Wed, 06 Jun 2018 17:38:13 +0200
changeset 5785 82bf9b1da5e1
parent 5784 6d086db72816
child 5786 463541b7bca9
#UI_ENHANCEMENT by cg class: MenuPanel::Item changed: #activeHelpText #flyByHelpText:
MenuPanel.st
--- a/MenuPanel.st	Sat Jun 02 17:57:05 2018 +0200
+++ b/MenuPanel.st	Wed Jun 06 17:38:13 2018 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1997 by eXept Software AG
               All Rights Reserved
@@ -5107,7 +5105,7 @@
      we have non translated sub menus (when using them later for viewing).
      Problem expecco Menu 'View' was somethimes untranslated and somethimes not.
      Dependent if this code was called before the user did open (instantiate) the menu via the application.
-     May also the shortcuts itself could vary when translated 'Open &File' -> 'Datei &öffnen' ????"
+     May also the shortcuts itself could vary when translated 'Open &File' -> 'Datei &öffnen' ????"
     Menu::NeedResourcesQuery answer:true do:[
 "/    Menu::NeedResourcesQuery answer:false do:[
         [true] whileTrue:[
@@ -7142,62 +7140,47 @@
 activeHelpText
     "get the active helpText or nil if not yet resolved"
 
-    |app key tryItemValue text|
+    |app text key1 key2 key3 key4 keyFromLabel|
 
     "/ explicitly assigned (probably dynamic)
     activeHelpText notNil ifTrue:[^ activeHelpText].
-
-    tryItemValue := false.
+    flyByHelpText notNil ifTrue:[^ flyByHelpText].
 
     "/ activeHelpKey, or - if unassigned - the nameKey as fallback
-    (key := self activeHelpKey) isNil ifTrue:[
-        key := self nameKey.
-        key notNil ifTrue:[
-            tryItemValue := true.
-        ] ifFalse:[
-            self itemValue isSymbol ifTrue:[
-                key := self itemValue
-            ] ifFalse:[
-                (menuItem notNil and:[menuItem indication isSymbol]) ifTrue:[
-                    key := menuItem indication
-                ]
-            ]    
-        ].
-    ].
-    (key notNil and:[(app := menuPanel application) notNil]) ifTrue:[
-        text := app helpTextForKey:key.
-        text isNil ifTrue:[
-            tryItemValue ifTrue:[
-                self itemValue isSymbol ifTrue:[
-                    text := app helpTextForKey:self itemValue.
-                ].
-                text isNil ifTrue:[
-                    (menuItem notNil and:[menuItem indication isSymbol]) ifTrue:[
-                        text := app helpTextForKey:menuItem indication.
-                    ]    
-                ].
+    (key1 := menuItem activeHelpKey) isNil ifTrue:[
+        key2 := self nameKey.
+        self itemValue isSymbol ifTrue:[
+            key3 := self itemValue
+        ].
+        (menuItem notNil and:[menuItem indication isSymbol]) ifTrue:[
+            key4 := menuItem indication
+        ]
+    ].
+
+    (app := menuPanel application) notNil ifTrue:[ 
+        { key1 . key2 . key3 . key4 } do:[:key |
+            (key notNil and:[(app := menuPanel application) notNil]) ifTrue:[
+                text := app helpTextForKey:key.
+                text notNil ifTrue:[^ text].
             ].
         ].
-    ].
-
-    "/ usually not helpful:
-    "/  a) must care for ampersand in labels
-    "/  b) only helpful if label is an icon
-    text isNil ifTrue:[
-        app notNil ifTrue:[
-            key := self rawLabel.
-            key notEmptyOrNil ifTrue:[
-                key := String withoutAmpersandEscapes:key.
-                text := app helpTextForKey:key.
-                text = key ifTrue:[
-                    text := nil.
-                ].
-            ]
-        ].
-    ].
+
+        "/ trying the rawLable is usually not helpful:
+        "/  a) we must care for ampersand in labels
+        "/  b) only helpful if label is an icon (then there might be a label)
+        (keyFromLabel := self rawLabel) notEmptyOrNil ifTrue:[
+            keyFromLabel := String withoutAmpersandEscapes:keyFromLabel.
+            text := app helpTextForKey:keyFromLabel asSymbol.
+            text = keyFromLabel ifTrue:[
+                "/ no real return
+                text := nil.
+            ].
+        ].
+    ].
+
     ^ text
 
-    "Modified: / 01-06-2018 / 14:48:05 / Claus Gittinger"
+    "Modified: / 06-06-2018 / 17:11:46 / Claus Gittinger"
 !
 
 activeHelpText:aText
@@ -7207,6 +7190,7 @@
 !
 
 flyByHelpText:aText
+    <resource: #obsolete>
     "obsolete: provided for backward compatibility
      explicitly set the flyBy helpText. For example, to dynamically change it."