Hi all,
Greetings.
I am implementing a TabPane with different 'user form's in each Tab. And all the tabs are *'closable'*.
If the user enters some data in the form, and tries to close the tab without saving the form , i need to show a confirm dialogue box that the user should go ahead or not.
If he clicks cancel, the tab should not close.
But currently i am searching for a method something like 'setOnClosing' method for tab.
There is only tab.setOnClosed() method, which will call the event
after closing the tab.
Some thing the code is like below.
tab.setOnClosed(new EventHandler<javafx.event.Event>() {
@Override
public void handle(javafx.event.Event e) {
// TODO: Actions to be taken on close of tab.
// Logic to show the confirm dialouge box.
// if YES - close the tab
// if NO - don't close the tab.
}
});
But my logic is executing after closing the tab. (ofcourse, as it is on setOnClosed() ;) ). Can anyone tell me how to get control before closing the tab ?
Thanks in Advance.
Sai Pradeep Dandem.