TabOrder プロパティ(ActiveX)

レイアウトのタブの順序を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.TabOrder
object

タイプ: Layout

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 長整数型

レイアウトのタブの順序

注意

このプロパティは、レイアウトをタブ コントロールに表示する順序をコントロールします。タブの順序は、データベース内の全レイアウト間で固有でありシーケンシャルでなければなりません。

モデル空間タブはゼロ(0)のタブ順序を持たなければなりません。ペーパー空間の各タブは 1 以上のタブ順序を持たなければなりません。

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)
)