Re: Gtk::TreeView



Hi all,

Here's the code snip (from various files):

int main(int argc, char* argv[])
{
    Gtk::Main kit(argc, argv);

    u1::Editor* editor = new u1::Editor();
    editor->Init();

    Gtk::Main::run(editor->GetWindow());

    delete editor;

    return 0;
}

class Editor
{
public:
    Editor()
        : mWindow(NULL)
    { /* void */ }

    ~Editor()
    { delete mWindow; }

    void Init()
    {
       ...

        Glib::RefPtr<Gnome::Glade::Xml> xml = Gnome::Glade::Xml::create("Ui/u1Editor.glade");
        xml->get_widget("u1Window", mWindow);

        ...
        Gtk::TreeView* tree_view = NULL;
        xml->get_widget("u1TreeView", tree_view);

        mTreeModel = Gtk::TreeStore::create(mTreeColumns);
        tree_view->set_model(mTreeModel);

        Gtk::TreeModel::Row row = *(mTreeModel->append());
        row[mTreeColumns.mNodeName] = "Root";

       
tree_view.append_column("Nodes", mTreeColumns.mNodeName );
    }

private:
    void OnQuit() // <-- executed from menu bar
    {
        Gtk::Main::quit();
    }

    class TreeColumns : public Gtk::TreeModel::ColumnRecord
    {
    public:

    ModelColumns()
    { add(mNodeName); }

        Gtk::TreeModelColumn<Glib::ustring> mNodeName;
    };

    TreeColumn mTreeColumns;
    Glib::RefPtr<Gtk::TreeStore> mTreeModel;
   
    Gtk::Window*   mWindow;
   
};



Hope this will make more sense,

Vladimir.

On 12/18/06, Vladimir Đokić <v djokic gmail com > wrote:
Hi all,

Unfortunately, since I'm using binary distribution of gtkmm, I'm unable to step into destruction of Gtk::Window. I've just noticed that I'm using Multithreaded Debug DLL (and don't know how gtkmm on windows was built), so I'll try changing these values... I'll post code later, when I get home (thought the code follows documentation and examples).



Thanks,

Vladimir.

On 12/18/06, Paul Davis < pjdavis engineering uiowa edu> wrote:
Vladimir,

Could you paste the tree view code you're using.

And what is the heap message?  I don't know much about Visual Studio,
so if this is some standard error I can only assume its the equivalent
of a segfault.

Does Visual Studio have a debugger so you can see which line is
causing this error?

Paul

On 12/18/06, Vladimir Đokić < v djokic gmail com> wrote:
> Hi all,
>
> I'm loading everything but the treemodel from the .glade file using
> libglademm. For the creation of model and model data columns I'm using
> example code from the gtkmm book. The window pointer I'm getting is valid
> (points to Gtk::Window data) as well as the treeview pointer (but I'm only
> deleting window, since all other widgets are managed and will be deleted as
> children of window). I also noticed that nodes are showing some bad
> behavior: Only last node is shown as root (top), and the when I click to
> expand the node, nothing shows (empty). The binaries of gtkmm are from
> http://www.pcpm.ucl.ac.be/~gustin/win32_ports/. I've double
> checked the code. When the deletion of window occurs the heap error message
> is issued by the visual studio. In the end, I can cook up small example of
> this - if needed.
>
> Thanks,
>
> Vladimir.
>
> On 12/18/06, Paul Davis < pjdavis engineering uiowa edu> wrote:
> > Vladimir,
> >
> > Could you be a tad bit more specific on the problem you're having?
> >
> > Paul
> >
> >
> >
>
>
>
> --
>
> "There's no room for ideals in this mechanical place. There has to be
> passion. "
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
>



--

"There's no room for ideals in this mechanical place. There has to be passion. "



--
"There's no room for ideals in this mechanical place. There has to be passion. "

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