--- a/controls/VariablePanel.py Wed Sep 05 12:38:41 2012 +0200
+++ b/controls/VariablePanel.py Wed Sep 05 12:39:50 2012 +0200
@@ -232,6 +232,7 @@
self.ParentWindow = parent
def OnDropText(self, x, y, data):
+ self.ParentWindow.ParentWindow.Select()
x, y = self.ParentWindow.VariablesGrid.CalcUnscrolledPosition(x, y)
col = self.ParentWindow.VariablesGrid.XToCol(x)
row = self.ParentWindow.VariablesGrid.YToRow(y - self.ParentWindow.VariablesGrid.GetColLabelSize())
@@ -272,22 +273,26 @@
elif base_type not in LOCATIONDATATYPES[location[0]]:
message = _("Incompatible size of data between \"%s\" and \"%s\"")%(location, variable_type)
else:
- dialog = wx.SingleChoiceDialog(self.ParentWindow,
+ dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
_("Select a variable class:"), _("Variable class"),
["Input", "Output", "Memory"],
wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
selected = dialog.GetSelection()
- if selected == 0:
- location = "%I" + location
- elif selected == 1:
- location = "%Q" + location
- else:
- location = "%M" + location
- self.ParentWindow.Table.SetValue(row, col, location)
- self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
- self.ParentWindow.SaveValues()
+ else:
+ selected = None
dialog.Destroy()
+ if selected is None:
+ return
+ if selected == 0:
+ location = "%I" + location
+ elif selected == 1:
+ location = "%Q" + location
+ else:
+ location = "%M" + location
+ self.ParentWindow.Table.SetValue(row, col, location)
+ self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
+ self.ParentWindow.SaveValues()
elif colname == "Initial Value" and values[1] == "Constant":
if not self.ParentWindow.Table.GetValueByName(row, "Edit"):
message = _("Can't set an initial value to a function block instance")