Re: Problem swapping GtkScrolledWindow contents on the fly



On Wed, Jan 13, 2010 at 10:33:07AM +0000, Andrew Wood wrote:
Still getting strange results with this.

Ive posted a skeleton app at  www.simple.org/TCSAdminGTK.tar     which  
is a single source file which can be comiled with g++ ./main.cpp  
`pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0 libglade-2.0`

When you click one of the options on the left the contents changes on  
the right. At present only 'General' and 'Calls' are implemented. As you  
can see the first time you click one of these the widgets show correctly  
but the second time you click it they don't but you get no error on the  
console either.


The guts of the issue are contained in the functions showGeneralPage()  
and showCallsPage()


The closest explaination Ive been able to find is that the call to

gtk_container_remove (GTK_CONTAINER  
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));

is deleting the widgets as well as just removing them from the  
container, but theres no error to suggest this, and I would have thought  
the calls to gtk_widget_ref(callspage) or gtk_widget_ref(generalpage)  
would have prevented this.

There must be something very simple Im overlooking here. Any ideas?

Indeed, the children get removed from the container when the page is
removed so the next time it's show it's empty.  This is somehow caused
by the widget being constructed by libglade because if you construct
it manually, it does no happen.

I can't help with libglade and it's already obsolete...

BTW please don't use things like gtk_widget_ref() that were deprectated
many years ago.

Yeti




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