cancel
Showing results for 
Search instead for 
Did you mean: 

onAction event and right click on a tree element

Former Member
0 Kudos

hello people,

is it possible to release an onAction event by right click on a tree element?

My problem is that I want interact with an object in a tree element out of an context menu, without selecting that element first by a left click.

When I try in interact that way, I get an exception, because there is no currentContextElement.

So is it possible to get that element I clicked with right and set the current selection on that element?

thanks for any help

tino

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

In releases <= NW04s, there exists no context menu (will come later)

But you have "static" menus at tree node types which are also opened via right-click. You don't have to select the node before the right-click.

How to use?

Add some menu to TreeNodeType in view designer (Outline view -> Right-click -> Insert Menu).

For each menu item, define parameter mapping from event parameter "nodeElement" to action parameter, e.g. "treeNode" of type IWDNodeElement.

This can also be done via Outline view (in newer IDE). Otherwise you have to write a piece of code in wdDoModifyView():

if (firstTime)
{
  IWDMenuActionItem item = (IWDMenuActionItem) view.getElement("ActionItemID");
  item.mappingOfOnAction().addSourceMapping("nodeElement", "treeNode");
}

In action handler cast parameter "treeNode" to specific node element type of tree node type's data source. This will give you the context element corresponding to the tree node where the menu was opened.

Armin