Add-In'sAn add-in is a special kind of application that a developer can incorporate directly into the Visual Basic development environment. The Add-In Manager installs add-ins in the environment's Add-Ins menu. The developer can then call on the add-ins to make routine programming chores easier. Creating an add-in is a simple but detailed task. Add-ins are designed to automate such tasks. Chapter 4 PropertySetter PropertySetter allows an application developer to examine and modify the properties of many controls all at once. This is particularly helpful for changing properties that the Visual Basic development environment will not change in a group. For instance, Visual Basic will change the Name property of more than one control at one time. Suppose an application includes a control array named Address that contains 50 controls. Changing the array's name to StreetAddress is a lot of work. The developer must select each of the 50 controls individually and change their names one by one. PropertySetter allows the developer to select all of the controls and change their names in a single step. A developer must install an add-in before it can be used. The following section, installing PropertySetter, explains how to place an add-in in the Add-Ins menu using the Add-Ins Manager. The next section, Using PropertySetter, describes this add-in's main features from the user's point-of-view. It explains how a developer can use PropertySetter to examine and modify property values in the design environment. The Key Techniques section briefly lists the most important Visual Basic programming methods used to implement PropertySetter. The rest of the chapter describes these methods in detail. Unfortunately, many of the details of creating an add-in are different in Visual Basic 4 and Visual Basic 5. The following sections explain the differences as they describe the different steps required to build an add-in. Installing PropertySetter Before an add-in can be used, it must be installed in the development environment's Add-Ins menu. This section describes the installation process from the developer's point-of-view. It does not explain the steps necessary to prepare the add-in for installation. Those steps are described in later sections. To install the PropertySetter add-in, the developer first selects the Add-In Manager command from Visual Basic's Add-Ins menu. Figure 4.1 shows the Add-In Manager. After selecting the PropertySetter add-in, the developer clicks the OK button and the Add-In Manager installs the add-in.
Figure 4.1:The Add-In Manager. Removing an add-in is just as simple. The developer opens the Add-In Manager, unchecks the box next to the add-in's name, and presses the OK button. Using PropertySetter The ExpenseReporter and AppointmentBook applications described in Chapters 1, 2, and 3 are designed for use by typical business users. Add-ins, on the other hand, are designed to assist application developers. The end users of these programs are Visual Basic programmers. This section explains how an application developer can use the PropertySetter add-in, assuming the add-in is correctly built and installed. Later sections explain how to build an add-in. Before using PropertySetter, the developer should select a group of controls on a form in the Visual Basic development environment. The Set Properties... command in the Add-Ins menu will then activate PropertySetter, displaying a dialog similar to the one shown in Figure 4.2. In this example, the developer selected four controls called NameLabel, CmdOk, AddressLabel, and CmdCancel.
Figure 4.2: The PropertySetter add-in. The developer can then enter the name of a property in the Property text box. Pressing the Get Values button makes PropertySetter display the selected controls' property values. In Figure 4.2, PropertySetter is displaying the values of the controls' Caption properties. To change a property value, the developer should enter the property name as before, and place the new value in the New Value text box. When the developer clicks the Set Values button, PropertySetter updates the property for each of the selected controls. Both the Get Values and Set Values commands work only for controls that actually have the indicated property. For example, Figure 4.2 shows PropertySetter with two labels and two command buttons selected. Suppose the developer enters Default into the Property text box and clicks presses Get Values. Since command buttons have a Default property but text boxes do not, PropertySetter will return values only for the command buttons. PropertySetter provides four menu commands. The File menu's Close command closes PropertySetter. The Get Values and Set Values commands on the Properties menu duplicate the functions of the command buttons. They are provided as menu commands for convenience, and they support the short cut keys Ctrl-G and Ctrl-S. The Help menu's About PropertySetter... command presents an about dialog. Like other about dialogs, this one gives version and copyright information. It also gives a brief explanation of how to use PropertySetter. This gives PropertySetter some simple help with a minimum of effort. [Home Page] [Tutorial Page] [Main Add-In Page] [Next Lesson]
|
Quick searches: Site Search | Advanced Site Search |
|
By using this site you agree to its terms and conditions VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc. |