treeview toggle
| From: | suomaf | Date: | Tue, 05 Sep 2006 01:08:41 +0000 |
| Subject: | treeview toggle | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-7218@lists.php.net to get a copy of this message | ||
Hello all,
Could someone teach me how to set a toggle active and how to call back on
it? I have some code that i am working with. Each time the users done, i
would like to update the treeview, but not sure how to do it.
Thank you so much for all this help
Suomaf
$store = new GtkListStore(Gtk::TYPE_BOOLEAN, Gtk::TYPE_STRING,
Gtk::TYPE_STRING, Gtk::TYPE_STRING);
$treeview=$this->glade->get_widget("treeview1");
$treeview->set_model($store);
$selection = $treeview->get_selection();
$selection->set_mode(Gtk::SELECTION_SINGLE);
//$selection->connect('changed','toDoTreeView_selection_clicked');
//add some data to the data store
foreach ($toDoList->task as $task)
{
$done = false;
$intDone = (int)$task->done;
if ($intDone == 1)
{
$done = true;
}
$toDo = (string)$task->toDo;
$priority = (string)$task->priority;
$date = (string)$task->date;
$store->append(array($done,$toDo,$priority,$date));
}
//sort by year by default
$store->set_sort_column_id(3, Gtk::SORT_ASCENDING);
//the text renderer is used to display text
$cell_renderer = new GtkCellRendererText();
//Create the first column, make it resizable and sortable
$colTask= new GtkTreeViewColumn('Task', $cell_renderer, 'text', 1);
//make the column resizable in width
$colTask->set_resizable(true);
//make it sortable and let it sort after model column 1
$colTask->set_sort_column_id(1);
//add the column to the view
$treeview->append_column($colTask);
//second column, also sortable
$colPriority = new GtkTreeViewColumn('Priority', $cell_renderer,
'text', 2);
$colPriority->set_sort_column_id(2);
$treeview->append_column($colPriority);
//third column
$colDate = new GtkTreeViewColumn('Date', $cell_renderer, 'text',3);
$colDate->set_sort_column_id(3);
$treeview->append_column($colDate);
//we want to display a boolean value, so we can use a check box for
display
$bool_cell_renderer = new GtkCellRendererToggle();
*************** is this the problem?
$bool_cell_renderer->set_property('activatable', true);
$colUsed = new GtkTreeViewColumn('Done', $bool_cell_renderer,
'active', 0);
$colUsed->set_sort_column_id(0);
$treeview->append_column($colUsed);
//-----------------END CODE---------------------------
--
View this message in context: http://www.nabble.com/treeview-toggle-tf2218198.html#a6144428
Sent from the Php - GTK - General forum at Nabble.com.