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

David Finlayson dfinlays at u.washington.edu
Wed Sep 18 15:21:00 PDT 2002


Duane -

The identify tool probably won't work.  Most of the tools available from 
the ArcMap user interface cannot be modified (chapter 3 and 4 of Exploring 
ArcObjects).  If you look at the UML diagrams in the Exploring ArcObject 
book there are no methods in the IIdentifyDialog tool interface that would 
be useful to you (in fact as far as I can tell, you can't even tell which 
"Thing" was selected for identification!).  You will need to create your 
own identify tool from the pieces available for working with the 
geodatabase (see chapter 8 of exploring ArcObjects).  I don't think it 
would be that hard, but I have little experience working with vector data 
and VBA in ArcObjects, I've done all of my VBA programming in the Raster 
and Spatial Analysts models.

You may try posting the ESRI discussion forums to see if someone else has 
some boilerplate code for letting the user select something and getting at 
the appropriate row of the data table, you could then easily modify it 
yourself.

P.S.  I cc'd the list as I think these conversations are good for the list 
archives.

- David

At 03:02 PM 9/18/2002 -0700, you wrote:
>Hi,
>
>Well, if you can picture the "Identify Results" window that appears when
>using the "Identify" tool:
>
>What I want to do is have a window come up that shows only one field
>(specified in the code) and its value, instead of ALL fields and their
>values (for the object that was just clicked on).
>
>Duane
>
>On Wed, 18 Sep 2002, David Finlayson wrote:
>
> >
> > Can you be more specific about what you want to do?
> >
> > At 11:35 AM 9/18/2002 -0700, D. Wright wrote:
> > >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
> >
> > David Finlayson
> > 204 Ocean Teaching Building
> > School of Oceanography
> > University of Washington
> > Box 357940
> > Seattle, WA  98195-7940
> >
> >
> >

David Finlayson
204 Ocean Teaching Building
School of Oceanography
University of Washington
Box 357940
Seattle, WA  98195-7940




More information about the Uw-gis-l mailing list