YouTube | Facebook | X(Twitter) | RSS

属性テーブルを選択状態で表示

2016/9/1 (木)

'テーブルをShowした後にShowSelectedを変更しないとうまく動作しない
Private Sub UIButtonControl1_Click()
    Dim pMxDoc As IMxDocument
    Dim pUnknown As IUnknown
    Dim pLayer As ILayer
    Dim pStandaloneTable As IStandaloneTable
    Dim pTableWindow2 As ITableWindow2
    Dim pExistingTableWindow As ITableWindow
    Dim SetProperties As Boolean
     
    'Get the selected item from the current contents view
    Set pMxDoc = ThisDocument
    Set pTableWindow2 = New TableWindow
    Set pUnknown = pMxDoc.SelectedItem
     
    ' Determine the selected item's type
    ' Exit sub if item is not a feature layer or standalone table
    If TypeOf pUnknown Is IFeatureLayer Then 'A FeatureLayer
        Set pLayer = pUnknown
        Set pExistingTableWindow = _
                                   pTableWindow2.FindViaLayer(pLayer)
        ' Check if a table already exists; if not create one
        If pExistingTableWindow Is Nothing Then
            Set pTableWindow2.Layer = pLayer
            SetProperties = True
        End If
    ElseIf TypeOf pUnknown Is IStandaloneTable Then
        ' A standalone table
        Set pStandaloneTable = pUnknown
        Set pExistingTableWindow = _
                                   pTableWindow2.FindViaStandaloneTable(pStandaloneTable)
        ' Check if a table already exists; if not, create one
        If pExistingTableWindow Is Nothing Then
            Set pTableWindow2.StandaloneTable = pStandaloneTable
            SetProperties = True
        End If
    End If
     
    If SetProperties Then
        pTableWindow2.TableSelectionAction = esriSelectFeatures
        pTableWindow2.ShowSelected = False
        pTableWindow2.ShowAliasNamesInColumnHeadings = True
        Set pTableWindow2.Application = Application
    Else
        Set pTableWindow2 = pExistingTableWindow
    End If
     
    ' Ensure Table Is Visible
    If Not pTableWindow2.IsVisible Then pTableWindow2.Show True
    pTableWindow2.ShowSelected = True
End Sub
  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『"地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS
-,