I'm using GTK 1.2 and PyGTK 

My combo box glade attributes look like:
===
      <value_in_list>True</value_in_list>
      <ok_if_empty>False</ok_if_empty>
===

I have a handler for the 'changed' signal in a combobox.event widget. I
fill in the combobox.list widget list items dynamically. I have a helper
function that I pass all list items and the one I want selected and it
calls list.clear_items() then list.append_items(itemList).  When I do
this, the first item in the list is automatically selected and the
entryWidgetChangedCallback is called.  Then I do a
combo.list.select_item(desiredSelection) with the thing passed to my
helper, thus calling the entryWidgetChangedCallback again.  Since my
entryWidgetChangedCallback is slow, I want to avoid this.

I tried block and unblock of entryWidgetChangedCallback around the
clear_items() and append_items() and that indeed did the trick.  If the
desiredSelection is not the first item in the list everything works
fine. However, I thought a combo.entry.emit('changed') would be in order
if the first item in the list is the selected one since select_item()
doesn't really do anything in that case.  That causes
entryWidgetChangedCallback to be called twice.

===
combo.entry.signal_handler_block(self.dialogNameEntryChangedHandler)
combo.list.clear_items(0, -1)
combo.list.append_items(l)
combo.entry.signal_handler_unblock(self.dialogNameEntryChangedHandler)

if selectRow:
        combo.list.select_item(selectRow)
else:
        combo.entry.emit('changed')

===

I also tried:
===
set_value_in_list(gtk.FALSE, gtk.TRUE)
combo.list.clear_items(0, -1)
combo.list.append_items(l)
combo.list.select_item(selectRow)
combo.set_value_in_list(gtk.TRUE, gtk.FALSE)
===
but that didn't help either.

I'm sure my description is hard to follow, but if it happens to be
comprehensible, any help would be appreciated.
-- 
Steve McClure <[EMAIL PROTECTED]>
Racemi, Inc.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to