VBA question (ArcMAP): Identifying a field of selected object

D. Wright checkers at u.washington.edu
Wed Sep 18 11:35:51 PDT 2002


I have created a tool for selecting and identifying an object on a layer.
It's probably the same tool as the "Identify" tool, except I have access
to the code.  The code itself came from the ESRI ArcObjects Online source.

Is it possible to select, programmatically, a field of the selected
object?

The code is listed below.

Thanks,

Duane Wright


Private Sub checkID_MouseDown(ByVal button As Long, ByVal shift As Long,
ByVal x As Long, ByVal y As Long)
  Dim pMxDoc As IMxDocument
  Dim pActiveView As IActiveView
  Dim pIdentifyDialog As IIdentifyDialog
  Dim pIdentifyDialogProps As IIdentifyDialogProps
  Dim pEnumLayer As IEnumLayer
  Dim pLayer As ILayer

  Set pMxDoc = Application.Document
  Set pActiveView = pMxDoc.FocusMap

  'Create a new IdentifyDialog and associate it
  'with the focus map and the map's display
  Set pIdentifyDialog = New IdentifyDialog
  Set pIdentifyDialogProps = pIdentifyDialog 'QI
  Set pIdentifyDialog.Map = pMxDoc.FocusMap
  Set pIdentifyDialog.Display = pActiveView.ScreenDisplay

  'Clear the dialog on each mouse click
  pIdentifyDialog.ClearLayers

  'Perform an identify on all of the layers the dialog
  'says are searchable
  Set pEnumLayer = pIdentifyDialogProps.Layers

  pEnumLayer.Reset
  Set pLayer = pEnumLayer.Next
  Do While Not pLayer Is Nothing
    pIdentifyDialog.AddLayerIdentifyPoint pLayer, x, y
    Set pLayer = pEnumLayer.Next
  Loop

  pIdentifyDialog.Show

End Sub




More information about the Uw-gis-l mailing list