On Wed, Feb 28, 2007 at 11:32:58PM +0100, thom_schu@xxxxxx wrote: > I changed my Glib::ustring::insert method to > text.insert(position++, 1, gdk_keyval_to_unicode(event->keyval)); > and called the PangoLayout::index_to_pos() with the byte-position, > instead of the character position. So far it works. > Unfortunately Glib::ustring doesnt support methods to convert > a byte-to-character and character-to-byte position. :-( The C API has g_utf8_offset_to_pointer() and g_utf8_pointer_to_offset(). > I would like to integrate input methods, but dont have any idea. > Isnt there a small example for that ? The only working examples I know about are in Gtk+ code (e.g. in GtkEntry). I didn't study it enough to give a comprehensive explanation (also, the most complex thing I use myself is the composition of accents and letters to accented letters -- but even this would not work with your approach). You can get the basic idea by glancing over gtkentry.c. The text to enter is not obtained from "key-press-event"s at all, instead it is received in input method "commit" callback. But there's more: the surrounding stuff, LTR vs. RTL, knowing when to reset the im context, ... I doubt one can get all this right without actually using it himself. Therefore I would create a new text widget by modification of an existing one (it it's possible legally) instead of writing it from scratch. Yeti -- Whatever. _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list