[Java-gnome-developer] [TreeView] How to know which DataColumn is used by a TreeViewColumn ?
Brought to you by:
afcowie
From: Mehdi R. <meh...@gm...> - 2006-06-07 20:40:49
|
Hi everyone, I have seen that I didn't CC the mail to the list. Since I'm always stuck I'll appreciate any help ^^ ---------- Forwarded message ---------- From: Mehdi Rabah <meh...@gm...> Date: Jun 6, 2006 9:59 AM Subject: Re: [Java-gnome-developer] [TreeView] How to know which DataColumn is used by a TreeViewColumn ? To: Andrew Cowie <an...@op...> Hi Andrew, > view.addListener(new TreeViewListener() { > public void treeViewEvent(TreeViewEvent event) { > if (event.getType() == TreeViewEvent.Type.ROW_ACTIVATED) { > TreeIter pointer = event.getTreeIter(); > Blah b = (Blah) model.getValue(pointer, > blahObject_DataColumn); In fact I wanted to know how do you choose and get this blah_Object_DataColumn. The Listener that I use is in a class in a different package (it contains a lot of code). I can make the two class aware of each others and write getters, but... > > But to get a value with the ListStore.getValue() I also need the > > DataColumn behind the TreeViewColumn, and I don't know how to get it. > > The bad way to do it is to get ask the TreeViewEvent for the TreeModel > and ask the TreeModel for the DataColumn[], and then for the 5th > DataColumn, say dataColArry[4] or whatever. Which is the method to use to get this array? I didn't find it. A much better way to do it is to have a field for each DataColumn as > private members of your class. Then you've got all the DataColumns > available by name, and you just use them. > In fact my real problem is not to get the columns, it is to know which is the dataColumn behind the TreeViewColumn clicked (it's the title of my mail ^^) I want to know the cell (x,y) clicked - I have the TreeIter (x) and I want the DataColumn (y). I only have the TreeViewColumn (y but for view, not data), how to get the DataColumn behind this ?? |