Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to implement close function for CTabItem(Need to pop up window to give user choice to close or cancel)
How to implement close function for CTabItem [message #1771164] Tue, 22 August 2017 15:19 Go to next message
Gary Shi is currently offline Gary ShiFriend
Messages: 20
Registered: July 2013
Junior Member
I have one stand alone Java SWT application and CTabFolder and CTabItem items were used. When user try to close one CTabItem by click on "X" icon beside CTabItem title, I want to pop up one window and give user option to cancel this action or continue to close it. I implement this function by adding below code, but we can't cancel this action and only can do some thing before it close. How to cancel this "close action", user select cancel in pop up window. Thanks. Gary

folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
	@Override
		public void close (CTabFolderEvent event) {
		    System.out.println(" Open popup window, and do some thing");
                    System.out.println("can not cancel this action ? ");
       }
}

[Updated on: Tue, 22 August 2017 21:12]

Report message to a moderator

Re: How to implement close function for CTabItem [message #1772738 is a reply to message #1771164] Thu, 14 September 2017 14:08 Go to previous message
Gary Shi is currently offline Gary ShiFriend
Messages: 20
Registered: July 2013
Junior Member
This issue was fixed by below code
boolean res = MyDialog.showConfirmdialog("Are you sure you want to close it ! You will lose the changed data if this page has been modified.");
if (res) {
	System.out.println("yes was selected and this page was closed");
}else{
	event.doit = false;
	System.out.println("No was selected and this event was cancelled");
	return;
}
Previous Topic:SWT browser issue
Next Topic:Drawing issue when using RDP
Goto Forum:
  


Current Time: Thu Mar 28 18:54:53 GMT 2024

Powered by FUDForum. Page generated in 0.02226 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top