Re: Gtk 1.3.x text widget question
- From: Havoc Pennington <hp redhat com>
- To: Kerry <needles industrialmusic com>
- Cc: gtk-list gnome org
- Subject: Re: Gtk 1.3.x text widget question
- Date: 15 Jun 2001 00:16:07 -0400
Kerry <needles industrialmusic com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]