How to get the button ID of a button in SapToolbarControl?

591 views Asked by At

I have a SapToolbarControl (MicroFocus) and I want to press a button of that toolbar.

However, any of the methods selectButton(), selectContextButton() or pressContextButton() require a parameter called id of type String.

I was unable to find out where to get the ID from.

I am using Silk4J 16 Hotfix 2 in Eclipse Luna. This also happens in Silk4J 15.5.

1

There are 1 answers

0
Thomas Weller On BEST ANSWER

The SAP automation API provides a method called GetButtonId which is not implemented by Silk4J. The method takes the position of the button within the toolbar as input.

You can invoke the method yourself with the following code:

public String getButtonId(SapToolbarControl toolbar, int position)
{
    Object[] params = new Object[1];
    params[0] = position;
    Object buttonId = toolbar.invoke("GetButtonId", params);
    return (String) buttonId;
}