GtkEditable forcing of scrolling
- From: "Dugas, Alan" <alan dugas analog com>
- To: gtk-app-devel-list gnome org, gtk-list gnome org
- Subject: GtkEditable forcing of scrolling
- Date: Tue, 15 Aug 2000 11:21:10 -0400
I am trying to implement a string search function. I would like this function
to snap to, as opposed to scrolling to, the text that it matches. However, the
only method I've come up with relies on gtk_editable_set_position() followed by
gtk_adjustment_value_changed() to move to the text matched (see code snippet
below). It seems to me that a third argument to gtk_editable_set_position()
should be available to let the programmer decide if it's more appropriate to
snap to, or scroll to, the new position. Does this make sense to anybody or am
I going about this wrong? Any and all suggestions to implementing a method of
snapping to a new position in a text widget would be greatly appreciated.
Thanks in advance.
-- Stupid Genius
/* Scanning datalog from start to finish 1 character at a time */
for ( ; index <= length_of_text_to_search - length_of_search_string ; index++ )
{
if ( strncmp(search_string, text_to_search++, length_of_search_string)
== 0 )
{
gtk_editable_set_position(GTK_EDITABLE(GTK_TEXT(text)->vadj));
gtk_adjustment_value_changed(GTK_ADJUSTMENT(GTK_TEXT(text)->vadj));
gtk_editable_select_region(GTK_EDITABLE(text), index, index +
length_of_search_string);
index += length_of_search_string;
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]