Re: Two warnings when creating a TreeStore



Murray Cumming wrote:
On Tue, 2007-09-11 at 17:17 -0400, Paul Davis wrote:
On Tue, 2007-09-11 at 17:03 -0400, Jos�lburquerque wrote:

Any ideas?  Thanks so much.
What is an "Element" ? Gtkmm can't handle arbitary types as column
template args.

Actually, it can, I think.


I did read in the programming guide that it can.

 It can handle pointers and all built-in scalar types, as
well as std::string and Glib::ustring, plus a few others.

I think the problem here is indeed that you are using a static instance
somewhere.


Your comments are much appreciated, thank you. :-) When you say a static instance, are you referring to one of my "Element" derived classes or are you referring to the TreeModelColumnRecord class I've defined (columns) which *is* static within my "DVDProject" class? Would changing the "staticity" of this static member help?

On another note, can I pick your brain a bit more and ask you a little about how gtkmm handles inheritance? As I had mentioned, all the objects I work with are derived from a base class (which I call "Element") with a virtual method called "getName()" designed to return a string naming the object I'm dealing with (so I can "render" the string in the TreeView). I've overridden the method in various derived classes, but in a rendering method (which I set up with the TreeView::Column::set_cell_data_func()) when I call the object's "getName()" method, it's overridden method is not called, but instead the base class method is called. Am I missing something? If it helps the short TreeView initialization and the rendering method I use follows. I'd really appreciate any insights. Thanks for your comments.

-Jose

MainWindow::MainWindow() {
   ...
   TreeView::Column* outlineColumn = manage(new TreeView::Column("Outline",
                              DVDProject::columns.element));
CellRenderer* renderer = outlineColumn->get_first_cell_renderer();
   outlineColumn->set_cell_data_func(*renderer,
                         sigc::mem_fun(*this, &MainWindow::renderElement));
outlineTreeView.append_column(*outlineColumn);
   ...
   show_all_children();
}

void MainWindow::renderElement(CellRenderer* renderer,
const TreeModel::iterator& iter) {
CellRendererText* textRenderer = dynamic_cast<CellRendererText*>(renderer);
   const Element& e = (*iter)[DVDProject::columns.element];
   textRenderer->property_text() = e.getName();
}





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