GtkText and colors
- From: Matthias Moeller <mattes ice robin de>
- To: gtk-list redhat com
- Subject: GtkText and colors
- Date: Wed, 24 Jun 1998 17:05:07 +0200 (MEST)
I'd like to have text with different colors in a GtkText widget,
but I always get:
** ERROR **: file gtktext.c: line 2922 (advance_mark_n): "n > 0"
IOT trap/Abort
Here is an example:
------------------------------------------------------------------
#include <gtk/gtk.h>
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *text;
GdkColor blue = {0, 0, 0, 0xc000 };
GdkColor red = {0, 0xc000, 0, 0 };
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
text = gtk_text_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(window), text);
gtk_widget_show(text);
gtk_widget_show(window);
gdk_color_alloc(gtk_widget_get_colormap(text), &blue);
gdk_color_alloc(gtk_widget_get_colormap(text), &red);
gtk_text_insert(GTK_TEXT(text), NULL, &blue, NULL, "blue\n", 5);
gtk_text_insert(GTK_TEXT(text), NULL, &red, NULL, "red\n", 4);
gtk_main ();
return 0;
}
--------------------------------------------------------------------
Is there anything wrong? It works fine, when I use always the samme
color. I am using gtk+-SNAP-980622.tar.gz.
thanks, Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]