Reputation: 656
i am using Delphi XE7 Firemonkey.
I would like to move around TTabItems of a TTabControl component like modern Webbrowsers do with their tabs.
I found some tutorials but those are for VCL (http://www.swissdelphicenter.com/de/showcode.php?id=963)
What i also found is TChromeTabs (http://www.easy-ip.net/tchrometabs.html) but this was also made for VCL only.
Any help is greatly appreciated
Upvotes: 1
Views: 1278
Reputation: 220
You'll first need to set the DragMode on each of your TTabItems to dmAutomatic. From there a TTabItems OnDragDrop procedure is what you will need to write code for. I've provided a quick snippet on how to get your source and destination TTabItems. What you want to achieve when the "drop" is performed is up to you:
//This is your TTabItem that is being dragged
TTabItem(Data.Source).Index//Index of this object in your TTabControl
//This is your TTabItem that is being "dropped" to
TTabItem(Sender).Index//Index of this object in your TTabControl
Also if you assign this code to the OnDragMove of your TTabItem you will get a blue drag highlight showing what tab this is currently on:
Operation:=TDragOperation.Move;
Hope this helps
Upvotes: 2