diff -r cefc9219bb48 -r cd9db17c7ab5 controls/VariablePanel.py --- a/controls/VariablePanel.py Mon Mar 27 18:03:26 2017 +0300 +++ b/controls/VariablePanel.py Tue Mar 28 11:31:05 2017 +0300 @@ -781,7 +781,8 @@ else: self.SaveValues() if colname == "Class": - wx.CallAfter(self.ParentWindow.RefreshView, False) + self.ClearLocation(row, col, value) + wx.CallAfter(self.ParentWindow.RefreshView) elif colname == "Location": wx.CallAfter(self.ParentWindow.RefreshView) @@ -791,6 +792,13 @@ else: event.Skip() + def ClearLocation(self, row, col, value): + if self.Values[row].Location != '': + if self.Table.GetColLabelValue(col, False) == 'Class' and value not in ["Local", "Global"] or \ + self.Table.GetColLabelValue(col, False) == 'Type' and not self.Parent.Controler.IsLocatableType(value): + self.Values[row].Location = '' + self.RefreshValues() + def BuildStdIECTypesMenu(self,type_menu): # build a submenu containing standard IEC types base_menu = wx.Menu(title='') @@ -849,6 +857,7 @@ label_value = self.Table.GetColLabelValue(col, False) if label_value == "Type": + old_value = self.Values[row].Type classtype = self.Table.GetValueByName(row, "Class") type_menu = wx.Menu(title='') # the root menu @@ -870,6 +879,9 @@ self.VariablesGrid.PopupMenuXY(type_menu, corner_x, corner_y) type_menu.Destroy() event.Veto() + value = self.Values[row].Type + if old_value != value: + self.ClearLocation(row, col, value) else: event.Skip()