-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3604883
By: nobody
Is it possible to extend the Tree's onclick method?
In addition to having the tree expand and collapse when clicked, I want to add in some other behavior. I implemented the following but I do not see the onClick method being invoked when the treeitem is clicked.
public class MyTree extends Tree {
public void onClick() {
System.out.println("hello world I am a tree click");
}
}
Here is my Tree control:
<window title="Data Component Tree View" border="normal">
<tree id="tree" use="MyTree" rows="20">
<treecols>
<treecol label="Data Component"/>
</treecols>
</tree>
</window>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3604910
By: nobody
No, you cannot. Components that support onClick is listed at User Guide, pp 76.
For tree events, you could listen onSelect.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3604970
By: nobody
Thank you. I got the onSelect extended working. I also added an EventListener for the TreeItem to listen on onOpen events.
public void onSelect() {
System.out.println("tree onSelect method...");
}
...
treeItem.addEventListener("onOpen", new TreeEventListener());
import com.potix.zk.ui.event.Event;
import com.potix.zk.ui.event.EventListener;
/**
*
*/
public class TreeEventListener implements EventListener {
public TreeEventListener() {
}
public void onEvent(Event event) {
System.out.println(event.getName() + " xxxxx hello world I am a tree click");
}
public boolean isAsap() {
return false;
}
}
Asked: 2006-03-01 15:17:30 +0800
Seen: 1,400 times
Last updated: Mar 01 '06