OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Adding a mouse listener to Tree

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
yvdinesh
Newbie
Newbie


Joined: 10 May 2012
Posts: 2

PostPosted: Thu May 31, 2012 10:13 pm    Post subject: Adding a mouse listener to Tree Reply with quote

i was able to create a tree and add nodes to it using XMutableTreeNode. Now i would like to listen for double clicks on leaf nodes and then launch a new document based on the node on which the double click was made. It was suggested in the forum that adding mouse listener to the window (XWindow) of the tree will do the required task. But the clicks are registered only when they are made outside the treeview area of XWindow. Can anyody please suggest a way of adding a listener to a tree which would fire up a handler when double click is made on a tree leaf node and also the location where the double click is made should be known.
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Thu May 31, 2012 11:38 pm    Post subject: Reply with quote

Hi,

In most gui toolkit, double clicking on tree node means request to open/close the node. If you want to listen the event, try: http://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/tree/XTreeControl.html#addTreeExpansionListener
If you want to check all double click action on the tree window, use css.awt.XMouseListener and getNodeForLocation or getClosestNodeForLocation methods to find the node for the position action executed, see:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/tree/XTreeControl.html#getClosestNodeForLocation
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group