JFoenix icon indicating copy to clipboard operation
JFoenix copied to clipboard

JFXDialog cannot set StackPane to not visible

Open Kool-Koder opened this issue 8 years ago • 5 comments

Basically this is my codes and I already have a StackPane in my fxml file. However, I do not have the permissions to change the codes for the Overlay. Hence if I click on the overlay instead, it will block the everything on my screen. Would there be another way to do this or it would be good if I can "customize" the actions I can do when the overlay is clicked. Thank you!

StackPane.setVisible(true);

            String title = "";

            String content = "Please fill up all fields!";

            JFXDialogLayout dialogContent = new JFXDialogLayout();

            dialogContent.setHeading(new Text(title));

            dialogContent.setBody(new Text(content));

            JFXButton close = new JFXButton("Close");

            close.setButtonType(JFXButton.ButtonType.RAISED);

            close.setStyle("-fx-background-color: #00bfff;");

            dialogContent.setActions(close);

            JFXDialog dialog = new JFXDialog(StackPane, dialogContent, JFXDialog.DialogTransition.BOTTOM);

            close.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent __) {
                    dialog.close();
                    StackPane.setVisible(false);
                }
            });
            dialog.show();

Kool-Koder avatar Jun 19 '18 12:06 Kool-Koder

Not sure I have understood what you are trying to achieve, but you can try using JFXAlert instead of JFXDialog.

jfoenixadmin avatar Jun 19 '18 12:06 jfoenixadmin

Hmmm. Basically it is somthing like this. Link attached below. However, when you click on the overlay, it blocks everything behind it, becuase I loaded my dialog on a StackPane and the StackPane isn't closed when the overlay closes. Thanks! https://camo.githubusercontent.com/bf902c2e387f481b61dd9e494770e1cc236e33eb/687474703a2f2f6a666f656e69782e636f6d2f6769662f6469616c6f672e676966

Kool-Koder avatar Jun 19 '18 12:06 Kool-Koder

Let me try JFXAlert first. Will update again. Thanks!

Kool-Koder avatar Jun 19 '18 12:06 Kool-Koder

Ok JFXAlert works too. It's also easier to implement than JFXDialog which had to be loaded on a StackPane first. Maybe edit this, the JFXDialog on the ReadMe to say it is JFXAlert instead? I was not aware of JFXAlert at first and from what I see JFXDialog seems to be a child of Alert when being used. Cheers!

Kool-Koder avatar Jun 20 '18 03:06 Kool-Koder

Any possibility of an update of this for better clarity? Thanks!

Kool-Koder avatar Jun 21 '18 06:06 Kool-Koder