X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fwx%2FGrids.py;fp=m_librarian%2Fwx%2FGrids.py;h=fe2f8d0174c68ef3dc4bbd734bd456879167eb6d;hb=1a0cfa4b41817b2f558bb78ced4ce0520bc907d8;hp=415f68423c9c1b9024164656043cc2e6f2fbdf84;hpb=80ba14a7bd17c4ddf1bd7c193e0bba6aa4d0c907;p=m_librarian.git diff --git a/m_librarian/wx/Grids.py b/m_librarian/wx/Grids.py index 415f684..fe2f8d0 100644 --- a/m_librarian/wx/Grids.py +++ b/m_librarian/wx/Grids.py @@ -14,11 +14,33 @@ class GridPanel(wx.Panel): self.grid = grid = wx.grid.Grid(self) vsizer.Add(grid, 0, wx.EXPAND, 0) + grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnDClick) + grid.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) + self.InitGrid() + grid.SetFocus() + + parent.Bind(wx.EVT_ACTIVATE, self.OnActivate) + parent.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) + self.Bind(wx.EVT_ACTIVATE, self.OnActivate) + self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) def InitGrid(self): raise NotImplementedError + def OnDClick(self, event): + raise NotImplementedError + + def OnKeyDown(self, event): + raise NotImplementedError + + def OnActivate(self, event): + if event.GetActive(): + self.grid.SetFocus() + + def OnSetFocus(self, event): + self.grid.SetFocus() + class GridWindow(AWindow): @@ -33,4 +55,4 @@ class GridWindow(AWindow): def OnInit(self): AWindow.OnInit(self) - self.GridPanelClass(self, self.param) + self.panel = self.GridPanelClass(self, self.param)