Basics of ArcView 3.x Customization

Ad:

You don’t need to be an Avenue wizard to modify ArcView 3.x. There are some simple concepts that you can learn to do basic modifications of ArcView. In addition, there are many sample scripts available to load and utilize to provide added functionality above and beyond the basic functions of ArcView.

Each component of ArcView can be customized. To review, these components are View, Table, Chart, Layout, Script, Appl. The most common component that tends to be customized is the View and the demonstration at the end of this article will focus on customizing a View in ArcView.

Within each of these components there are four customizable areas: Menus, Buttons, Tools, Pop-ups.

Menus are the drop-down items found at the header of each component. Buttons are found on the first row underneath the menu items. Tools are found on the second row. The main difference between a tool and a button is that a button is used to invoke a single action (for example: loading in a theme) and does not involve interaction with the mouse to the screen.

A tool activates a function until it is deactivated and involves an interaction of the mouse with the screen. An example in this case would be the “zoom in” button. Once this tool is depressed each time you clicked on the view (or dragged the mouse over an area) you would zoom in. Activated tools are indicated by an indented look. A pop-up is the menu that appears when you right-click on your mouse. A mini-menu will appear with a list of choices (e.g. zoom in, hotlink, pan).

The most basic way to customize would be to work with the functionality already present in ArcView. In this objective, you aren’t working with Avenue code but rather working with the existing setup to personalize ArcView to meet your needs. The first step is to become familiar with the customizable dialog box. To access this GUI go to Project à Customize menu option in the Project area.

 

This GUI is the place where you can remove and add functionality to ArcView within each component type. The following exercise will guide your through adding a button to a View to familiarize you with basic customization of ArcView.

Exercise: Customizing the View

Before you can add additional functionality to ArcView you need to have Avenue code. As mentioned previously, it isn’t necessary to write your own code. There are several sources to obtain Avenue code from, as will be discussed at the end of this article. In this example the system script for adding a theme will be used. System scripts are snippets of Avenue code stored within ArcView that is accessible. Most of this code can already be found behind the menu items, buttons, tools and pop-ups already set up.  

To demonstrate we will add a new button will allow the user to add a theme to ArcView within the View (obviously this is already a functionality of the View so it will be duplicated with this exercise). The first step will be to load the system script into an empty script form. To do this click on the Script icon and hit the “New” button. This will open up a new script window. There are three ways to get code into this environment: write it yourself straight into the script page, load in pre-written script from a text file (with the *.ave extension for Avenue) or load in a system script.

To load in the system script to add a view, either navigate to Script à Load System Script on the menu or hit the Load System Script Icon on the button bar. This loads the Script Manager GUI (Graphical User Interface). If you move the scroll bar up and down you can see all the system scripts available for you to load. To load the system script to add a theme either scroll down to the “View.add” system script or simply type “View.add” and hit “ok”. Once a script is loaded, you will need to compile the script before you can use it. The act of compiling the script allows ArcView to review the code to make sure the syntax is correct. To compile, either navigate to script à compile or hit the compile button. The next thing you want to do is name the script so that you can call it when you add the button with the customize GUI. To rename the script from the default “Script 1” name, go to Script à Properties to invoke the associated GUI. Highlight the text “Script 1” in the name text box and type in “Add Theme” and hit the “OK” button to rename the script Add Theme”. Now you are ready to attach the script to a button.

Go to Window à “untitled” (or the name of the project file you are working with) to switch to the application window. To load the Customize GUI go to Project à Customize. In this exercise we will first add a new button to the View. First select “View” from the Type drop down. Now, select “Button” from the Category drop down. You should recognize the buttons already there as the default buttons found in the View component of ArcView. Click the “Add” button. You will notice a blank button appears. Open up a View and look on the button bar – you will notice the blank button in the same position as it had been placed in the Customize GUI. Click on the button; what happens? Nothing. You have to attach code to it first which is the next step.

Go back to the Customize GUI. Click on the new blank button to make sure it is highlighted. At the bottom of the GUI is a list of parameters you will now fill in to add functionality to the new button. The first one is called click, as it sounds, this is where you attached code to regulate what happens when you ‘click’ the button. Double-click on the “click” line to bring up the Script Manager. From here you can choose a system script or a script that has been compiled in the Script component. Notice that the script you compiled, “Add Theme” is the first one on the list. Select this script and hit the “Ok” button. Although there are other parameters, the next one that we want to address is the “Icon” property. Right now, it says “empty” indicating that no icon has been selected to display on the button. Double-click the “Icon” line to bring up the Icon Manager. You have the choice of selecting a system icon or loading in a small image file (click the Load button to see the list of compatible image file formats). For the sake of simplicity, we will load in a system icon. The icons are listed alphabetically, so navigate down to the Bs and select the “Bex” icon (looks like a dog) and hit the “Ok’ button. You will notice the button now has that icon.

Now you are ready to test your customization. Go back to the View and hit your “Bex” button. An “Add Theme” GUI will pop-up, prompting you to load a theme.

As mentioned earlier, you can load in code via text files. Several sample scripts are available with ArcView. These are located by default in …\ESRI\AV_GIS\ARCVIEW\Samples\scripts

ESRI also has a free Avenue scripts through their ArcScripts site.

Further free scripts can be accessed through the ArcView Developer Resource category.


Advertising



Like this article and want more?

Enter your email to receive the weekly GIS Lounge newsletter:

Advertising