Re: Question about cursor event



Vikram Bartakke wrote:

Can anyone tell me whether is there any event associated with the cursor which will determine the position of cursor with respect to rows and columns in text area? Here is my problem - I need to find out the position of the cursor and find out which row is that on. If I get the row number then i can use that information for my further computation. Also that will help me numbering the rows.

To determine the row and column with GtkTextView widget something like this should probably help:

gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
row = gtk_text_iter_get_line (&iter);
//  '\t' only counts as one character
col = gtk_text_iter_get_line_offset (&iter);

The event you need to connect with is the "key_press_event".

Regard,
Bernhard





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]