IDE: Workaround some reported WxPython/MacOS problems.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 20 Aug 2024 00:35:00 +0200
changeset 3972 5d46adf7bbba
parent 3971 f1c673cddc1f
child 3973 42730c1cb879
IDE: Workaround some reported WxPython/MacOS problems.

SetSelection should be used instead of SetStringSelection , and FindString must use case_sensitive=True
dialogs/FBDVariableDialog.py
--- a/dialogs/FBDVariableDialog.py	Tue Aug 20 00:31:45 2024 +0200
+++ b/dialogs/FBDVariableDialog.py	Tue Aug 20 00:35:00 2024 +0200
@@ -155,10 +155,8 @@
         # Get variable expression and select corresponding value in name list
         # box if it exists
         selected = self.Expression.GetValue()
-        if selected != "" and self.VariableName.FindString(selected) != wx.NOT_FOUND:
-            self.VariableName.SetStringSelection(selected)
-        else:
-            self.VariableName.SetSelection(wx.NOT_FOUND)
+        self.VariableName.SetSelection(
+            wx.NOT_FOUND if selected == "" else self.VariableName.FindString(selected, True))
 
         # Disable name list box if no name present inside
         self.VariableName.Enable(self.VariableName.GetCount() > 0)
@@ -185,10 +183,7 @@
                 # Set expression text control value
                 self.Expression.ChangeValue(value)
                 # Select corresponding text in name list box if it exists
-                if self.VariableName.FindString(value) != wx.NOT_FOUND:
-                    self.VariableName.SetStringSelection(value)
-                else:
-                    self.VariableName.SetSelection(wx.NOT_FOUND)
+                self.VariableName.SetSelection(self.VariableName.FindString(value, True))
 
             # Parameter is variable execution order
             elif name == "executionOrder":
@@ -265,7 +260,7 @@
         """
         # Select the corresponding value in name list box if it exists
         self.VariableName.SetSelection(
-            self.VariableName.FindString(self.Expression.GetValue()))
+            self.VariableName.FindString(self.Expression.GetValue(), True))
 
         self.Refresh()
         event.Skip()