Re: Problem swapping GtkScrolledWindow contents on the fly



From the assertions it *looks* like glade_xml_get_widget() is
returning NULL for "mainvbox".

Cheers,
       -Tristan

On Thu, Dec 24, 2009 at 11:29 AM, Andrew Wood <ajwood theiet org> wrote:
The following function is called to display a vbox, which is read from a
glade file, in a scrollview.

If the  vbox or 'page' hasnt been displayed before then
generalpageinitialised will be false.

There are other 'pages' in the app which are vboxes read from a glade file
in the same way. The app always shows the vbox called rightpanevbox and it
swaps this variable to point to the appropriate one read from glade.

The first time the function is called the page shows perfectly. The second
time I get errors such as:

Showing General Page
doing gtk_container_remove

(a.out:21153): Gtk-CRITICAL **: gtk_container_remove: assertion
`GTK_IS_WIDGET (widget)' failed
done gtk_container_remove


(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in cast to
`GtkWidget'

(a.out:21153): Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport:
assertion `GTK_IS_WIDGET (child)' failed


(a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in cast to
`GtkWidget'

(a.out:21153): Gtk-CRITICAL **: gtk_widget_show_all: assertion
`GTK_IS_WIDGET (widget)' failed


I cant understand why its happy the first time its called but not on
subsequent calls. If anyone can enlighten me Id be very grateful

Thanks


void showGeneralPage()
{
  g_print("Showing General Page\n");
  if (generalpageinitialised==false)
  {
      generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
      glade_xml_signal_autoconnect(generalpagexml);
      generalpageinitialised=true;
        }
    if (pagedisplayed!="INIT")
  {
     //a previous page is shown so we need to remove it first
      g_print("doing gtk_container_remove\n");
      gtk_container_remove (GTK_CONTAINER
(rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));
      g_print("done gtk_container_remove\n");
  }
  rightpanevbox=generalpage; //make generalpage the one currently on show
  pagedisplayed = "General";


 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(rightpanevbox));
  gtk_widget_show_all(GTK_WIDGET(rightpanevbox));
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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