Results 1 to 4 of 4

Thread: [RESOLVED] Drag and drop to Change Tab order

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Resolved [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.

    Thanks for any Ideas

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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.
    Attached Files Attached Files
    Last edited by brucevde; Nov 19th, 2009 at 04:37 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    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 but only works if all the tabs are visible and unfortunately I can't guarantee that. May have 30 tabs 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

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    15

    Re: Drag and drop to Change Tab order

    So this is what I came up with...
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width