gtk_editable_select_region and cursor position
- From: Matt Keenan <Matt Keenan sun com>
- To: Gtk App Devel List <gtk-app-devel-list gnome org>
- Subject: gtk_editable_select_region and cursor position
- Date: Thu, 24 Apr 2003 11:47:45 +0100
Came across this problem in gtk and not sure if solveable...
Trying to implement command history within a gtkentry. As you are entering
text I want to be able to display a match from a list of previously entered
strings. I monitor the key_press_event on the GtkEntry widget, and get the
current text position, attempt to make a match and if there is a match
disply this match with the extra text highlighted, however when the user
enters the next key the current position returned from
is the end of the string as opposed to where the next char is typed.
List of Previously entered strings :
Order of entry
1. type "s"
Within the key_press_event callback
gtk_editable_get_position -> 0
I match the string "sing1"
This displays the text "s" unhighlighted and the rest "ing1" highlighted.
2, type "i"
The "i" appears directly after the previously typed "s" which is as
i expect however
gtk_editable_get_position -> 5
surely it should return 1....
Can anyone answer me as to why this is happening, or am I doing something
__.--'\ \.__./ /'--.__
_.-' '.__.' '.__.' '-._
.' Matt Keenan (mattman) '.
/ Sun Microsystems Ireland \
| E-Mail : Matt Keenan Sun Com |
| mattman iol ie |
| Irish Fantasy League Of American Football |
| http://www.iflaf.com |
| Happy Hookers Golf Society |
| http://www.iol.ie/~mattman/golf/hhgs.htm |
| Phone : +353 1 8199251, Sun Ext : 19251 |
\ .---. .---. /
'._ .' '.''. .''.' '. _.'
'-./ \ / \.-'
] [Thread Prev