Fix loong standing bug with some menus not being translated / resolved jv
authorJan Vrany <jan.vrany@labware.com>
Fri, 02 Sep 2022 11:25:39 +0100
branchjv
changeset 6261 9b7eb7159d29
parent 6260 a9f10fa83270
child 6262 935b9d58c31f
Fix loong standing bug with some menus not being translated / resolved This has happened with browser "View" menu when sometimes it had the slice resolved and sometimes not. It turned out that it was because the code disabled resources (and therefore slices) resolution when processing shortcuts, so the menu was created and cached unresolved. This fixes the issue. eXept apparently run into the same problem.
MenuPanel.st
--- a/MenuPanel.st	Fri Jul 29 17:54:29 2022 +0100
+++ b/MenuPanel.st	Fri Sep 02 11:25:39 2022 +0100
@@ -1,7 +1,7 @@
 "
  COPYRIGHT (c) 1997 by eXept Software AG
  COPYRIGHT (c) 2016-2018 Jan Vrany
- COPYRIGHT (c) 2021 LabWare
+ COPYRIGHT (c) 2021-2022 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -72,7 +72,7 @@
 "
  COPYRIGHT (c) 1997 by eXept Software AG
  COPYRIGHT (c) 2016-2018 Jan Vrany
- COPYRIGHT (c) 2021 LabWare
+ COPYRIGHT (c) 2021-2022 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -5141,7 +5141,18 @@
         ^ true
     ].
 
-    Menu::NeedResourcesQuery answer:false do:[
+    "sr: bugfix:
+     the submenu can be cached,
+     so if we don't care about resources here (which seems like a performance optimization),
+     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.
+     Also the shortcuts itself could vary when translated 'Open &File' -> 'Datei &öffnen' ????"
+
+    "JV@2022-09-02: exactly!! But now there's nobody ever setting it to false,
+     so we may just as well to completely avoid using Menu::NeedResourcesQuery
+     here and in Menu >> findGuiResourceIn:... !!" 
+    "/ Menu::NeedResourcesQuery answer:true "sr - was: false" do:[
 
         [true] whileTrue:[
             list := menu
@@ -5173,10 +5184,11 @@
             menu == self ifTrue:[ ^ false ].
             menu := self.
         ].
-    ].
+    "/ ].
     ^ false     "/ never reached
 
     "Modified: / 06-10-2011 / 16:19:27 / cg"
+    "Modified: / 02-09-2022 / 11:21:11 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop ignoreSubmenuBlock:ignoreSubmenueBlock