How to click a Button of type Menu or ButtonAndMenu in a SapToolbarControl?

135 views Asked by At

I have a button in a SapToolbarControl which is of type ToolBarButtonType.ButtonAndMenu. I found out how to get the ID of the button and I have tried the three methods selectContextButton(), selectButton() and pressContextButton():

selectContextButton() always throws a UnsupportedMethodException with the message

The method SapToolbarControl::SelectContextButton is not supported for SAP.

The other two methods do not throw an exception but do nothing.

How can I make use of toolbar control buttons of type Menu and ButtonAndMenu?

I'm using Silk4J 16.0 Hotfix 2 in Eclipse Luna 4.4.2 with SAPGui 7.30.

1

There are 1 answers

0
Thomas Weller On BEST ANSWER

Clicking the button programmatically does not create the visual effect of opening a context menu, but after clicking the button, the context menu exists from which an item can be selected, e.g. with the method selectContextMenuItemByText().

selectContextMenuItemByText() takes the translated human readable text as a parameter which you can see when pressing the button manually (which creates the visual effect of opening a context menu).