Closed lg32810 closed 7 months ago
Hi Phil,
with createForm().show()
you will open up a dialog which is blocking the code flow until you click ok. At the moment there is no way to add a close-button next to the ok-button. Do you want to rename "ok" to "close"?
In the FormCloseListener
the method form.isClosedByUser()
returns true if the dialog is closed by "X" or something else. The following code maybe helps to understand:
new UiBooster().createForm("Title")
.addButton("Close window", (button, form) -> {
System.out.println("Close this window");
}
).setID("close")
.setChangeListener((element, value, form) -> {
if (element.getId().equals("close")) {
form.close();
}
})
.setCloseListener(form -> System.out.println("closed by user? " + form.isClosedByUser()))
.show();
isClosedByUser is false if the user clicks "ok", otherwise it's true. I hope it helps you to get a better understanding of UiBooster 😊
Nick
Hello. I could not find a way to add a cancel button that closes the form dialog using FormBuilder neither did I understood why using Form form = show() doesn't let me know if the user closed the dialog or pressed OK (setting a close listener gives me a isClosedByUser always false). How could I do that ? Sorry if my question is stupid. Thanks. Phil