On 26-02-11 18:14, Gary Jaffe wrote:
Hi,

I have a gtk.Entry in which I place a code followed by a description. The user enters the code, and I do a keyed lookup and place the code + description of that code in the gtk.Entry and move focus to the next gtk.Entry.

If the user made a mistake and wants to enter a different code in the first gtk.Entry, I select the entire text of the gtk.Entry when I see it grabbing focus so the user doesn't have to delete all the old text that's in the gtk.Entry. His first key stroke will do that.

But there's a problem. If the code + description is too long, gtk will move the cursor position to the end of the text when I select the whole text, hiding the code that is in error. If I then move the cursor to the beginning of the text, that will un-select the text.

So, is there a way to select the entire text of a gtk.Entry that's too long to show all of it, and have gtk show the beginning of the text rather than the end?

Doesn't a set_position(0) show the start of the text? Then do a select_region(0, -1) to select the entire text. While looking at the docs, I just noticed the set_cursor_hadjustment() method [0] which might be of use. I never used it before though.

Cheers,
Timo

[0] http://library.gnome.org/devel/pygtk/stable/class-gtkentry.html#method-gtkentry--set-cursor-hadjustment

Thanks,
Gary


_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to