Problem with Text widget




Hello there,

I have a problem wih the text widget. In a small sample program (attached)
I want to create a text widget and insert text into it. It compiles ok
but traps with:

** ERROR **: file gtktext.c: line 697 (gtk_text_insert):
"GTK_WIDGET_REALIZED(text)"
IOT trap/Abort

I'm using gtk 1.04. What did I made wrong?


Daniel Dorau                                          woodst@cs.tu-berlin.de 
---------------------------------------------------------------------------- 
    "If a train stops at a trainstation, what happens at a workstation?"     
---------------------------------------------------------------------------- 
PGP key available on http://www.cs.tu-berlin.de/~woodst/mypgpkey.html        
or send mail with 'Subject: send pgp key'                                    
fingerprint: 8D 7E 0B 2F 9E 2E 53 38  DB 7B 24 74 2E 8B 2E AE                
#include <gtk/gtk.h>

int main (int argc, char *argv[])
{

    GtkWidget *window;
    GtkWidget *text;

    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_usize( GTK_WIDGET (window), 200, 250);
    gtk_window_set_title(GTK_WINDOW (window), "GTK Entry");
    gtk_signal_connect(GTK_OBJECT (window), "delete_event",
                       (GtkSignalFunc) gtk_exit, NULL);

    text=gtk_text_new(NULL, NULL);
    gtk_text_set_editable(GTK_TEXT(text), TRUE);

    gtk_text_set_point(GTK_TEXT(text), 0);

    gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, "Connect", -1);
    
    gtk_container_add (GTK_CONTAINER (window), text);
    gtk_widget_show (text);

    gtk_widget_show(window);

    gtk_main();
    return(0);
}


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