From a wxgrid-derived class in a splitter window in a wxframe, in a
function called by an OnCellChange method...
I first put up a wxTextEntryDialog, and then after the user closes
that, based on further results, sometimes put up a wxMiniFrame-derived
window.
The second window doesn't get the focus, even if I set it
explicitly with SetFocus. It does get the focus if I comment out the
wxTextEntryDialog. Any thoughts?
Here's the function, and the wxMiniFrame-based class:
def do_match(self, row):
dlg = wxTextEntryDialog(self, 'Comment regarding the match',
'Enter comments')
if dlg.ShowModal() == wxID_OK:
note = dlg.GetValue()
else: note = ''
dlg.Destroy()
debug("Note was: %s"%note)
key1 = self.grid1.table.records[0][self.grid1.table.datalist.primary_key]
key2 = self.grid2.table.records[row][self.grid2.table.datalist.primary_key]
further_matches = self.matchset.make_match(key1, key2, note)
if further_matches:
win = MatchMiniFrame(self, -1, "This is a wxMiniFrame",
wxDefaultPosition, wxSize(200, 200),
wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ)
self.otherWin = win
win.Show(true)
class MatchMiniFrame(wxMiniFrame):
def __init__(self, parent, ID, title, pos, size, style):
wxMiniFrame.__init__(self, parent, ID, title, pos, size, style)
panel = wxPanel(self, -1)
button = wxButton(panel, 1003, "Close Me")
button.SetPosition(wxPoint(15, 15))
EVT_BUTTON(self, 1003, self.OnCloseMe)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseMe(self, event):
self.Close(true)
def OnCloseWindow(self, event):
self.Destroy()