GtkTreeView and data Model



Hi all,

It is all about treeview.  How does tree view maps its record with its attached data model?.  I have my own data model where i manipulate the records.
When i add a new record into datamodel, i need to inform to others [treeview]  by gtk_tree_model_row_inserted( mode, path, iter), which emits row-inserted signal.  i need to fill the position of the record into the path which i pass to this API, by gtk_tree_path_append_index (path, position) 

Ie., 

 gtk_tree_path_append_index (path, position);
 gtk_tree_model_row_inserted (model, path, &iter)
             * this API emits row-inserted signal.
             * gets iter from given path by calling _get_iter function of our own.
 

1. Now, does this position value matters to treeview except getting the appropriate record [ to be displayed columns]  from data model to display?

2.  in the row-activated signal handler of treeview, i get only GtkTreePath which has indices and depth.  Assume user clicked on 3rd record, hence  gtk_tree_path_get_indices (path)[0] has the value '2'.  If i want to get the iter for the same,  do i have to depend on this value to retrieve the exact row from the data model?

3.  datamodel -> treeview.
        Assume i have 10 records initially which is listed in the treeview.
        when i append new record [11th]  in the datamodel, how can i make that
         record  to  appear on the second row of treemodel.

--
Regards,
Ramprakash Jelari

"TeamWork is the fuel that allows commom people to attain uncommon results"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]