Re: [Java-gnome-developer] Question: TreeView & TreeStore and Listeners
Brought to you by:
afcowie
From: Mark H. <mh...@ca...> - 2004-02-03 21:37:18
|
Have you looked at selection for each function? It will execute a method for each selected row of a tree. Iterating over all rows is likely to be quite slow since it uses many jni calls. The selection for each method does not. Gtk 2.3 and hence java-gnome 2.5 will have a much nicer api for doing this - there is a TreeIter[] getSelectedRows() method. On Tue, Feb 03, 2004 at 09:20:28PM +0100, Alex Moreno wrote: > The last days i've been working with trees. > > I've found a way of getting selected rows. I don't know is this is a > correct way of doing it. I'd much appreciate corrections o opinions. The > way which i'm discovering which row is selected is iterating over the > tree until i foun the row. Then, i make all the desired work: > > TreeIter iter = tree.getModel().getFirstIter(); > Boolean exit = Boolean.False; > do{ > //if the searched row is equals the actual row > if (win.tree.getSelection().getSelected(iter)) { > System.out.println(tree.getModel().getValue(iter,win.dataBlock)); > exit = Boolean.TRUE; > > } > }while(tree.getModel().moveIterNext(iter) && !exit.booleanValue())) > > where > DataBlockString dataBlock = new DataBlockString(); > [....] > DataBlock data[] = new DataBlock[] { dataBlock, dataBlock2, ...} > > > As I said, corrections a comments are wellcome :-). > > I wish it can help you. > Greetings > -- > Alex Moreno > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |