Re: [gtk2] - treeview



On Mon, Dec 09, 2002 at 04:22:12PM +0000, Andreas Volz wrote:

I looked at the treeview example, but I didn't understood how to get the
current column and display his data. 

Please forgive me for "thinking in Python" in my reply.

If you want the column where the mouse pointer is, you can use
TreeView.get_pointer() to get the pointer pos relative to the TreeView and
then use TreeView.get_path_at_pos().  This will net you a Path, a
TreeViewColumn, and cell_x and cell_y, the position relative to the cell.
Now here's where I'm not quite sure I understand the intentions of the
designers since TreeModel.get_value() requires a numeric column.  I see 2
ways to get the column number: do a linear search through the columns gotten
with TreeView.get_columns() for a match to the TreeViewColumn retrieved above,
or retrieve a column number attached at creation time with
TreeViewColumn.set_data().  The former is the one to use if your going to be
changing the column order I suppose.  I currently use the latter method.
Maybe I'm missing something, though.  

Oh, the other case is if you want the column where the text cursor is.  You
can use TreeView.get_cursor() for this.  Again, this returns a Path and a
TreeViewColumn. 

Dave Cook



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