ClipboardTrigger is a facet which allows a user to copy text from a field to the clipboard. It is defined in the facets element of the screen XML descriptor and has the following attributes:

  • input - identifier of a text field, must be a subclass of TextInputField like TextField, TextArea and so on.

  • button - identifier of a Button which triggers the copying.

For example:

<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd" ...>
        <clipboardTrigger id="clipper" button="clipBtn" input="textArea"/>
    <layout expand="textArea" spacing="true">
        <textArea id="textArea" width="100%"/>
        <button id="clipBtn" caption="Clip text"/>
private Notifications notifications;

private void onClipBtnClick(Button.ClickEvent event) {
    notifications.create().withCaption("Copied to clipboard").show();