Specifies the tab order of a layout.
Supported platforms: Windows only
Read-only: No
Type: Long
The tab order for the layout.
This property controls the order in which the layouts are displayed in the tab control. The tab order should be unique and sequential among all layouts in the database.
The model space tab must have a tab order of zero (0). Paper space tabs must have a tab order of 1 or greater.
VBA:
Sub Example_TabOrder() ' This example creates two new Layouts, sets the TabOrder of the Layouts to be ' in alphabetic order, and displays a list of Layouts in the order they appear ' in the tabs. Dim Layout1 As ACADLayout, Layout2 As ACADLayout Dim SortLayoutRight As ACADLayout, SortLayoutLeft As ACADLayout Dim SortIt As New Collection Dim TabCount As Long, SortCount As Long, TabOrder As Long Dim TabName As String, SortText As String, msg As String Dim tempLayout As ACADLayout Dim AddedTab As Boolean ' Create new Layouts On Error Resume Next Set Layout1 = ThisDrawing.Layouts.Add("Z VIEW") Set Layout2 = ThisDrawing.Layouts.Add("A VIEW") On Error GoTo 0 ' Alphabetize internally For TabCount = 0 To (ThisDrawing.Layouts.count - 1) AddedTab = False TabName = ThisDrawing.Layouts(TabCount).name If TabName = "Model" Then GoTo SKIP ' Skip modelspace If SortIt.count = 0 Then SortIt.Add TabName ' Add to beginning of list Else For SortCount = 1 To SortIt.count ' Add to list by string SortText = SortIt(SortCount) If StrComp(TabName, SortText, vbTextCompare) = -1 Then If SortCount = 1 Then SortIt.Add TabName ' Add as first item Else SortIt.Add TabName, , SortCount ' Add as previous item End If AddedTab = True Exit For End If Next If Not (AddedTab) Then SortIt.Add TabName, , , SortIt.count ' Add if we haven't yet End If SKIP: Next ' Write new ACAD tab order For SortCount = 1 To SortIt.count Set tempLayout = ThisDrawing.Layouts(SortIt(SortCount)) tempLayout.TabOrder = SortCount Next '------------------------------- ' Read and display New Tab Order '------------------------------- msg = "The tab order is now set to: " & vbCrLf & vbCrLf For TabCount = 0 To (ThisDrawing.Layouts.count - 1) TabName = ThisDrawing.Layouts(TabCount).name If TabName = "Model" Then GoTo SKIP2 ' Don't show modelspace TabOrder = ThisDrawing.Layouts(TabCount).TabOrder msg = msg & "(" & TabOrder & ")" & vbTab & TabName & vbCrLf SKIP2: Next MsgBox msg, vbInformation End Sub
Visual LISP:
(vl-load-com) (defun c:Example_TabOrder() ;; This example creates two new Layouts, sets the TabOrder of the Layouts to be ;; in alphabetic order, and displays a list of Layouts in the order they appear ;; in the tabs. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create new Layouts (setq Layout1 (vla-Add (vla-get-Layouts doc) "Z VIEW")) (setq Layout2 (vla-Add (vla-get-Layouts doc) "A VIEW")) (setq SortIt (list) TabCount 0) ;; Alphabetize internally (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount) (setq AddedTab :vlax-false) (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount))) (if (/= (strcase TabName) "MODEL") ;; Skip modelspace (progn (setq SortIt (append SortIt (list TabName))) ;; Add to beginning of list ) ) (setq TabCount (1+ TabCount)) ) ;; Sort layout names (setq SortIt (acad_strlsort SortIt) SortCount 1) ;; Update tab order (foreach name SortIt (progn (setq tempLayout (vla-Item (vla-get-Layouts doc) name)) (vla-put-TabOrder tempLayout SortCount) (setq SortCount (1+ SortCount)) ) ) ;;------------------------------- ;; Read and display New Tab Order ;;------------------------------- (setq msg "The tab order is now set to: \n" TabCount 0) (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount) (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount))) (if (/= (strcase TabName) "MODEL") ;; Skip modelspace (progn (setq TabOrder (vla-get-TabOrder (vla-Item (vla-get-Layouts doc) TabCount))) (setq msg (strcat msg "(" (itoa TabOrder) ") " TabName "\n")) ) ) (setq TabCount (1+ TabCount)) ) (alert msg) )