Add a listener to the tree

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
supernam
Posts: 8
Joined: Thu Jan 04, 2018 9:08 am

Add a listener to the tree

Post by supernam »

Hi All

I use java to develop libreoffice extension. I have already drawn a tree view on a dialog, but I need to add a listener on the tree now, by selecting or double-clicking on the bottommost item and performing some actions.
I want to use XSelectionChangeListener to achieve, but I haven't found a way yet to link it to my tree

Object treeControl = xMultiComponentFactory.createInstanceWithContext("com.sun.star.awt.tree.TreeControl", context);
XTreeControl oTree = (XTreeControl)UnoRuntime.queryInterface(XTreeControl.class, treeControl);
oTree.addSelectionChangeListener(new SelectionListener(context, xDialog, oTree));

Is there any way to link? or you have a better way to do. Thank you for all your Suggestions!
Attachments
tree view
tree view
test.png (9.96 KiB) Viewed 963 times
OpenOffice 1.4 on Linux
User avatar
Sébastien C
Posts: 111
Joined: Mon Jan 04, 2010 5:06 pm
Location: Meymac, France

Re: Add a listener to the tree

Post by Sébastien C »

Hello Team,

I do not really know anything about Java... But the API is the API... And if you read Basic, it can help...
I hear just as well that this code snippet is in French. But G****** Tr******* is your friend.

A small way to start in sum...
;)
LibreOffice v. 7.3.2.2, under GNU-Linux Mint and, in virtualization and just for tests, LibreOffice v. 7.3.2.2 an OpenOffice v. 4.1.12 under M$-W 10 :ouch: .
Post Reply