[pygtk] set focus to a gtk.Entry()
awalter1
alain.walter at thalesgroup.com
Fri Nov 23 23:06:36 WST 2007
Hello,
I manage a gtk.Entry().
I want to use value get from a combobox during the input.
After selecting a value from the combobox, it is correctly added in the
entry field at the right place, but I don't want to use the mouse to click
in the entry field and I can't set the focus to the entry field by program.
I've tried the set_focus() method, but in this case the text of the entry
field is selected then at the new input, it is deleted.
Here is my python source:
self.queryEntry = gtk.Entry()
self.fieldCombo = gtk.combo_box_new_text()
l_fields = ['callsign','adep']
self.fieldCombo.append_text('Field')
for field in l_fields:
self.fieldCombo.append_text(field)
self.fieldCombo.connect('changed', self.PageQueryComboChangedField,None)
...
def PageQueryComboChangedField(self, combo,param):
model = combo.get_model()
index = combo.get_active()
pos = self.queryEntry.get_position()
self.queryEntry.insert_text(model[index][0],pos)
self.parentWin.set_focus(self.queryEntry)
Is someone has a idea ?
Thanks a lot
--
View this message in context: http://www.nabble.com/set-focus-to-a-gtk.Entry%28%29-tf4861934.html#a13912923
Sent from the Gtk+ - Python mailing list archive at Nabble.com.
More information about the pygtk
mailing list