tree widget badly displayed
- From: Roberto <alameda ibm net>
- To: GTK list <gtk-list redhat com>
- Subject: tree widget badly displayed
- Date: Sun, 18 Apr 1999 19:08:12 +0200
Hi!
I have found a problem in the tree widget in GTK+ 1.2.2
It can be reproduced with the attached program.
If you push the button, the tree window will appear, but the
tree is badly drawn. Close the window, open it again, and voila!, the
tree
is OK.
Is it a bug? Can it be fixed? Is there a workaround other than
displaying the tree window just after creation?
Regards,
Roberto
/*
This file demonstrates the problem with trees
Push the button, and the window will appear, but the lines will
be wrong. Close the tree window, open it a second time, and they are fine
The lines are also right if the line gtk_widget_show(errwindow) in myline() is uncommented
It seems that the window has to be shown when created for it to display properly
*/
#include <gtk/gtk.h>
GtkWidget *errwindow;
mytree()
{
GtkWidget *scrolled_win, *tree, *subtree, *item;
GtkTreeItem *font;
errwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(errwindow), "messages");
gtk_signal_connect_object(GTK_OBJECT(errwindow), "delete_event",
GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
GTK_OBJECT(errwindow));
scrolled_win = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_win),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_usize(scrolled_win, 400, 300);
gtk_container_add(GTK_CONTAINER(errwindow), scrolled_win);
gtk_widget_show(scrolled_win);
tree = gtk_tree_new();
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_win), tree);
gtk_widget_show(tree);
font = GTK_TREE_ITEM(gtk_tree_item_new_with_label("item"));
gtk_tree_append(GTK_TREE(tree), GTK_WIDGET(font));
gtk_widget_show(GTK_WIDGET(font));
subtree = gtk_tree_new();
gtk_tree_item_set_subtree(font, subtree);
item = gtk_tree_item_new_with_label("message");
gtk_tree_append(GTK_TREE(GTK_TREE_ITEM_SUBTREE(font)), item);
gtk_widget_show(item);
/* gtk_widget_show(errwindow); */ /* uncomment and it will work */
}
int main (int argc, char *argv[])
{
GtkWidget *window, *button;
gtk_init (&argc, &argv);
mytree();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
button = gtk_button_new_with_label("Show tree");
gtk_container_add(GTK_CONTAINER(window), button);
gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_show), GTK_OBJECT(errwindow));
gtk_widget_show(button);
gtk_widget_show(window);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]