controls/LocationCellEditor.py
branchrename_on_location_change
changeset 2573 071d10c7ab8f
parent 1881 091005ec69c4
child 2574 48a486000e84
--- a/controls/LocationCellEditor.py	Thu Mar 28 14:06:53 2019 +0100
+++ b/controls/LocationCellEditor.py	Tue Apr 02 09:46:58 2019 +0200
@@ -80,6 +80,9 @@
     def GetValue(self):
         return self.Location.GetValue()
 
+    def GetName(self):
+        return self.VariableName
+    
     def OnSize(self, event):
         self.Layout()
 
@@ -118,6 +121,7 @@
                     location = "%M" + location
 
             self.Location.SetValue(location)
+            self.VariableName = infos["name"]
             self.VarType = infos["IEC_type"]
 
         self.Location.SetFocus()
@@ -171,6 +175,10 @@
         loc = self.CellControl.GetValue()
         changed = loc != old_loc
         if changed:
+            name = self.CellControl.GetName()
+            old_name  = self.Table.GetValueByName(row, 'Name')
+            self.Table.SetValueByName(row, 'Name', name)
+            self.Table.Parent.OnVariableNameChange(old_name, name)
             self.Table.SetValueByName(row, 'Location', loc)
             self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType())
         self.CellControl.Disable()