[gtkmm] How to get the value of selected row?
- From: Akbar <linux cwazy co uk>
- To: gtkmm-main <gtkmm-list gnome org>
- Subject: [gtkmm] How to get the value of selected row?
- Date: Sat, 22 May 2004 17:54:04 +0700
I have Gtk::ListStore that display my wallpapers list like this:
/home/knight/wallpaper/wallpaper11.jpg
/home/knight/wallpaper/wallpaper12.jpg
/home/knight/wallpaper/wallpaper13.jpg
/home/knight/wallpaper/wallpaper14.jpg
My declaration is like this:
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns() {
add(m_col_no);
add(m_col_wallp);
}
Gtk::TreeModelColumn<unsigned int> m_col_no;
Gtk::TreeModelColumn<Glib::ustring> m_col_wallp;
};
ModelColumns m_Columns;
Glib::RefPtr<Gnome::Glade::Xml> m_refGlade;
Gtk::Image *m_Picture;
Gtk::TreeView *m_TreeView;
Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
My m_TreeView is like this:
m_refGlade->get_widget("treeview1", m_TreeView);
if(m_TreeView) {
Glib::ustring filepath =
"/home/knight/.wallpapoz/wallpapoz.xml";
int i = 0;
xmlpp::DomParser parser;
parser.parse_file(filepath);
m_refTreeModel = Gtk::ListStore::create(m_Columns);
m_TreeView->set_model(m_refTreeModel);
xmlpp::Node* pNode;
xmlpp::Node::NodeList list;
xmlpp::Element *el;
xmlpp::TextNode *t;
Gtk::TreeModel::Row row;
if(parser) {
pNode = parser.get_document()->get_root_node();
list = pNode->get_children();
for(xmlpp::Node::NodeList::iterator iter = list.begin();
iter != list.end(); iter++) {
el = dynamic_cast<xmlpp::Element*>(*iter);
if(!el)
continue;
t = el->get_child_text();
if(!t)
continue;
row = *(m_refTreeModel->append());
row[m_Columns.m_col_no] = ++i;
row[m_Columns.m_col_wallp] = t->get_content();
}
m_TreeView->append_column("Workspace", m_Columns.m_col_no);
m_TreeView->append_column("Wallpaper",
m_Columns.m_col_wallp);
}
}
My Image displayer is like this:
m_refGlade->get_widget("picture", m_Picture);
if(m_Picture) {
//This is where I stuck......
//How to get the selected row
//row2 = how.......????
Glib::ustring temp = row2[m_Columns.m_col_wallp];
m_Picture->set(temp);
}
How to get the value of selected row????? When you select for example:
/home/knight/wallpaper/wallpaper14.jpg
My Gtk::Image wallpaper will display the picture in right of
Gtk::ListStore.........
Please, help me????
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]