In my application, the "select-child" event triggers a lot of code.
Sometimes I just want to set the entry with a text, and not trigger the "select-child" 
event on that combo.
Is there a way to set the text of an entry of an combo, without triggering the event?

Try the example below. It will trigger the select-child event when you press the 
"SetText" button.
(b.t.w. it will also trigger the event twice (on WindowsNT) when you only 
dropdown.(bug?) And it will trigger it twice when you select a value from the list... 
(only one would be nicer)).

Greets and best whishes,
Rene Olsthoorn.

# Start example

import sys
import gtk

def gtk_main_quit(*args):
   gtk.main_quit()

def comboSelect(*args):
   print "comboSelect"

def setText(*args):
   combo.entry.set_text("value1")

window = gtk.Window()
window.set_title("Combotester")
window.set_border_width(0)

vbox = gtk.VBox(gtk.FALSE, 0)
window.add(vbox) 

label = gtk.Label("Combo tester")
vbox.add(label)

global combo
combo = gtk.Combo()
vbox.add(combo)
comboListItems = [ '', 'value1', 'value2', 'value3' ]
combo.set_popdown_strings(comboListItems)
combo.list.connect("select-child", comboSelect)

button = gtk.Button("SetText")
vbox.add(button)
button.connect('clicked', setText)

button = gtk.Button("Quit")
vbox.add(button)
button.connect('clicked', gtk_main_quit)

window.show_all()
gtk.main()


-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Meet Singles
http://corp.mail.com/lavalife

_______________________________________________
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