Re: changing a combo's popdown strings from select-list callback?
- From: Skip Montanaro <skip pobox com>
- To: John Cupitt <john cupitt ng-london org uk>
- Cc: pygtk daa com au, gtk-list gnome org
- Subject: Re: changing a combo's popdown strings from select-list callback?
- Date: Wed, 31 Oct 2001 12:01:19 -0600
John> Hi Skip, I don't know if this is still true for 1.3, but with gtk
John> 1.2 you got a core if you removed the item with focus from a popup
John> list. I worked around this by doing a gtk_widget_grab_focus()
John> somewhere else before doing the delete.
FWIW, I wound up subclassing the Combo widget (in Python) and making the
set_popdown_strings method a bit smarter. It checks to see if its list
widget's toplevel window is visible, and if so, connects to that widget's
unmap signal to defer the actual setting:
def deferred_popdown_cb(self, *args):
self.list_parent.disconnect(self.popdown_id)
gtk.Combo.set_popdown_strings(self, self.popdown_strings)
def set_popdown_strings(self, strings):
self.popdown_strings = strings
self.list_parent = self.list.get_toplevel()
if self.list_parent and (self.list_parent.flags() & gtk.MAPPED):
self.popdown_id = self.list_parent.connect("unmap",
self.deferred_popdown_cb)
else:
gtk.Combo.set_popdown_strings(self, self.popdown_strings)
I'm not sure that's the best way to do it, but it worked for me. Perhaps
gtk_combo_set_popdown_strings should do something like this by default.
Alternatively, it would be nice if the GtkCombo documentation warned about
the potential problems of mucking with the list while it's active.
--
Skip Montanaro (skip pobox com)
http://www.mojam.com/
http://www.musi-cal.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]