Home Page
RABiD BUNNY FEVER
K.T.K

  • February 24, 2020, 08:35:35 AM *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Official site launch very soon, hurrah!


Author Topic: Visual Studio IDE Tab Order  (Read 3803 times)

Dakusan

  • Programmer Person
  • Administrator
  • Hero Member
  • *****
  • Posts: 527
    • View Profile
    • Dakusan's Domain
Visual Studio IDE Tab Order
« on: November 18, 2010, 09:23:14 PM »

Original post for Visual Studio IDE Tab Order can be found at https://www.castledragmire.com/Posts/Visual_Studio_IDE_Tab_Order.
Originally posted on: 11/18/10

I’ve been really annoyed for a while by the unintuitive IDE tab ordering in Visual Studio 2005+. When you type [shift+]alt+tab, you don’t get the next/previous tab in the list as would be the OBVIOUS way to do it (which probably all other IDEs do this right). No, it switches between tabs in an arbitrary hidden order related to the last acces order of the tabs.

Searching the internet for a solution to this was pretty fruitless, so I tried to tackle the problem myself. I dug through all the possible structures I could find in the Visual Studio IDE macro explorer, and was unfortunately unable to find where the tab order was kept in a window pane (if it is even accessible to the user). I thought I had the solution at one point, but realized it also just switches tabs in the order they were originally opened :-(. This is the VB macro code I came up with to do at least that, which uses “DTE.ActiveWindow.Document.Collection” for the tab-open order.


    Public Sub TabDirection(ByVal Direction As Integer)
        'Find the index of the current tab
        Dim i As Integer
        Dim Index As Integer
        Dim Count As Integer
        Count = DTE.ActiveWindow.Document.Collection.Count
        For i = 1 To Count
            If DTE.ActiveWindow.Document.Collection.Item(i).ActiveWindow.Equals(DTE.ActiveWindow) Then Index = i
        Next i

        'Determine the new index
        Index = Index + Direction
        If Index > Count Then Index = 1
        If Index = 0 Then Index = Count

        DTE.ActiveWindow.Document.Collection.Item(Index).Activate() 'Activate the next tab in the proper direction
    End Sub

    Public Sub TabForward()
        TabDirection(1)
    End Sub

    Public Sub TabBackward()
        TabDirection(-1)
    End Sub
Logged