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

color of font in text widget



    I used the following code to highlight the selected text in a text
widget.  It  highlights the text correctly, but after highlighting the
text, if the cursor bar is touching the highlighted text  it continues
to highlight any text that is typed in afterwards.  If the cursor bar is
not touching the highlighted text,  text that is typed in  after
highlighting is in the default color, which is what I want.  Do I have
to use styles to do this or is there
easier way?

Thanks,
Ken


char  *string;
GdkColormap *cmap;
GdkColor colour;

cmap = gdk_colourmap_get_system();
colour.red = 0xffff;
colour.green = 0;
colour.blue = 0;

gtk_editable_copy_clipboard(GTK_EDITABLE(text));
string = text->editable.clipboard_text;
gtk_text_freeze(text);
gtk_editable_delete_selection(GTK_EDITABLE(text));
gtk_text_insert(GTK_TEXT(text), NULL, &colour, NULL, string, -1);
gtk_text_thaw(text);
return;



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