On Thu, Jul 22, 2004 at 11:07:25AM +1000, Miles Izzo wrote:
> How does one attach a column view to a ComboBox in the same way one
> would for a TreeView? Is this even possible? Shouldn't the ComboBox just
> be (conceptually) a different view for a list?
Hello,
I was searching the list archives for an answer to the same question,
but I only found the question itself, unanswered; so, I'm reiterating
the question :)
I created a model:
Glib::RefPtr<Gtk::ListStore> editorListModel;
class EditorListModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
EditorListModelColumns() { add(name); add(command); }
Gtk::TreeModelColumn<Glib::ustring> name;
Gtk::TreeModelColumn<Glib::ustring> command;
};
EditorListModelColumns editorListModelColumns;
Then I tried to use it in a ComboBox:
editorListModel = Gtk::ListStore::create(editorListModelColumns);
Gtk::TreeModel::Row row = *(editorListModel->append());
row[editorListModelColumns.name] = "mutt";
row[editorListModelColumns.command] = "mutt -f %p";
row = *(editorListModel->append());
row[editorListModelColumns.name] = "other";
row[editorListModelColumns.command] = "sampleeditor --folder %p";
line = Gtk::manage(new Gtk::HBox());
diavbox->pack_start(*line, false, false);
line->pack_start(*manage(new Gtk::Label("Mail editor:")), true, true);
Gtk::ComboBox* cb;
line->pack_start(*manage(cb = new Gtk::ComboBox()), false, false);
cb->pack_start(editorListModelColumns.name);
But the combo box shows up empty.
What am I doing wrong?
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico debian org>
Attachment:
signature.asc
Description: Digital signature