Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to drag to reorder TabItem in a TabFolder?
How to drag to reorder TabItem in a TabFolder? [message #488089] Fri, 25 September 2009 14:26 Go to next message
Frank Du is currently offline Frank DuFriend
Messages: 91
Registered: July 2009
Member
Dear All,

I notice that we can drag to reordering the editor tabs in eclipse. How can we drag and reorder the TabItem objects in a tab folder? What methods or snippets could I look into? Thank you so much!

Best Regards,
Frank Du
Re: How to drag to reorder TabItem in a TabFolder? [message #489111 is a reply to message #488089] Thu, 01 October 2009 14:27 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi,

The eclipse workbench is doing it manually, this isn't something that
TabFolder/CTabFolder comes with for free. The basic steps are:

- they're using a CTabFolder, though a TabFolder could probably be used
instead
- listen for SWT.DragDetect on a tab, remember which tab is being dragged
- create a Tracker, set its rectangle to the tab's bounds, invoke
Tracker.open()
- (I think) listen for SWT.Move on the tracker:
- when it's received and the pointer is within the same tab invoke
Tracker.setBounds(the tab's bounds) to keep the rectangle constant
- when it's received and the pointer is over a different tab invoke
Tracker.setBounds() with the new tab's bounds
- when Tracker.open() returns the drag has finished, so change the tab order
if needed (I'm guessing that this is done by changing the tab titles and
using CTabItem.setConrol() to "reorder" the tabs)

There are some Tracker examples available at
http://www.eclipse.org/swt/snippets#tracker .

HTH,
Grant


"Frank Du" <du.qixing@gmail.com> wrote in message
news:h9ijuv$e26$1@build.eclipse.org...
> Dear All,
>
> I notice that we can drag to reordering the editor tabs in eclipse. How
can we drag and reorder the TabItem objects in a tab folder? What methods or
snippets could I look into? Thank you so much!
>
> Best Regards,
> Frank Du
Previous Topic:TreeViewer: cancelling expansion
Next Topic:How to update view size when new widgets are added?
Goto Forum:
  


Current Time: Thu Apr 25 19:03:02 GMT 2024

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

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

Back to the top