Re: [gtk-list] Coloring text in a GtkText




Checkout my new textwidget at (gtkextext):
very simple property/tyle API.

http://www.bahnhof.se/~mikeh/linux_software.html

Greats

MikeH

On Sun, 24 Oct 1999, James Moody wrote:

> I'm interested in being able to set the color or font of a given interval
> of text in a GtkText. Am I correct that the following code is the only
> way to do this?
> 
> gtk_text_freeze(text);
> /* Remember position to restore it later */
> pos = gtk_text_get_point(text);
> /* Go to beginning of desired text */
> gtk_text_set_point(text, start);
> /* Get desired text */
> chars = gtk_editable_get_chars(text, start, end);
> /* Then delete it... */
> gtk_editable_delete_text(text, start, end);
> /* ...and reinsert it with the right attributes */
> gtk_text_insert(text, font, fore_color, back_color, chars, end - start);
> /* Restore the position */
> gtk_text_set_point(text, pos);
> gtk_text_thaw(text);
> 
> This seems like quite a kludge. I seem to recall someone mentioning that
> the text widget was one of the areas for improvement in 1.4; is this one
> of the things being improved upon?
> 
> Thanks for any comments or suggestions...
> 
> james
> 
> P.S. I'm aware of the Gtkextext widget mikeh@bahnhof.se has written.
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 

---

Check out my homepage at (under heavy reconstruction): 
http://www.bahnhof.se/~mikeh	

Email: mikeh@bahnhof.se
international Phone 46-44-126995
Sweden Phone: 044-126995
ICQ: Error fix later



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