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

一世执手 提交于 2019-12-12 02:58:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!