0

Tree onClick

asked 2006-03-01 15:17:30 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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>


delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2006-03-01 15:29:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.

link publish delete flag offensive edit

answered 2006-03-01 16:06:06 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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;
}
}

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-03-01 15:17:30 +0800

Seen: 1,400 times

Last updated: Mar 01 '06

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More