问题
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:
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;
}
来源:https://stackoverflow.com/questions/30998333/how-to-get-the-button-id-of-a-button-in-saptoolbarcontrol