Fast location of text within a GtkText




Hi all,

I'm writing an app that includes a code editor that displays a list
of functions in the C code. The user double-clicks a name and the
GtkText widget moves to the line of the declaration and selects the
function name.

First I did

gtk_text_freeze(GTK_TEXT(scratch));
gtk_editable_set_position(GTK_EDITABLE(scratch),there);
gtk_editable_select_region(GTK_EDITABLE(scratch),there,there+length);
gtk_text_thaw(GTK_TEXT(scratch));

but did an ugly scroll-through to the position (which, in a 3000-line
C source file, is horrible)

then I placed

gtk_widget_unmap(scratch_s_container);
/* same code above */
gtk_widget_map(scratch_s_container);

But it still blinks a little. 

Is there a better way ?

.........................................................................
Felipe Paulo Guazzi Bergo  -  guazzibe@dcc.unicamp.br
Undergraduate in Computer Engineering - Unicamp - Campinas - SP - Brazil
  
* Bug (n) Technology originally developed by Microsoft in the 1980s.  *



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