I am doing the following:
Creating a class subclassed from wxDialog with three listboxes in (I'll call
this ListBoxDialog). On one of the list boxes, I override the EVT_LISTBOX
handler as so:
# Add List Box for Register Masks
self.regMaskLB = wxListBox(self,
iId,
wxDefaultPosition,
wxDefaultSize,
map(lambda x: x[1], self.aReg),
wxLB_SINGLE)
EVT_LISTBOX(self, iId, self.EvHRegMaskLB)
self.regMaskLB.SetSelection(0)
listBoxBoxSizer.Add(self.regMaskLB, 0, wxALIGN_TOP)
The event handler looks like this (modified a bit to cut the clutter, plus
in real life I am not using a wxMessageDialog):
def EvHRegMaskLB(self, event):
iListBoxIdx = self.regMaskLB.GetSelection()
dlg = wxMessageDialog(self, self.aReg[iListBoxIdx][1])
if dlg.ShowModal() == wxID_OK:
pass
dlg.Destroy()
# Handle default
event.Skip()
This works find on Windoze, but when I run this on Linux/wxGTK, it doesn't
work properly:
Invoke ListBoxDialog. Click on ListBox item. MessageDialog comes up OK,
dismiss using OK or Cancel. If the mouse happens to be in ListBoxDialog with
a y coordinate in the same y coordinate space as the ListBox (note it
doesn't have to be in the listbox), the ListBox item which corresponds with
the mouse y coordinate seems to get automatically selected, and the
MessageDialog pops up again. No clicking or anything needed. Move it up the
list, the selection changes, and I have to dismiss MessageDialog a number of
times.
Note that if I use EVT_LISTBOX_DCLICK it is works the same as Windoze.
I am using wxPython 2.1.13 on Linux and 2.1.15 on Windoze (I didn't upgrade
because I have seen other possible problems using 2.1.15 on Linux/GTK)
Any suggestions?
NOTE: the reply e-mail address may be wrong - please respond to
rcc@jennic.com
Robert Cragie
Design Engineer
Jennic Ltd.
Sheffield Science Park
Sheffield
S1 2NS
Tel: (+44) 114 281 2655
Fax: (+44) 114 281 2951
mailto:rcc@jennic.com