GtkTextView and GtkScrolledWindow




I have a Textview inside a ScrolledWindow. I set the ScrolledWindow to auto
scroll vertical and never scroll horizontal. I also set the TextView to
wrap with GTK_WRAP_WORD_CHAR. My problem is tha the control will resize
itself horizontally instead of wrapping. It's the same problem as
http://mail.gnome.org/archives/gtk-list/2003-April/msg00278.html

My friend is also having the same problem and he made a recording
illustrating the actual issue:
http://max.vibedev.net/phpirc/problem.htm

Here's my code:

    GtkWidget *window;
    GtkWidget *buffer;
    GtkWidget *vBox;
    GtkWidget *scroll;

    /* Create widgets */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    buffer = gtk_text_view_new();
    vBox = gtk_vbox_new(FALSE, 0);
    scroll = gtk_scrolled_window_new(NULL, NULL);


    /* Set widget properties */
    gtk_window_set_title(GTK_WINDOW(window), "gpad");
    gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(buffer), GTK_WRAP_WORD);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

    /* Pack widgets */
    gtk_container_add(GTK_CONTAINER(window), vBox);

    gtk_box_pack_start(GTK_BOX(vBox), scroll, TRUE, TRUE, 3);


    gtk_container_add(GTK_CONTAINER(scroll), buffer);


    /* Set Callbacks */
    g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(evt_delete), NULL);
    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(evt_destroy),
NULL);
    

    /* Show everything */
    gtk_widget_show_all(window);

--Barret Rennie




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