Answer the question
In order to leave comments, you need to log in
How to add Box to TreeView?
I don't understand how to add Box to TreeView cell. More precisely, it is added, but not rendered.
How to do it right?
auto treeView = new TreeView();
auto header = new TreeModel::ColumnRecord();
auto iconColumn = new TreeModelColumn<RefPtr<Pixbuf>>();
auto labelColumn = new TreeModelColumn<string>();
auto boxColumn = new TreeModelColumn<RefPtr<Box>>();
header->add(*iconColumn);
header->add(*labelColumn);
header->add(*boxColumn);
treeStore = TreeStore::create(*header);
treeView->set_model(treeStore);
auto row = *(treeStore->append());
auto icon = Gdk::Pixbuf::create_from_file(Icons::getPath("icon-18"));
auto text = "name 1";
auto box = RefPtr<Box>(new Box());
box->pack_start(*new Image(Icons::getPath("icon-18")));
box->pack_start(*new Gtk::Label("name 2"));
box->show_all();
row[*iconColumn] = icon;
row[*labelColumn] = text;
row[*boxColumn] = box;
treeView->append_column("icon", *iconColumn);
treeView->append_column("label", *labelColumn);
treeView->append_column("box", *boxColumn);
treeView->show_all_children();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question