Re: vbox in list TreeView

From: Date: Tue, 10 Apr 2007 06:26:30 +0000
Subject: Re: vbox in list TreeView
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7781@lists.php.net to get a copy of this message
Hello, Based on the link you provided, you might try a GtkIconView instead of a GtkTreeView. The rich list box in your link looks like a select list with only one item selectable and an icon-text pair for each row. Try something like: $icon_view = new GtkIconView(); $model = new GtkListStore(GdkPixbuf::gtype, Gtk::TYPE_STRING); //icon-text pair $icon_view->set_model($model); $icon_view->set_pixbuf_column(0); $icon_view->set_text_column(1); $icon_view->set_columns(1); //one column, like a select list $icon_view->set_selection_mode(Gtk::SELECTION_BROWSE); //exactly one item selected $icon_view->set_orientation(Gtk::ORIENTATION_HORIZONTAL); //text to right of icon You can then use the model to add/remove rows or see which is selected. Adding rows: $model = $icon_view->get_model(); $model->append(array(GdkPixbuf::new_from_file('image.png'),'image.png')); $model->append(array(GdkPixbuf::new_from_file('image2.png'),'image2.png')); Finding the selected information: $model = $icon_view->get_model(); $selected = $icon_view->get_selected_items(); if(empty($selected)) print("Nothing selected."); else { $iter = $model->get_iter($selected[0]); //only one path by selection mode, get iterator for it $text = $model->get_value($iter,1); //get the text column (1) value print("Image $text selected."); } The GtkIconView still uses CellRenderer subclasses, but you don't have to set them up yourself. Hope that's what you're looking for. -Jake >Hi, > >Someone know issue to insert vbox in treeview ? > >I would like make someone like that (without GtkCellRendererPixbuf to insert >lot of widgets) : >http://developer.mozilla.org/en/docs/Image:Controlguide-richlistbox.png > >Thanks, > >Thomas. >Gul project / gul.redsofa.net

« previous php.gtk.general (#7781) next »