Scrolled text



I'm trying to add a scrolled window to a window. The scrolled window should have a vbox with labels, and I want to add text labels as the program is used.

I have the scrolled window appearing, but I can't scroll it and I'm unable to get a label to show up. In the code below I've tried to create the scrolled window, put it in a vbox belonging to the main window, add a second vbox with viewport and add a label.

When I run it, I don't see anything in the scrolled window. What should I do to fix this?

    scrolled_window = gtk_scrolled_window_new(NULL, NULL);
    window_message_vbox = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox1), scrolled_window, FALSE,
      FALSE, 0);
    gtk_widget_show(scrolled_window);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
      GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
      window_message_vbox);
    current_label = gtk_label_new("Test message 1");
    gtk_widget_show(current_label);
    gtk_box_pack_start(GTK_BOX(window_message_vbox), current_label, FALSE,
       FALSE, 0);
    gtk_widget_show(scrolled_window);
    window_message_vbox = gtk_vbox_new(FALSE, 0);



--
++ Jonathan Hayward, jonathan hayward pobox com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (gmail.com) account, please tell me!

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