Skip to main content



      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 11:19 Go to next message
Eclipse UserFriend
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 17:12] by Moderator

Re: How to implement close function for CTabItem [message #1772738 is a reply to message #1771164] Thu, 14 September 2017 10:08 Go to previous message
Eclipse UserFriend
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 Jul 24 00:09:08 EDT 2025

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

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

Back to the top