----- Original Message ---- From: Jason Brisbane <[EMAIL PROTECTED]> To: JAMES SCOTT <[EMAIL PROTECTED]> Sent: Monday, April 23, 2007 11:12:49 AM Subject: Re: Treeview doesnt refresh upon reopenning window
HI, Just a few issues I have been having with that: - gtk_widget_destroy doesnt have a return value and another lookup_widget to check if it exists would generate an error. Comment: lookup_widget() returns a value or null. its this value that's sometimes null and causing the error. consider: ... GtkWidget *widget = NULL; ... widget = lookup_widget(widget, "treeview4"); if () { gtk_widget_destroy(widget); } ... - Every version of a treeview (from the internet, the GTK devhelp, etc) I have found says that the liststore cannot be accessed after it is used to create the model/view. If anyone can let me know how to access a liststore after the listview is populated with data (ie how to access the colums/rows and data therein) I'd change my approach. Comment: These are advanced examples but look at the code in http://GapcMon.Sourceforge.net/ and http://gfhcm.sourceforge.net/ In them one or more treeviews are created and continually updated. Here are documentation links which may shed more light: GTK+2.0 Tutorial http://scentric.net/tutorial/ - the liststore is created when the window is shown and the window's other process can all access the treeview access points and get the data therein. The liststore however, I cannot access for love nor money. Comment: This will return ptr to the associated liststore. GtkTreeModel *gtk_tree_view_get_model(GtkTreeView *tree_view);Then with the gtk_tree_store_{set,remore,insert, insert_before,insert_after,prepend,append} api you can do everything except 'get' a record; use gtk_tree_model_get() to do that. - I'll always know when the database changes - every time I want to issue the _show command. I could create another function called "repopulate_treeview" but since the _show is going to do the exact same thing, at the exact same time, it seemed pointless. Comment: That would work; Just don't destroy and recreate it everytime. Keep a ptr to the treeview and use that ptr to rediscovery the liststore for update operations. If you change the liststore the treeview will automatically refresh. -Also, since the database will be sorted on its fields, I dont want to have to make the program do any sorting. Thus all I need to do is grab the result_set and repopulate the liststore from the top down with each row, which will be presorted. Plus the list will only have approx 30 rows in it. Comment: You can enable the treeview headers to be selectable -- causing a dynamic column sort; plus a treeview can apply a default sort which you control. If anyone can point me in the direction of how to re-write the program to show the treeview's data then I'd be a very happy man! Comment: Look at my apps and others; read the tutorial, and I hope your using "DevHelp" and documentation app installed by default on most distributions; fedora "yum install devhelp". The only issue you may run into is Glade related; I don't know glade well, so someone else will need to help you if you have glade issues. Thanks in advance. <SNIP> -- Regards, Jason Brisbane _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list