|
Re: How to drag to reorder TabItem in a TabFolder? [message #489111 is a reply to message #488089] |
Thu, 01 October 2009 14:27 |
Grant Gayed 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
|
|
|
Powered by
FUDForum. Page generated in 0.03113 seconds