English

How To: Use the Identify tool to select by rectangle or user point

Summary

Modify the View.Identify system script to identify features using a rectangle or a point.

Procedure

  1. Open a New Script window.
    1. Activate the Project window.
    2. Click the Scripts icon.
    3. Click New.
  2. Paste the following code:
    Code:
    theView = av.GetActiveDoc
    r = theView.ReturnUserRect
    theThemes = theView.GetActiveThemes
    if (r <> NIL) then
      if (System.IsShiftKeyDown) then
        op = #VTAB_SELTYPE_OR
      else
        op = #VTAB_SELTYPE_NEW
      end
      for each t in theThemes
        if (t.CanSelect) then
          t.SelectByRect(r, op)
        end
      end
    else
      p = theView.GetDisplay.ReturnUserPoint
      if (System.IsShiftKeyDown) then
        op = #VTAB_SELTYPE_XOR
      else
        op = #VTAB_SELTYPE_NEW
      end
      for each t in theThemes
        if (t.CanSelect) then
          t.SelectByPoint(p, op)
        end
      end
    end
    av.GetProject.SetModified(true)
    for each t in theView.GetActiveThemes
      if (t.Is( FTHEME )) then
        v = t.GetFTab
        recs = v.getselection
        for each rec in recs 
          found = TRUE
          idlabel = t.GetName++"-"
          f = t.GetLabelField
          if (f = NIL) then
            idlabel = idlabel++rec.SetFormat("d").AsString
          else
            idlabel = idlabel++v.ReturnValueString(f,rec)
          end
          v.Identify(rec, idlabel)
        end
      end
    end
    if (not found) then
      System.Beep
    end
    
  3. Rename the script 'View.Identify2'.
    1. Select Properties from the Script menu.
    2. Type in a new name in the Name field.
    3. Click OK.
  4. Attach the View.Identify2 script to the apply event of a Tool on the view GUI.
    1. Compile the script.
    2. Make the Project window active.
    3. Select Customize from the Project menu.
    4. Set the Type dropdown to View on the Customize dialog box.
    5. Set the Category dropdown to Tools.
    6. Click Tool.
    7. Double-click the Apply property at the bottom of the Customize dialog box.
    8. Type the name of the script in the Script Manager and click Select.
    9. Close the Customize dialog box.
      Note:		
      For more information, refer to the ArcView Help topic "Customize (dialog box)."
  5. Open the view and click the newly created tool.
  6. Draw a rectangle around the feature to identify.