Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Copy Functionality on Windows System #175

Open
leewyatt opened this issue May 1, 2024 · 2 comments
Open

Issue with Copy Functionality on Windows System #175

leewyatt opened this issue May 1, 2024 · 2 comments

Comments

@leewyatt
Copy link

leewyatt commented May 1, 2024

Description:
We have encountered an issue with the copy functionality specifically on the Windows operating system. Despite successful implementation and functionality on macOS, the copy feature fails to work as expected on Windows.

We have added a right-click copy menu to a Label component in our application. While this functionality works well on macOS, allowing users to copy the entire content, it fails to achieve the same on Windows.

Platform: Windows 11
JavaFX: 22.0.1
JAVA: 21
jpro-routing-core: 0.2.10
jpro-webapi:2023.3.3
Environment: Local javafx client, not running in a web browser.

Below is the code snippet used for adding the copy menu to the Label:

    Label testLabel = new Label("Id: 12345");
        testLabel.setOnContextMenuRequested(evt -> {
            ContextMenu contextMenu = testLabel.getContextMenu();
            if (contextMenu == null) {
                MenuItem copyItem = new MenuItem("Copy");
                contextMenu = new ContextMenu(copyItem);
                contextMenu.setOnShown(event -> {
                    Node node = copyItem.getStyleableNode();
                    if (node != null) {
                        CopyUtil.setCopyOnClick(node, "12345");
                    }
                });
                testLabel. setContextMenu(contextMenu);
            }
            contextMenu.show(testLabel, evt.getScreenX(), evt.getScreenY());
        });

Other demo

                Dialog<Void> dialog = new Dialog<>();
                    dialog.setTitle("Test");
                    Button copyButton = new Button("Copy Button");
                    dialog.getDialogPane().setContent(copyButton);
                    CopyUtil.setCopyOnClick(copyButton, "Copy Button Content"); // Works well

                    dialog.getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL);

                    Node node = dialog.getDialogPane().lookupButton(ButtonType.APPLY);
                    CopyUtil.setCopyOnClick(node, "Copy Apply Button Content"); // not working !~

                    dialog.show();
@besidev
Copy link

besidev commented May 6, 2024

Hello @leewyatt.

Thank you for bringing this to our attention. We acknowledge the issue with the copy functionality on Windows 11 and were able to replicate it. We will update you as soon as we have made progress on resolving this issue.

@leewyatt
Copy link
Author

leewyatt commented May 6, 2024

@besidev Thank you very much~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants