[RESOLVED] Drag and drop to Change Tab order
I need to allow the user to change the order their tabs appear. I'm currently using a TabStrip. The Tabs are loaded from a config file. All users at some point need all tabs but some users use, say, t1, t5 and t8 most of the time while others use t2, t4, t1 most of the time and so want those taps to be left most.
Rather than maintaining a different config for each user I'd like to allow them to just drag the tabs into the order they want. I'll save that order in a user config file.
I was hoping to just adapt my code that changes msflexgrid column order (originally adapted from http://www.xtremevbtalk.com/showthread.php?t=235380) but the TabStrip dosn't give me MouseTab like MSFlexGrid.MouseCol. This is especially frustrating since it has HotTracking so something must know what tab my mouse is on. I have the same problem with sstab.
I'm left with trying to imitate a tab control using a frame and array of label or button controls but am hopeful that someone here has a better idea.:thumb:
Thanks for any Ideas :bigyello:
2 Attachment(s)
Re: Drag and drop to Change Tab order
Regarding the SSTab.
You cannot move design time controls located directly on Tabs from one tab to another at run time. It is however possible if you
Use a Frame or PictureBox control array and place one on each tab. Place the Tab's controls onto the Frame/PictureBox instead of directly onto the SSTab control.
Create a procedure that simply iterates through all the controls on the Form and changes the Container property as appropriate. See sample frm/frx file.
To create your own "MouseTab", first set the SSTab1.TabMaxWidth property. Then in one of the Mouse events use something like
Code:
Private Sub SSTab1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lngMouseTab As Long
If Y < SSTab1.TabHeight Then
lngMouseTab = X \ SSTab1.TabMaxWidth
End If
End Sub
The above will only work if there is 1 Row of tabs located at the top.
Re: Drag and drop to Change Tab order
Thanks Very much brucevde,
My user controls are all in a Frame and I rebuild the frame on TabStrip_Click. I inharited this app and just figured out why the original programmer used TabStrip and not sstab. The Label names for each tab can be rather long and there can be a lot of tabs. Your Idea is perfect :thumb: but only works if all the tabs are visible and unfortunately I can't guarantee that. May have 30 tabs :confused: but only see 5 and then the little <> at the end to move them around.
That said the tab control probably isn't the best option for the type of data I'm showing. I think I'm going to go to a dynamic group of drop down boxes. with everything that starts with AA on one box AB in a second AC in another and so on.
Thanks again for your help I may be able to use it another time
1 Attachment(s)
Re: Drag and drop to Change Tab order
So this is what I came up with...