Gtk::TreeView in Gtk::Paned make error? (original) (raw)

I have sample code for TreeView from this page examples/book/treeview/tree · master · GNOME / gtkmm-documentation · GitLab

and I insert this tree to paned object from this sample examples/book/paned · master · GNOME / gtkmm-documentation · GitLab
and after running I got this error code:

**
Gtk:ERROR:…/…/…/gtk/gtkwidget.c:2500:gtk_widget_root: assertion failed: (priv->root == NULL)
Bail out! Gtk:ERROR:…/…/…/gtk/gtkwidget.c:2500:gtk_widget_root: assertion failed: (priv->root == NULL)
Aborted

What is wrong? Thanks

Peta-T June 14, 2025, 5:39pm 2

on the end it work but I had to use direct class Gtk::TreeView

type or paste code here
class MessagesList: public Gtk::ScrolledWindow
{
public:
  MessagesList();
  ~MessagesList() override;

protected:
  // Signal handlers:
  void on_setup_message(const Glib::RefPtr<Gtk::ListItem>& list_item);
  void on_bind_message(const Glib::RefPtr<Gtk::ListItem>& list_item);

  Glib::RefPtr<Gtk::StringList> m_refStringList; // The List Model.
  Gtk::TreeView m_ListView; // The List View
...

kjellahl (Kjell Ahlstedt) June 16, 2025, 2:33pm 3

Have you just taken

class ExampleWindow : public Gtk::Window

from examples/book/treeview/tree and added it to examples/book/paned with
m_VPaned.set_start_child() or m_VPaned.set_end_child()?
Probably that won’t work. Gtk::Window is a toplevel widget. It’s not suitable for
inserting into another widget. A Gtk::ScrolledWindow is okay. Despite its name
a Gtk::ScrolledWindow is not a Gtk::Window.