Two TreeViews with different TreeModels in one Window



I need help please with treeview problems.
I need to show two TreeViews with different TreeModels in one window.

My starting point is the example at
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-treeview-examples.html

If I add a second treeview with its own ModelColumns to the .h file then, even without making the corresponding additions to the .cc file, the window fails to display.  There are no compilation errors.

The problem lines seem to be those I have marked //1 through //4 in the following header file listing.

Many thanks for any advice.

David

#ifndef EXAMPLEWINDOW_H_
#define EXAMPLEWINDOW_H_

#include <gtkmm.h>

class ExampleWindow : public Gtk::Window
    {
    public:
        ExampleWindow();
        virtual ~ExampleWindow();
        void Show();

    protected:
        //Signal handlers:
        virtual void on_button_quit();
        virtual void on_treeview_row_activated(
            const Gtk::TreeModel::Path& path,
            Gtk::TreeViewColumn* column);
  
        //Tree model columns:
        class ModelColumns : public Gtk::TreeModel::ColumnRecord
            {
            public:
                ModelColumns()
                    {
                    add(m_col_id);
                    add(m_col_name);
                    }

                Gtk::TreeModelColumn<int> m_col_id;
                Gtk::TreeModelColumn<Glib::ustring> m_col_name;
            };

        ModelColumns m_Columns;
        class ModelColumnsB : public Gtk::TreeModel::ColumnRecord
            {
            public:
                ModelColumnsB()
                    {
                    add(m_colB_id);
                    add(m_colB_name);
                    }

                Gtk::TreeModelColumn<int> m_colB_id;
                Gtk::TreeModelColumn<Glib::ustring> m_colB_name;
            };

        ModelColumnsB m_ColumnsB;//1

        //Child widgets:
        Gtk::VBox m_VBox;

        Gtk::ScrolledWindow m_ScrolledWindow;
        Gtk::TreeView m_TreeView;
        Glib::RefPtr<Gtk::TreeStore> m_refTreeModel;

        Gtk::ScrolledWindow m_ScrolledWindowB; //2       
        Gtk::TreeView m_TreeViewB; //3       
        Glib::RefPtr<Gtk::TreeStore> m_refTreeModelB;//4

        Gtk::HButtonBox m_ButtonBox;
        Gtk::Button m_Button_Quit;
    };
#endif /*EXAMPLEWINDOW_H_*/



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