English

How To: Create a button on the Layout GUI to create shadow boxes around layout frames

Summary

This article shows how to create a button on the Layout GUI that will place a shadow box around a selected layout frame.

Procedure

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Paste the code below into the new script window:

    Code:
    thelay = av.getactivedoc
    theglist = thelay.getgraphics
    thesel = theglist.getselected
    theshapefirst = thesel.get(0)
    theshapesecond = theshapefirst.getshape
    theshape = theshapesecond.scale(1.1)
    shapea = graphicshape.make(theshape)
    theglist.add(shapea)
    shapeb = graphicshape.make(theshape)
    theglist.add(shapeb)
    thesymbol = rasterfill.make
    thesymbol.setstyle(#rasterfill_style_solid)
    thesymbol.setcolor(color.getblack)
    shapea.setsymbol(thesymbol)
    shapea.invalidate
    thesymbolb = rasterfill.make
    thesymbolb.setstyle(#rasterfill_style_solid)
    thesymbolb.setcolor(color.getwhite)
    thesymbolb.setolcolor(color.getblack)
    shapeb.setsymbol(thesymbolb)
    shapeb.invalidate
    theglist.unselectall
    shapeb.select
    thenewglist = thelay.getgraphics
    thenewglist.moveselectedtoback
    pnt = point.make(0.15, -0.15)
    thenewglist.unselectall
    shapea.select
    thenewnewglist = thelay.getgraphics
    thenewnewglist.moveselectedtoback
    thenewsel = thenewnewglist.getselected.get(0)
    thenewsel.offset(pnt)
    thenewglist.unselectall
    '
    '-- If you want to group the frame with the shaodow graphics,
    '-- uncomment this section.
    '
    'theglistshape = graphiclist.make
    'theglistshape.add(theshapefirst)
    'for each r in theglistshape
    ' r.setselected(true)
    'end
    theglistnew = graphiclist.make
    theglistnew.add(shapea)
    theglistnew.add(shapeb)
    for each i in theglistnew
    i.setselected(true)
    end
    thesellst = thelay.getgraphics
    thesellst.GroupSelected
    thelay.invalidate
    thelay.getdisplay.flush
    av.purgeobjects

  3. Attach the script to a button on the layout GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog, select Layout under Type dropdown.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  4. Open the layout.
  5. Select the frame you want to enclose with the shadow box.
  6. Click the new button to run the script.