Re: beginner glade application
| From: | suomaf | Date: | Sun, 03 Sep 2006 05:03:25 +0000 |
| Subject: | Re: beginner glade application | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7216@lists.php.net to get a copy of this message | ||
Thanks Steph,
The simplexml worked out perfectly, got a question about the tree view now..
I can seem to get the boolean toggle to be active, what am i doing wrong?
Also I would like to call back to a function when user clicks the done
toggle.. any ideas?
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/beginner-glade-application-tf2202747.html#a6119253
Sent from the Php - GTK - General forum at Nabble.com.