I want to add a caption to a toolbar button (with an icon) because if the button is grayed out (disabled) the description is not displayed. Caption is also displayed if the button is not enabled...
My problem is that I can't figure out how to enlarge the ToolbarButton field to fit the caption. The caption consists of 3 words and currently only the first word is displayed due to lack of space - relevant code snippet:
toolbarButton = new ToolbarButton();
toolbarButton.setIcon(ImgRes.ICON_PREVIEW);
toolbarButton.setDescription("Preview Button Description");
toolbarButton.setCaption("Preview Button Caption");
toolbarButton.setWidth("100%");
toolbarButton.setEnabled(false);
toolbarButton.addClickListener(e -> onPreviewButtonClicked());
return toolbarButton;
}
Can anyone help me how to solve my problem?