Viewer.py
changeset 479 2fab0eefa66e
parent 477 fd9625f6e92a
child 487 580b04db8c65
--- a/Viewer.py	Tue Dec 08 17:10:30 2009 +0100
+++ b/Viewer.py	Wed Dec 09 10:19:35 2009 +0100
@@ -1106,12 +1106,13 @@
 #                           Popup menu functions
 #-------------------------------------------------------------------------------
 
-    def GetForceVariableMenuFunction(self, iec_path):
+    def GetForceVariableMenuFunction(self, iec_path, element):
         iec_type = self.GetDataType(iec_path)
         def ForceVariableFunction(event):
             if iec_type is not None:
-                dialog = ForceVariableDialog(self.ParentWindow, iec_type)
+                dialog = ForceVariableDialog(self.ParentWindow, iec_type, str(element.GetValue()))
                 if dialog.ShowModal() == wx.ID_OK:
+                    self.ParentWindow.AddDebugVariable(iec_path)
                     self.ForceDataValue(iec_path, dialog.GetValue())
         return ForceVariableFunction
 
@@ -1126,7 +1127,7 @@
             menu = wx.Menu(title='')
             new_id = wx.NewId()
             AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Force value"))
-            self.Bind(wx.EVT_MENU, self.GetForceVariableMenuFunction(iec_path.upper()), id=new_id)
+            self.Bind(wx.EVT_MENU, self.GetForceVariableMenuFunction(iec_path.upper(), self.SelectedElement), id=new_id)
             new_id = wx.NewId()
             AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Release value"))
             self.Bind(wx.EVT_MENU, self.GetReleaseVariableMenuFunction(iec_path.upper()), id=new_id)