Kerry <[EMAIL PROTECTED]> writes:
>
> I've created a text view widget then filled it with text. I'm trying to
> figure out on what line the user clicked. I connected the widget to the
> "button-press-event" signal which gave the callback like I wanted.
> I just can't figure out what line the user clicked on. If I could get
> an iterator, it looks like I could call gtk_text_iter_get_line() function.
> I tried to call gtk_text_buffer_get_insert(), but that always gave me
> the same pointer no matter where I clicked. Can anyone help?
>
get_insert() gets the cursor (insertion point) which won't have moved
when your button_press_event handler is called. If you want to track
where the cursor is, use the mark_set signal on GtkTextBuffer and
check whether the mark which was set is equal to
gtk_text_buffer_get_insert(). (There are marks other than the
insertion point.)
If you don't care about the cursor, you want
gtk_text_view_get_iter_at_location() to find out what text position
the user clicked.
Havoc
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list