I have a code that extracts some minimalist data using API and when double-clicking on a cell it opens a new frame with more detailed data about that row. I also select the complete row when a cell is clicked.
My problem is that when I select a row on the second frame it is also selected on the first frame. Also, when I try to select row #10, for example, on the second frame and the first frame contains less rows, the row won't select and I receive an error message saying that the row doesn't exist.
Is there a way to differentiate between the 2 frames? I tried renaming the second frame TestFrame1 but that doesn't change anything.
Here is the code of the first frame, the second one is based on the same template with the only difference TestFrame1 instead of TestFrame. Thank you,
class SimpleGrid(gridlib.Grid):
def __init__(self, parent, log):
gridlib.Grid.__init__(self, parent, -1)
# test all the events
self.Bind(gridlib.EVT_GRID_SELECT_CELL, self.OnSelectCell)
def openPublishers(self, evt):
from publishers import TestFrame1
frame = TestFrame1(self, sys.stdout)
frame.Show()
#Select complete row
def OnSelectCell(self, evt):
self.log.write("OnSelectCell: (%d,%d) %s\n" %
(evt.GetRow(), evt.GetCol(), evt.GetPosition()))
self.SelectRow(evt.GetRow())
evt.Skip()
#open TestFrame1
def openPublishers(self, evt):
from publishers import TestFrame1
frame = TestFrame1(self, sys.stdout)
frame.Show()
class TestFrame(wx.Frame):
def __init__(self, parent, log):
wx.Frame.__init__(self, parent, 0, "Report", size=(1400,800))
self.grid = SimpleGrid(self, log)
if __name__ == '__main__':
import sys
from wx.lib.mixins.inspection import InspectableApp
app = InspectableApp(False)
frame = TestFrame(None, sys.stdout)
frame.Show(True)
#import wx.lib.inspection
#wx.lib.inspection.InspectionTool().Show()
app.MainLoop()
I think the problem is that at the end of your select event handler you call event.Skip – this tells the system to carry on trying to find event handlers for your event. Since frame 2 is a child of frame 1 selecting in frame 2 and skipping after the selection results in frame 1 also seeing the click with the row, col values.
Gadget Steve
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wxpython-user...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/wxpython-users/eaafc6e9-8832-4f8e-b7d4-03d89011a57c%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpytho...@googlegroups.com.