Introduction To Programming Arcobjects With Vba Jeremiah Lindemann pdf download
Introduction To Programming Arcobjects With Vba Jeremiah Lindemann pdf download
https://ebookbell.com/product/introduction-to-programming-
arcobjects-with-vba-jeremiah-lindemann-2228306
https://ebookbell.com/product/introduction-to-programming-with-
fortran-4th-edn-ian-chivers-jane-sleightholme-49848242
https://ebookbell.com/product/introduction-to-programming-with-c-3rd-
international-edition-3rd-y-daniel-liang-55234740
https://ebookbell.com/product/introduction-to-programming-c-chopra-
rajiv-56597050
Introduction To Programming With Java 3rd Edition John Dean Ray Dean
https://ebookbell.com/product/introduction-to-programming-with-
java-3rd-edition-john-dean-ray-dean-58035934
Introduction To Programming Languages Programming In C C Scheme Prolog
C And Soa Fifth Edition Yinong
https://ebookbell.com/product/introduction-to-programming-languages-
programming-in-c-c-scheme-prolog-c-and-soa-fifth-edition-
yinong-21889502
https://ebookbell.com/product/introduction-to-programming-with-
greenfoot-objectoriented-programming-in-java-with-games-and-
simulations-klling-21995800
https://ebookbell.com/product/introduction-to-programming-using-
python-daniel-y-liang-22039592
https://ebookbell.com/product/introduction-to-programming-with-c-for-
engineers-1st-edition-boguslaw-cyganek-22898364
https://ebookbell.com/product/introduction-to-programming-in-c-
language-c-programming-best-c-programming-language-book-for-beginners-
khachane-23917738
Introduction to
Programming
ArcObjects with VBA
(Final)
Jeremiah Lindemann
Lisa Markham
Robert Burke
Janis Davis
Thad Tilton
Copyright © 2001–2004 ESRI
All rights reserved.
Course version 3.2. Revised July 2004.
Printed in the United States of America.
The information contained in this document is the exclusive property of ESRI. This work is protected under United States
copyright law and the copyright laws of the given countries of origin and applicable international laws, treaties, and/or
conventions. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying or recording, or by any information storage or retrieval system, except as expressly permitted in writing by
ESRI. All requests should be sent to Attention: Contracts Manager, ESRI, 380 New York Street, Redlands, CA 92373-8100, USA.
ESRI, ARC/INFO, ArcCAD, ArcGIS, ArcIMS, ArcPad, ArcSDE, ArcView, BusinessMAP, MapObjects, PC ARC/INFO, SDE,
and the ESRI globe logo are trademarks of Environmental Systems Research Institute, Inc., registered in the United States and
certain other countries; registration is pending in the European Community. 3D Analyst, ADF, ArcCOGO, the ArcCOGO logo,
ArcGrid, the ArcGrid logo, the ARC/INFO logo, AML, ArcNetwork, the ArcNetwork logo, ArcNews, ArcTIN, the ArcTIN logo,
ArcInfo, the ArcInfo logo, ArcInfo Librarian, ArcInfo—Professional GIS, ArcInfo—The World's GIS, ArcAtlas, the ArcAtlas
logo, the ArcCAD logo, the ArcCAD WorkBench logo, ArcCatalog, the ArcData logo, the ArcData Online logo, ArcDoc, ArcEdit,
the ArcEdit logo, ArcEurope, the ArcEurope logo, ArcEditor, ArcExplorer, the ArcExplorer logo, ArcExpress, the ArcExpress
logo, ArcFM, the ArcFM logo, ArcFM Viewer, the ArcFM Viewer logo, ArcGlobe, the ArcIMS logo, ArcLocation, ArcLogistics,
the ArcLogistics Route logo, ArcMap, ArcObjects, the ArcPad logo, Arcplot, the Arcplot logo, ArcPress, the ArcPress logo, the
ArcPress for ArcView logo, ArcReader, ArcScan, the ArcScan logo, ArcScene, the ArcScene logo, ArcSchool, the ArcSDE logo,
the ArcSDE CAD Client logo, ArcSdl, ArcStorm, the ArcStorm logo, ArcSurvey, ArcToolbox, ArcTools, the ArcTools logo,
ArcUSA, the ArcUSA logo, ArcUser, the ArcView GIS logo, the ArcView 3D Analyst logo, the ArcView Business Analyst logo,
the ArcView Data Publisher logo, the ArcView Image Analysis logo, the ArcView Internet Map Server logo, the ArcView
Network Analyst logo, the ArcView Spatial Analyst logo, the ArcView StreetMap logo, the ArcView StreetMap 2000 logo, the
ArcView Tracking Analyst logo, ArcVoyager, ArcWorld, the ArcWorld logo, Atlas GIS, the Atlas GIS logo, AtlasWare, Avenue,
the Avenue logo, the BusinessMAP logo, DAK, the DAK logo, Database Integrator, DBI Kit, the Digital Chart of the World logo,
the ESRI Data logo, the ESRI Press logo, ESRI—Team GIS, ESRI—The GIS People, FormEdit, Geographic Design System,
Geography Matters, GIS by ESRI, GIS Day, the GIS Day logo, GIS for Everyone, GISData Server, InsiteMAP, MapBeans,
MapCafé, the MapCafé logo, the MapObjects logo, the MapObjects Internet Map Server logo, ModelBuilder, MOLE, the MOLE
logo, NetEngine, the NetEngine logo, the PC ARC/INFO logo, PC ARCEDIT, PC ARCPLOT, PC ARCSHELL, PC DATA
CONVERSION, PC NETWORK, PC OVERLAY, PC STARTER KIT, PC TABLES, the Production Line Tool Set logo,
RouteMAP, the RouteMAP logo, the RouteMAP IMS logo, Spatial Database Engine, the SDE logo, SML, StreetEditor, StreetMap,
TABLES, The World's Leading Desktop GIS, Water Writes, and Your Personal Geographic Information System are trademarks;
and ArcData, ArcOpen, ArcQuest, ArcWatch, ArcWeb, Rent-a-Tech, Geography Network, the Geography Network logo,
www.geographynetwork.com, www.gisday.com, @esri.com, and www.esri.com are service marks of ESRI.
The names of other companies and products herein are trademarks or registered trademarks of their respective trademark owners.
ArcView GIS uses HCL Technologies Ltd. Presenter software under license.
C O N T E N T S
4 Using variables
Lesson overview 4-2
Variables 4-3
Working with variables 4-4
Dim (dimension) statement 4-6
Assigning a value to a variable 4-8
Function procedures 4-10
Comparing values 4-12
Decision making: The If Then statement 4-14
14 Using tools
Lesson overview 14-2
Tool events 14-3
Getting the user X and Y 14-4
Display transformation 14-5
Convert display coordinates to map units 14-6
Example: Rubberbanding 14-7
IGraphicsContainer 14-8
Managing graphics 14-9
Refreshing the display 14-10
Partially refresh the display 14-11
Exercise 14 overview: Choose one 14-12
Exercise 14A: Create a tool to draw point graphics
Exercise 14B: Create a Parcel Proximity tool
15 Data management
Lesson overview 15-2
Name objects 15-3
Object Model overview: Name classes 15-4
Creating a DatasetName 15-5
Data manipulation objects 15-6
Converting feature classes 15-7
Exercise 15A overview 15-8
Exercise 15A: Data conversion
Editing with a cursor 15-9
Editing cursors 15-10
Example: Updating misspelled attributes 15-12
Adding a field 15-13
Creating a domain 15-14
Adding a domain to a database 15-15
Assigning a domain to a field 15-16
Exercise 15B overview 15-17
Exercise 15B: Data management
Introduction to
ModuleTitle
Programming
ArcObjects with VBA Welcome 1-2
Logistics
Course materials
Course objectives
contents
1-3
1-4
1-5
Course timeline 1-6
What is ArcGIS? 1-7
Software support resources 1-8
Learning paths 1-9
VBA: Visual Basic for Applications 1-11
What can ArcObjects do? 1-12
Exercise options 1-16
Exercise typographic conventions 1-17
Exercise 1 overview 1-19
Introduction to
Programming ArcObjects
with VBA
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA
Organization
Role in organization
Programming experience
GIS experience
Goals and expectations
for this class
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-2
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-3
Daily schedule
Under normal conditions, the class will begin each day at 8:30 a.m. and continue until 5:00
p.m. There will be at least one break in the morning and one in the afternoon. You will
generally be given one hour for lunch.
Facilities
Your instructor will provide information regarding the facilities.
Internet access
Some training facilities provide Internet access for your use during class. ESRI® regards
Internet access as an essential business resource for classroom demos, exercises, arranging
travel, and maintaining contact with your office. Please limit your use of the Internet to
business activities only and, as a courtesy to your classmates, refrain from typing or surfing
during lecture presentations.
Course data
Samples
Online course evaluation
http://classeval.esri.com
Requires Course Identification Number
Software evaluation
E-mail enhancement requests to product teams
[email protected]
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-4
Teaching methods
Research indicates that students learn differently. This course maximizes your learning
experience by combining instructor-led lectures and discussions, demonstrations, computer-
based exercises, and review questions.
Class materials
Your class materials include lecture and exercise course books, and Object Model Diagrams.
These are yours to take home, so feel free to write in them.
Included at the back of your exercise book is a CD that contains all the data required for the
course. Here you will find all the map documents, data, and solution code used for each
exercise. You will also find over 100 different code samples that are not described or used
during the course, but that you might find useful when you begin to write your own
applications.
The class data CD contains all the data sets you will work with during class. A second CD
contains the ArcSDE 8.1 for SQL Server software, which you will install later today.
Course evaluation
Your feedback improves ESRI’s courses. At the end of the week, please evaluate the
following:
• Instructor • Course materials • Teaching facilities • Overall course
Software evaluation
If you have access to a Web-based e-mail account during class, you can send comments about
the software directly to the product development teams. Your comments directly influence
enhancements to ESRI products, so please let us know what you think.
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-5
Introduction to Programming ArcObjects with VBA is a five day course that focuses on the
concepts of the component object model (COM), object oriented programming, and
understanding the ArcObject object model. Although no prior experience with Visual Basic
(VB) is assumed, the introductory portion of the course moves very quickly. Fundamental VB
topics are covered in the first couple of lessons, and then applied (and thus reinforced)
throughout the week.
You will learn to program through a combination of instructor-led lectures and hands-on
programming exercises. You should expect to spend the majority (approximately 60%) of
your class time writing Visual Basic code. Later in the week, your instructor will give you
time to experiment on your own, either by choosing a programming task from a set of
workshop exercises in Appendix B, or by tackling your own programming problem.
By the end of the course, you can expect to have a solid understanding of the VBA
development environment. You will be able to modify the user interface, design VB user
forms, and write applications that enhance or extend the functionality of ArcGIS.
COM Classes
Day 2
Reading OMDs
Symbolizing layers
Day 4
Data management
Application framework
Day 5
ArcObjects beyond VBA
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-6
I
O
ArcView
ArcView Web
Web
ArcReader
ArcReader N ArcPad
ArcPad browser
browser
S
Components ArcObjects
ArcObjects
Network
ArcGIS
ArcGIS Server
Server ArcIMS
ArcIMS
Application/Data ArcSDE
ArcSDE
servers
RDBMS
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-7
ArcGIS is the name used to identify ESRI’s flagship family of GIS products. ArcGIS®
includes ArcGIS client software, components, and application and data server software.
ArcGIS itself is not a GIS application; rather, it is a set of software products for building
ArcGIS systems that best suit your GIS needs.
ArcGIS is based on a common library of shared GIS software components, called
ArcObjects™.
ArcGIS is composed of client and server applications. Each software application can create,
manage, analyze, and serve data stored in one or more formats.
•ArcGIS Desktop: Integrated suite of advanced GIS applications consisting of three software
products: ArcView®, ArcEditor™, and ArcInfo®. The ArcGIS Desktop applications provide the
same core mapping, editing, and analysis functionality. The level of functionality available
differs depending on which license you have. ArcInfo provides users with the most complete
level of GIS functionality. It is composed of ArcInfo Desktop and ArcInfo Workstation.
•ArcReader™: Allows users to view high-quality published maps (PMFs) created in ArcMap™.
•ArcGIS Engine: Developer toolkit of embeddable GIS components for building custom
stand-alone applications using COM, C++, Java, and .NET.
•ArcPad®: Used with PDAs for creating and managing data while in the field.
•ArcGIS Server: A shared library of GIS software objects used to build and develop server-
side GIS applications in enterprise and Web computing frameworks.
•ArcIMS®: Used to publish maps, data, and metadata through open Internet protocols.
•ArcSDE®: Manages and serves spatial information from external RDBMs to ArcGIS clients.
For more information, go to http://www.esri.com/software/index.html.
ESRI’s primary resource for software support is the ESRI Support Center at
http://support.esri.com.
Knowledge Base
The Knowledge Base is a searchable database of focused technical articles. It includes
answers to frequently asked questions, step-by-step directions for performing common tasks,
and workarounds for known software limitations. The Knowledge Base also contains topic-
focused white papers organized by product, system requirement information, and product
documentation.
Downloads
Obtain the latest software correction, software and code samples, utilities, tutorials, user
contributed scripts and sample code (ArcScripts), data models, and evaluation software from
ESRI’s Download page.
User Forums
In the user forums, you can ask questions, provide answers, and exchange ideas with other
ESRI product users. Resources include several discussion forums, and two subscription e-mail
discussion lists moderated by ESRI. ArcView-L is for ArcView users, and ESRI-L is for users
of all other ESRI products.
For Developers
This page is for ESRI’s developer community. It provides the latest developer information,
including sample code, technical documents, and object model diagrams for ESRI’s developer
products.
Learning Guide
Learning paths organized
by software and topic
Learning options
Instructor-led courses
Virtual Campus courses
Training seminars
Web workshops
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-9
Depending on which ESRI software your organization has licensed, your skills, and your
plans for upcoming projects, you may benefit from additional training on advanced topics, on
specialized software, or on background topics to refine your understanding of GIS and related
technologies.
Detailed information about Instructor-led and Web-based courses—including a list of topics
covered, intended audience, duration, schedules, and pricing—is available in the ESRI Course
Catalog. You can access this catalog on the Web at http://www.esri.com/training/index.html.
On the ESRI Training Web site, you can also find information about new courses developed
since the course catalog was printed.
Web-based courses offer convenience and savings. Also, many ESRI Virtual Campus courses
include a free lesson, called a module. You can create a free account and begin training with
these free modules within minutes at http://campus.esri.com.
In addition to Web-based courses, the Virtual Campus also offers free live training seminars,
training seminars, and Web workshops. Live training seminars are focused lectures on a
variety of GIS topics for all levels of users. Consult the Virtual Campus for upcoming topics,
dates, and times. Training seminars are free recordings of live training seminars, viewable at
your convenience. Workshops are recordings of live training seminars, viewable at your
convenience, plus printable slides of the presentation, questions and answers from the live
training seminar, a software exercise with accompanying data, an optional exam to assess
understanding, and a certificate for successfully completing the exam.
Introduction to Introduction to
Extending the
Visual Basic Programming
W i ArcGIS
for ESRI ArcObjects i
Desktop
software with VBA
Applications
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-10
Courses identified with the i symbol occur in a classroom with an instructor. The W
symbol indicates Web-based courses available on the ESRI Virtual Campus at
http://campus.esri.com. The B indicates a book from ESRI press available at
http://gis.esri.com/esripress/display/index.cfm.
Students taking this course (Introduction to Programming ArcObjects with VBA) are expected
to have a least a basic understanding of programming languages. The Web based course
Visual Basic for ESRI Software will provide sufficient information for taking this course.
ESRI’s Virtual Campus also has a 4 part VBA Workshop Series that introduces you to to the
VBA environment, also a sufficient prerequisite for this course. You may also find the ESRI
press book, Getting to Know ArcObjects to be an excellent resource to get start with
ArcObjects and a valuable resource even as you become more proficient with using
ArcObjects.
After completing Introduction to Programming ArcObjects with VBA, you may want to further
your knowledge by taking advanced ArcObjects courses. This course is a prerequisite to the
advanced ArcObjects courses that ESRI provides. The subject matter of these advanced
courses will be discussed on the following slides and the last section in this course..
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-11
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-12
Table
Table of
of Contents
Contents Tab
Tab
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-13
Java Example
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-14
Network Tracing
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-15
ArcGIS Server
ArcGIS Server allows you to build custom Web-based applications, exposing ArcObjects
through the Internet or LAN (Local Area Network). ArcGIS Server is a GIS enterprise
application server that provides complete GIS capabilities throughout an organization while
maintaining a centrally managed database. Mapping, geocoding, spatial queries, editing,
tracing and linear referencing are all examples of applications that developers can build using
ArcGIS Server. These applications can be consumed by browser-based clients, custom
applications built with ArcGIS Engine, and ArcGIS Desktop. ArcGIS Server will support all
common development environments (Java, .NET, C++, COM) and all major server platforms.
The information on this subject matter is discussed in the Developing Applications with
ArcGIS Server instructor-led course.
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-16
Exercise shortcut
Appearing at the beginning of an exercise, the exercise shortcut summarizes the steps found in
the main exercise. Each shortcut step corresponds with the same step number in the main
exercise.
Exercise shortcuts are ideal for those students who have had some experience with the
software and want to be challenged by trying to complete the step without detailed
explanation. Of course, if you cannot complete the shortcut step, you can refer to the main
exercise for more detail.
9
9 Control
Note name
Keyboard
input
Warning
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-17
Before you begin your first exercise, you need to recognize the typographic conventions used
in your exercise coursebook.
Descriptive text
This text can provide an overview of the next sequence of actions, a review of actions just
completed, or an interpretation of output on your computer monitor. Descriptive text may
introduce what is about to happen with phrases like “Next, create a new map in ArcMap”; the
actual instruction follows, indicated by the checkbox symbol.
Action
Actions are tasks—like starting an application, clicking a button, or typing a command—that
you must perform during the exercise. The square checkbox symbol indicates an action; act
only on instructions that are prefaced with the checkbox symbol.
You can mark the checkbox symbol in your exercise coursebook as you complete each task.
This is especially helpful when shifting your attention between your book and your computer
monitor.
Control name
Names of objects on your monitor with which you interact are italicized in your exercise
coursebook. These include windows, menus, and buttons. Many buttons reveal their names
when you hold your mouse pointer over them.
Warning
The large exclamation point symbol and bold text signals critical information for performing
the next action. Warnings may alert you to a subtle syntactical rule in a command you will
type or inform you that the next button you click will produce an error intentionally. If you
have questions about a warning, ask your instructor for clarification before proceeding.
Keyboard input
Text you need to type—like commands in a Command Prompt, entering a file name in a Save
dialog, and pressing Ctrl + Alt + Delete—appears in bold, constantly-spaced font.
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 1-19
environment
Lesson overview 2-2 Writing Visual Basic statements 2-20
The VBA development
environment
ArcGIS commands
2-3
2-4
Some common Visual Basic
functions
Procedure types
contents
2-21
2-23
Using the Customize dialog box 2-5 Running an event procedure 2-24
The Customize dialog 2-6 Navigating event procedures in a
Using the Customize dialog box 2-8 module 2-25
Creating a new command 2-9 The ThisDocument module 2-26
Setting control properties 2-10 Creating a new module 2-27
Accessing your customizations 2-11 Creating a new sub or function
Storing your customizations 2-13 procedure (macro) 2-28
Examining a control’s source Defining procedure scope 2-30
code 2-14 Running a subroutine or function
Demonstration 2-15 procedure 2-31
Overview 2-16 Adding a macro to a toolbar 2-32
The Visual Basic Editor 2-17 Getting help 2-33
Understanding ArcMap Exercise 2 overview 2-34
software’s code storage 2-19
The VBA development
environment
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA
Introduction to Programming ArcObjects with VBA The VBA development environment 2-1
Lesson overview
The VBA development environment
Customize dialog box
Create new toolbars and commands
Add, delete, and move commands
Set control properties
Storing and distributing customizations
Visual Basic Editor
Code storage
Modules
Procedures
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-2
Lecture 2 overview
In this lesson, you will learn about the VBA development environment. This environment
consists of the Customize dialog box, which is used to modify the ArcMap or ArcCatalog
graphical user interface, and the Visual Basic Editor, which is used to write VBA procedures
(macros).
The first half of this lesson will discuss the Customize dialog box. You will learn how to
modify the ArcMap and ArcCatalog user interface by (1) adding new toolbars, (2) adding
existing ArcGIS commands, (3) removing existing commands from toolbars and menus, (4)
altering command properties (e.g., icon), and (5) creating custom interface controls. You will
also learn how to store and distribute your customizations.
The last half of this lesson will teach you how to use the Visual Basic Editor.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-2
The VBA development environment
Similar environment for all applications that use VBA
Customize dialog box: Interface customization
Visual Basic Editor: Writing code
Customize
dialog box
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-3
The VBA development environment consists of two parts: the Customize dialog box for
modifying the user interface and the Visual Basic Editor for writing code.
An advantage of using VBA that you will soon discover is that several applications use the
VBA development environment for customization. While these environments are not identical,
they are very similar. All Microsoft Office products, for example, will have a Customize
dialog box that allows you to add, remove, and rearrange interface controls. All of these
applications will have a Visual Basic Editor for writing macros or designing forms. Once you
are familiar with the ArcGIS™ VBA development environment, your skills will be portable to
several other applications.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-3
ArcGIS commands
Toolbars and menus contain commands
Commands are buttons, menus, macros, and UIControls
Each command has associated code
Toolbar
Toolbar
Commands
Commands
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-4
ArcMap and ArcCatalog have toolbars that contain commands (i.e., controls). Commands are
things such as buttons and menus, macros (Visual Basic procedures), and UIControls (user
interface controls). UIControls are custom controls that an ArcGIS VBA developer can add to
the interface to perform specialized tasks. There are four types of UIControls:
UIButtonControls, UIToolControls, UIEditBoxControls, and UIComboBoxControls. COM
commands are similar to UIControls, except they are stored in DLL, EXE (executable), or
similar files and are created by a developer in a full-scale programming environment such as
Visual Basic or C++.
Users interact with commands by clicking, typing, selecting, or applying, depending on the
type of control. Behind each control, there is associated code that will execute in response to
user interaction. As a developer of a UIControl, you can write code to respond to button clicks,
mouse interaction (mouse button down, mouse button up, mouse move), and keyboard typing.
While the Customize dialog box is open, you can reorganize commands by dragging and
dropping them to a new location on a toolbar or menu. You can even drag them between
toolbars and menus or remove them altogether.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-4
Using the Customize dialog box
Open the dialog to put the interface in design mode
With the Customize dialog box open, you can …
Rearrange or remove existing commands
Add new toolbars and commands
Change command properties
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-5
In the ArcMap and ArcCatalog Customize dialog box, you will find utilities for adding new
toolbars, menus, and commands to the user interface. You may want to simply modify some of
the existing commands by rearranging them or changing their icon, for example. Regardless of
the interface customization you want to make, however, you always need to start by opening
the Customize dialog box.
While the Customize dialog box is open, the user interface is in design mode, which means
clicking on commands will not execute them but will instead allow you to rearrange them or
change their properties. Once you are satisfied with the interface customizations you have
made, close the Customize dialog box to begin working with the controls.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-5
The Customize dialog
Three tabs (panels)
Toolbars: Turn toolbars on or off, create new toolbars
Commands: Drag new commands onto the interface
Options: Lock customization with a password, etc.
A
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-6
The Customize dialog has three panels: Toolbars, Commands, and Options. The Toolbars and
Commands tabs are the ones you will use to modify the user interface, while the Options tab
provides some control over basic customization options.
Toolbars
On the Toolbars tab of the Customize dialog, you have the ability to work with existing
toolbars by turning them on or off, renaming them, or deleting them. If you make a mistake
while customizing the interface, you can also reset an individual toolbar to its original state by
selecting it in the Customize dialog and clicking Reset.
You may also use the Customize dialog to create brand new toolbars. When creating a new
toolbar, you will be prompted for a name and a location in which to save it (more about storing
customizations later). A new toolbar will be nothing more than a small gray box; to add
commands to a new toolbar, use the Commands tab.
Commands
The Commands tab on the Customize dialog box contains all existing ArcMap or ArcCatalog
commands (depending on which application you are customizing). Commands can be dragged
from the Customize dialog onto a toolbar as a button or onto a menu as a menu choice.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-6
Options
The Options tab on the Customize dialog box allows you to control some basic properties of
your customization development environment.
Lock Customization: Clicking this will allow you to provide a password to protect your
customizations. When a user tries to access the Customize dialog box or the Visual Basic
Editor, he or she will be required to provide the password.
Change VBA Security: Viruses may be distributed in a macro within a document, template, or
add-in. When you open such a document or perform an action that triggers a macro virus, the
macro virus might be activated, transmitted to your computer, and stored in your Normal
template. The levels of security are described in the Security dialog box to reduce the chances
of macro viruses infecting your documents, templates, or add-ins.
Update ArcID module: All commands in ArcGIS have a unique identifier (UID) that allows a
programmer to easily reference it in code. This ID is stored in a special document called the
ArcID module. Update this module to write unique identifiers for custom interface commands
(DLLs you have added from file) to the ArcID module.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-7
Using the Customize dialog box
Commands are organized into categories
All ArcMap or ArcCatalog commands are here
Some that are not on the interface by default
Command Categories
Commands
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-8
As mentioned earlier, the Customize dialog box contains all ArcMap or ArcCatalog
commands. These commands are available on the Commands tab and are organized into
categories. By highlighting a category on the left side of the dialog, you will see all commands
in the category listed on the right. Some familiar categories are things like Selection,
Pan/Zoom, and File. You will also find categories for Visual Basic procedures you write
yourself (Macros), for creating new menus (New Menu), and for creating new custom controls
(UIControls). Because many of the commands you find here are not found on the default (out-
of-the-box) ArcGIS interface, you might find a few gems here: functionality that you did not
know existed.
Once you locate a command you want to add to the interface, you can select the command in
the dialog and drag it to a toolbar as a button or onto a menu as a menu choice. You need to be
careful, however, as controls that require user interaction will not work as menu choices, and
some commands only work as context menu choices (e.g., layer properties).
Introduction to Programming ArcObjects with VBA The VBA development environment 2-8
Creating a new command
UIControls category
User-created commands
Four types
Button
Tool
EditBox
ComboBox
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-9
Introduction to Programming ArcObjects with VBA The VBA development environment 2-9
Setting control properties
Customize dialog box must be open
Right-click a control to view and change properties
Characteristics that define appearance
Name
Image
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-10
Command properties
While the Customize dialog is open, the user interface is in design mode. To access command
properties, simply right-click on a command and use the context (popup) menu that appears.
With the dialog open, you can modify the following command properties.
Name
The text that appears for a command if Text Only or Image and Text is chosen for
display. Changing the Name property does not affect how the command is referred to in
code.
Button image
You can choose a new icon for any command (including menu choices) by selecting
one from the menu or browsing to one of your own. If you create your own image, it
must be a bitmap (.bmp) that is 16 x 16 pixels.
Groups
Beginning a group adds a separator line to the left of the selected control. Use groups to
visually organize related commands.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-10
Accessing your customizations
ArcMap has three levels of storage
Templates are read in order on startup
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-11
Templates
In ArcMap, there are three levels at which you can store your customizations: the Normal
template (Normal.mxt), an intermediate (or base) template (*.mxt), and the current map
document (*.mxd). Each level of customization is represented by a document. Upon opening a
map, these documents are read from top to bottom in the graphic above in order to incorporate
customizations from all levels.
The read order is important because changes in one template can affect other templates and the
current map. For example, the Normal template may have the AddData command turned off,
but a base template may turn on the AddData command.
Normal template
The Normal templates contain all the original ArcMap (Normal.mxt) and ArcCatalog
(Normal.gxt) graphical user interface (GUI) settings. Every time an application starts, the
Normal template is read. The Normal templates are stored in the user’s Windows NT Profiles
directory for Windows NT or in the user’s Documents and Settings directory for Windows
2000 and XP. Each user can have different customizations stored in the Normal templates even
if they are running the same installation of ArcGIS.
In ArcCatalog, all customizations are stored in the Normal.gxt template. If the Normal
template is deleted, it is re-created when the application starts.
Base template
Base templates allow you to store map elements for the creation of standard maps. When
initially creating a new ArcMap map document, you can choose to base your map on a
template. While there are several predefined base templates that come with ArcGIS, you can
actually save any map document as a template (*.mxt). Templates can also store
customizations, which will apply to all maps subsequently produced from them.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-11
Map document
The most local level of customization is the map document itself (*.mxd). Customizations
stored in the map are available only in that particular document. The map document is the last
document to be read when opening a map, so customizations at this level can override ones
defined in the Normal or Base templates.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-12
Storing your customizations
All customizations are saved
Normal template, Base template, or the current document
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-13
All ArcMap customizations are stored at one of the three levels described on the last slide.
Everything from new Visual Basic forms and programs to simply changing a command’s
image is saved in Normal.mxt, a base template (*.mxt), or with the current map document
(*.mxd). When a map is opened, these three documents are read in the following order.
Normal template
The Normal template is always read first when opening a map. Because the Normal template is
stored in the Windows user profiles directory, customizations stored here are global to a
specific login. If the Normal template does not exist when ArcMap or ArcCatalog is started, an
out-of-the-box version is re-created. As a precaution, you should make periodic backups of the
Normal template if you are storing a lot of customizations there.
Base template
Base templates are designed primarily to store a set of map layout elements, such as north
arrows, scale bars, and base layers, to aid in the production of standard maps. These templates
may also contain customizations such as specialized controls or scripts. As an example, your
organization might work with parcel maps that all have a custom property value calculator
control inherited from their common template. Maps that were not produced from this template
would not have the custom control.
Current map
If customizations are saved in a map document, they will only be available in that particular
document. For example, you might have a map document that contains sensitive information
such as archaeological site locations. You could protect this particular document with a custom
startup routine that prompts for a password when the map document is opened.
Introduction to Programming ArcObjects with VBA The VBA development environment 2-13
Examining a control’s source code
Commands have events (e.g., Click, Double-click,
MouseUp, KeyDown, KeyUp)
Code runs when its corresponding event occurs
Copyright © 2001–2004 ESRI. All rights reserved. Introduction to Programming ArcObjects with VBA 2-14
Code window
When you first create a UIControl, it only knows how to be a control but has no real code to
make it work. It other words, if it is a button it will click like any other button, if it is an edit
box it will allow you to type text in it, and so on. It will have all the properties of a control
(such as an image and a name) but will not do anything when it’s interacted with. To add
functionality to a control, you can choose View Source as shown above to access the control’s
associated code document (module). Once you are in the control’s code module, you can write
Visual Basic programs that are associated with user events (e.g., a button click).
Introduction to Programming ArcObjects with VBA The VBA development environment 2-14
Exploring the Variety of Random
Documents with Different Content
CHAPTER XVII
Like the Batoum, the Red Cross ship brought others who began the
voyage as semi-stowaways. Commodore Wolkenau had told us in
Odessa that among our shipmates would be a certain General from
Denikin's army. We found him—a tall, bearded, Grand-Duke-
Nicholas-like man—dining in the second-class saloon, and wearing a
suit of clothes nearly as shabby as our own. To dodge investigation
by the Austrian port authorities he had assumed, with the
connivance of the ship's captain, the character of an engineer's
mate. The "engineer" who owned him as mate was in reality a
commander of the Russian Imperial Navy, also attached to Denikin's
forces. The pair of them were travelling to Salonika, as emissaries of
General Denikin, to ask the Franco-British command for arms,
ammunition, and financial support.
The three days' voyage was uneventful. The Black Sea remained at
its smoothest. A pleasant sun harmonized with the good-will and
friendliness of all on board, and with our deep content, as we
continued to tread on air and impatient expectation. A Bulgarian
destroyer pranced out to meet us, and led the vessel through the
devious minefields and into the miniature, toy-like harbour of Varna.
The Bulgarian authorities imposed a four days' quarantine upon all
passengers; but the general, the naval commander, and the Franco-
British agent joined with us in avoiding this delay by sending ashore
a collective note to the French naval officer who controlled the port.
As at Odessa, we rowed ashore with our complete luggage wrapped
in two newspapers, each of which contained a toothbrush, a
revolver, some cartridges, a comb, a razor, a spare shirt, a spare
collar, and a few handkerchiefs.
White looked after him, hungrily. He had been among the Turks for
three years, and since capture this was his first sight of a British
Tommy on duty.
Even the real Ford car, lent us by the British Mission for the journey
to Salonika, failed to establish a sense of dignity. Once, when we
stopped on the road near a British column, the driver was asked who
were his pals the tramps.
We drove joyously down the Struma valley and through the Kreshna
and Ruppel passes, still littered with the débris of the Bulgarian
retreat. Rusted remnants of guns lolled on the slopes descending to
the river. Broken carts, twisted motor-lorries, horse and oxen
skeletons—all the flotsam of a broken army—mottled the roadside.
In the rocky sides of the mountain passes were great clefts from
which dislodged boulders had hurtled down on the Bulgarian
columns when British aeroplanes helped the retreat with bomb-
dropping. We passed through the scraggy uplands of Lower
Macedonia, and so to Salonika.
The real Ford car halted in the imposing grounds that surrounded
the imposing building occupied by British General Headquarters at
Salonika. As we climbed the steps leading to the front door, warmly
expectant of a welcome by reason of our information from South
Russia, an orderly pointed out that this entrance was reserved for
Big Noises and By-No-Means-Little Noises. We swerved aside, and
entered an unpretentious side-door, labelled "Officers Only."
"Wojer want?" asked a Cockney Tommy, who sat at a desk inside it.
"Nah, look 'ere, civvies," he instructed, "yer speak English well inuf.
Carncher read it? The notice says 'Officers Only', an' it means only
officers. Dagoes 'ave ter use the yentrance rahnd the corner, so aht
yew go, double quick."
"Yes."
"Been expecting you. The Greek contractor's sons, aren't you?"
Of all the cities in the Near and Middle East Damascus is at once the
most ancient, the most unchanged by time, the most unreservedly
Oriental, and the most elusive.
Far away to the right we could see from our height of 6,000 feet the
ghostlike outline of the Dead Sea behind the bleak-ridged hills
beyond Jericho. To the left were the shining sea, white-roofed Jaffa,
and the lines of sand dunes that curved in and out of the coloured
country-side. Ahead and around were brown surfaces of grain land
and green blotches of woodland, interspaced with gray-gleaming
villages.
Soon the Bristol Fighter droned over what had been the old front of
Allenby's left flank, with uneven trenches snaking southeastward
from the sand-bordered coast to the Jordan basin. The Jordan itself
twisted and writhed through its green-and-gold valley, over which
occasional trenchworks zigzagged. Then came the hill desolation of
Lower Samaria. Near Shechem I reached out a fur-gloved hand and
showed my passenger the approximate spot where, seven months
earlier, I was shot down and awoke to find Arab nomads
approaching my wrecked machine. Slightly to the west was
Nazareth, perched pleasingly on high ground.
Far away to the west was Mount Lebanon, and from it stretched a
line of mountains, growing ever bleaker as they neared the Syrian
Desert. The low ground dominated by the heights was a maze of
forests, wheat-fields, pasturage, and orchard land, intermingled with
patches of sand. Straight ahead was the ancient city of Damascus, a
straggling surface of white roofs pierced by the domes and minarets
of many mosques, all in a gray whiteness, as if powdered with the
dust of its four thousand years of history. Pharpar and Abana, the
twin rivers of Damascus, showed up plainly as, converging and
diverging, they descended from their sources on the rim of the
mountain, and lost themselves in the jig-saw of crooked streets and
square-topped houses. The background is the wide, shimmering
desert that loses itself on the eastern horizon.
"Nay, rather speak kindly and apply gentle pressure to the under-
parts. Then will it lift its forefeet and stand erect. Stubborn donkeys
care naught for blows."
"O thou unfortunate one! He had a money-purse, and it has left him.
O thou unfortunate one!"
And although all knew that the purse was probably hidden in the
folds of some Arab's robe, those near the unfortunate one searched
and scratched the ground, probably none more assiduously than the
man who could have produced it.
Now if the period had been two months earlier a Turkish gendarme
would have taken the donkey-owner apart, and, if he failed to offer
a bribe, shot his prostrate beast and hauled its carcase to the
roadside. As likely as not it would have been the gendarme who
stole the unfortunate one's money.
"Damned old fool of a moke," said the man in shorts; then bent
down and alternately stroked, pushed, and spoke to the donkey.
Somehow he persuaded it to rise and start walking. The crowd
disentangled itself and its animals from each other, and dispersed.
And the man in shorts, his cigarette still dangling from the left-hand
corner of his mouth, passed on, as casual and unsurprised as if he
had been in Brixton or Birmingham.
For many a day the talk in the bazaars had been of a new Arabian
Empire, as a reward for the exploits of King Hussein's Arabs—
exploits that had not only freed Arabia and helped to free Syria, but
had involved the abolition of all blood-feuds in a thousand miles of
semi-lawless country. The Emir Feisul, son of King Hussein (and thus
a direct descendant of the Prophet), was on his way to the Peace
Conference in Paris, accompanied by Colonel Lawrence, the young
Englishman who was the soul of the Arab national revival, and of the
Arabs' epic campaigns between Mecca and Damascus. And many
citizens of Damascus were hoping that he would return with the
realization of their dreams that the city was to be the centre of pan-
Arabian greatness.
My enquiries at Baranki Barracks, and in the offices of the British
Provost-Marshal and the Arab gendarmerie, failed to trace the fate of
George; and I had to be content with the memory of a futile little
figure standing on the steps of our railway carriage, on the morning
after our betrayal, and saying, with despair in his voice: "I have so
little courage. I ask pardon."
Of the other intimate characters in the story I can account for all but
two. Jean Willi, the Israelite dragoman who was my benefactor at
Nazareth, has not yet given me the chance to pay back in part the
good deeds that I owe him; but I still have hopes. And I can only
guess at what has happened to Michael Ivanovitch Titoff, now
somewhere behind the screen which, since the Bolshevist
reoccupation of last spring, separates Odessa from the normal
world. From what I know of his character I am certain that when the
Soviet troops arrived he proclaimed himself a Bolshevist, and took
full advantage of the conditions whereby the unrighteous have
special opportunity to flourish.
Another happy ending, almost too good to be true, was the recent
wedding of Colonel Newcombe and Mlle. "X", the girl who arranged
his escape from Broussa and concealed him in Constantinople while
he worked for a withdrawal of Turkey from the war.
Mr. S., the British merchant who jeopardized his neck in helping no
less than seven British officers to liberty, has returned to England,
and should be conscious of much merit.
Often I have left the satisfying solidity of London, the restful beauty
of a Thames backwater, the comforting hospitality of New York, the
wealth-conscious heartiness of Chicago, to hear the chanted
summons to prayer from the minaret that faced my prison in
Damascus, watched the intrigues that coloured Constantinople
during the twilight of the Turkish Empire, discuss Bolshevism and the
price of revolvers with Vladimir Franzovitch, as he sits on a camp
bed in his tiny room at Odessa.
THE END
THE COUNTRY LIFE PRESS
GARDEN CITY, N.Y.
*** END OF THE PROJECT GUTENBERG EBOOK EASTERN NIGHTS -
AND FLIGHTS: A RECORD OF ORIENTAL ADVENTURE. ***
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
ebookbell.com