Re: [Java-gnome-developer] Re: Tree view Expand row signal
Brought to you by:
afcowie
From: Manuel L. <man...@co...> - 2005-04-01 00:07:14
|
I start looking at the source and here is the list of signals map to TreeViewListener, ROW_COLLAPSED is defined and I believe it was intended to be ROW_EXPANDED. This is a easy bug to fix. Meanwhiel I will download the source and fixed myself but I'm still interesting of understanding how signals works in java-gnome. evtMap.initialize(this, TreeViewEvent.Type.COLUMNS_CHANGED); evtMap.initialize(this, TreeViewEvent.Type.EXPAND_COLLAPSE_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.ROW_ACTIVATED); evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); evtMap.initialize(this, TreeViewEvent.Type.ROW_COLLAPSED); evtMap.initialize(this, TreeViewEvent.Type.SELECT_ALL); evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_PARENT); evtMap.initialize(this, TreeViewEvent.Type.SELECT_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.START_INTERACTIVE_SEARCH); evtMap.initialize(this, TreeViewEvent.Type.TOGGLE_CURSOR_ROW); evtMap.initialize(this, TreeViewEvent.Type.UNSELECT_ALL); On Thu, 2005-03-31 at 18:29 -0500, Manuel Ledesma wrote: > I have already tried that and It does not work. This is why? I'm > trying to use the signal. Let me paste my class complete ... > > here is the output of this class: > -- row expanded -- > test-expand-row > -- row collapsed -- > Expanded : false > Expanded : false > > The row is expanded but the class does not receive any event, only > when row is collapsed and somehow get called twice. This was my first > approach before trying the signals. Probably there's a bug and event > should happen when row is expanded. > > > public class DirectoryTree implements TreeViewListener { > /** > * Default constructor > */ > public DirectoryTree(TreeView treeView) { > ... somethig begfore > _treeView.addListener(this); > } > > public TreeIter addNode(TreeIter parent, File file, boolean addImage) > { > TreeIter result = _treeStore.appendRow(parent); > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > result); > return result; > } > > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > System.out.println("test-expand-row"); > return false; > } > > public void treeViewEvent(TreeViewEvent event) { > > System.out.println("Expanded : " + event.isExpand()); > TreeIter current = event.getTreeIter(); > } > } > > > On Thu, 2005-03-31 at 09:56 -0300, Joao Victor wrote: > > > Try using addListener; take a look at the javadoc for TreeViewListener and TreeViewEvent. Here's a > > quick example (i didn't compile it, so forgive me for silly errors): > > > > First, if you have a TreeView you'll need an array of DataColumns defining the columns, and a > > model object. For the example, it'll be this: > > > > ------------------------------------------------------ > > > > //The columns > > DataColumn cols = {new DataColumnString(), new DataColumnString()}; > > > > //the model object > > TreeStore model = new TreeStore(cols); > > > > Now continuing with that code... > > > > _treeView.addListener(this); > > > > //Callback > > public void treeViewEvent(TreeViewEvent e) { > > > > if (e.isExpand()) { > > > > //it's an expand event... > > //let's get the value of the 1st column > > > > String value = model.getValue (e.getTreeIter(), (DataColumnString) cols[1]); > > System.out.println("value: " + value); > > } > > } > > > > ------------------------------------------------------ > > > > > > Cheers, > > J.V. > > > > > > > > --- Manuel Ledesma <man...@co...> wrote: > > > I finally got the callback working, But now If I try to use the handlers > > > the program is quitting. I read that the GObject.getGObjectFromHandle is > > > for internal use but How can I get the row that just expanded. > > > > > > example. > > > > > > // Callback definition ... > > > _treeView.addEventHandler("test-expand-row", "testExpandRow", this, > > > result); > > > > > > > > > // Callback function > > > public boolean testExpandRow(Handle widget, Handle data, Object obj) { > > > GObject test = GObject.getGObjectFromHandle(widget); > > > > > > return true; > > > } > > > > > > > > > On Wed, 2005-03-30 at 23:07 -0500, Manuel Ledesma wrote: > > > > > > > I'm trying to catch the "test-expand-row" signal. I cannot find an > > > > example for Java. > > > > > > > > Can someone illustrate me ? > > > > > > > __________________________________________________ > > Converse com seus amigos em tempo real com o Yahoo! Messenger > > http://br.download.yahoo.com/messenger/ > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by Demarc: > > A global provider of Threat Management Solutions. > > Download our HomeAdmin security software for free today! > > http://www.demarc.com/info/Sentarus/hamr30 > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |