Still some question about row & column number. (Re: How to get the row & column number of cursor in GtkTextView?)
- From: mili <milimeter 163 com>
- To: gtk-list gnome org
- Cc: Padraig Obriain Sun COM
- Subject: Still some question about row & column number. (Re: How to get the row & column number of cursor in GtkTextView?)
- Date: Sun, 25 Aug 2002 23:49:42 +0000
Hello, Padraig
I tested your code piece. There's still two questions:
1. The resulted rect is a GdkRectangle, it's members x,y is pixel, so how
can I convert it to line number and column number?
2. I should put this code piece into a callback function, but which signal
should I connect the function with? I connected it with "move-cursor" event
of textview or "changed" event of a textbuffer, but it sames that the
returned number is always somewhat later than the key action.
Thank you very much!
Yours,
mili
>I have not tried it but something along these lines ought to work.
>Padraig
>GtkTextIter *cursor_itr;
>GtkTextBuffer *buffer;
>GdkRectangle rect;
>buffer = gtk_text_view_get_buffer (text_view);
>cursor_iter = gtk_text_buffer_get_iter_at_mark (buffer,
>gtk_text_buffer_get_insert (buffer));
>gtk_text_view_get_iter_location (text_view, cursor_iter, &rect);
>> Hello, Everybody
>> Can anybody tell me that how I can get the row & column number of cursor
in
>> GtkTextView? I didn't find any function call to implement this.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]