home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK7
/
data.7
/
datab
/
HELP
/
PROGUIDE.INF
(
.txt
)
Wrap
OS/2 Help File
|
1996-07-26
|
1MB
|
13,564 lines
笊絶武笊 1. Version Notice 笊絶武笊
First Edition (June 1996)
This edition applies to Version 1 Release 1 of IBM VisualAge for Basic and to
any subsequent releases until otherwise indicated in new editions or technical
newsletters. Make sure you are using the correct edition for the level of the
product.
Order publications through your IBM representative or the IBM branch office
serving your locality. Publications are not stocked at the address below.
A form for readers' comments is provided at the back of this publication. If
the form has been removed, address your comments to:
IBM Corporation, W92/H3
P.O. Box 49023
San Jose, CA, 95161-9023
U.S.A.
When you send information to IBM, you grant IBM a nonexclusive right to use or
distribute the information in any way it believes appropriate without
incurring any obligation to you.
(c) Copyright International Business Machines Corporation, 1996. All
rights reserved.
(C) Copyright Visual Edge Software Ltd., 1993, 1996. All rights reserved.
笊絶武笊 2. Notices 笊絶武笊
References in this publication to IBM products, programs, or services do not
imply that IBM intends to make these available in all countries in which IBM
operates. Any reference to an IBM product, program, or service is not intended
to state or imply that only that IBM product, program, or service may be used.
Any functionally equivalent product, program, or service that does not infringe
any of the intellectual property rights of IBM may be used instead of the IBM
product, program, or service. The evaluation and verification of operation in
conjunction with other products, except those expressly designated by IBM, are
the responsibility of the user.
IBM may have patents or pending patent applications covering subject matter in
this document. The furnishing of this document does not give you any license to
these patents. You can send license inquiries, in writing, to the IBM Director
of Licensing, IBM Corporation, 500 Columbus Avenue, Thornwood, NY 10594, U.S.A.
Licensees of this program who wish to have information about it for the purpose
of enabling: (1) the exchange of information between independently created
programs and other programs (including this one) and (2) the mutual use of the
information which has been exchanged, should contact IBM Corporation,
Department J01, 555 Bailey Avenue, San Jose, CA 95161-9023. Such information
may be available, subject to appropriate terms and conditions, including in
some cases, payment of a fee.
笊絶武笊 2.1. Programming Interface Information 笊絶武笊
This publication is intended to help the customer write programs in VisualAge
for Basic. This publication documents General-use Programming Interface and
Associated Guidance Information provided by VisualAge for Basic.
General-use programming interfaces allow the customer to write programs that
obtain the services of VisualAge for Basic.
笊絶武笊 2.2. Trademarks 笊絶武笊
The following terms are trademarks of the IBM Corporation in the United States
or other countries or both:
AIX IBM
AIX/6000 OS/2
Common User Access SOMobjects
CUA WIN-OS/2
DB2 VisualAge
Visual Edge is a trademark of Visual Edge Software, Ltd.
Microsoft, Windows, and the Windows 95 logo are trademarks or registered
trademarks of Microsoft Corporation.
Other company, product, and service names, which may be denoted by a double
asterisk (**), may be trademarks or service marks of others.
笊絶武笊 3. About This Book 笊絶武笊
This guide describes how to use the VisualAge for Basic visual development
environment to create graphical user interface (GUI) applications. To install,
develop, test, and run a VisualAge for Basic client/server application program,
you work with the following environments:
Client environment: In the client environment, you can build and run client
applications on OS/2, Windows 95, or Windows NT. If you have installed DB2
support, you can also write server procedures in these environments. You can
build and distribute DB2 server procedures for DB2 on OS/2, Windows 95, Windows
NT, and AIX.
Server environment: In the server environment, you can run applications on
OS/2, Windows 95, Windows NT, and AIX. If you have installed DB2 support, you
can also run server procedures in these environments.
笊絶武笊 3.1. Who Should Use This Guide 笊絶武笊
This guide is intended for:
Casual programmers who build simple GUI applications.
Application developers who build prototypes and reusable application
units.
Advanced programmers who build classes, customize VisualAge for Basic,
and distribute applications.
Application programmers who access DB2 for OS/2, Windows 95, Windows NT,
and AIX from GUI applications.
笊絶武笊 3.2. Before You Read This Guide 笊絶武笊
This guide assumes:
You are familiar with your operating system.
You understand the functions of the mouse buttons.
笊絶武笊 3.3. How this Book Is Organized 笊絶武笊
This book contains the following parts:
Part 1 Working with VisualAge for Basic Tools, explains how to use VisualAge
for Basic tools to build your application's user interface, by creating the
objects on your interface, setting their properties, and creating menus. It
also explains how to use the Code Editor to test and debug your application
code.
Part 2 Writing Code, teaches you how to add behavior to your VisualAge for
Basic objects. It also explains how to apply object-oriented programming
techniques, such as defining classes. Finally, it explains how to code your
program to handle errors.
Part 3 Integrating with External Systems, explains how to integrate your
program with other programs, via dynamic link libraries (DLLs), System Object
Manager (SOM), Object Linking and Embedding (OLE), and OpenDoc. It also
describes how to communicate with hosts, servers, and other applications. It
explains VisualAge for Basic's database support, which includes embedded SQL
calls, and direct calls to CLI and ODBC databases. Finally, it explains how to
invoke DB2 stored procedures from a Windows NT or Windows 95 client.
Part 4 Advanced Techniques, tells you how to generate cross-platform
applications, and improve your application. It also describes how to prepare
your completed program for delivery to other users.
Part 5 Appendixes, tells how to customize your VisualAge for Basic
environment, migrate your Microsoft Visual Basic** applications to VisualAge
for Basic, and internationalize your application. It also provides a complete
glossary of VisualAge for Basic terms.
笊絶武笊 3.4. Related Information 笊絶武笊
The following table describes the VisualAge for Basic library:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5itle 笏ocation 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏uilding and 笏0nline book: 笏xplains how to create and adapt objects from笏
笏onverting Parts: 笏Bvbb0000.inf 笏Pther object systems so that they can be 笏
笏C26-8830-00 笏 笏Bdded to the visual developmet environment as笏
笏 笏 笏Pbjects. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ata Access Guide: 笏0nline book: 笏xplains how to create, test, distribute, and笏
笏4C26-8692-00 笏Bvbd0000.inf 笏Dall stored procedures and user-defined 笏
笏 笏 笏Gunctions. The examples in this book require 笏
笏 笏 笏Uhe DB2 SDK version of VisualAge for Basic. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nstallation 笏5ext file: 笏escribes how to install and configure . 笏
笏nstructions 笏Jnstall.txt 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nterface help 笏0nline help 笏1rovides help for all interface items 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏anguage Reference 笏0nline help 笏1rovides detailed information on the 笏
笏4C26-8693-00 笏 笏Domponents, events, functions, methods, 笏
笏 笏 笏Qroperties, and statements. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rogramming Guide 笏0nline book: 笏xplains how to create GUI application in the笏
笏4C26-8833-00 笏Bvbp0000.inf 笏Wisual development environment. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5ask help 笏0nline help 笏1rovides step-by-step instructions for tasks笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4OMobjects User's 笏0nline book: 笏5ells how to create SOM object-oriented class笏
笏uide: SC23-2680-01 笏Dppwsomg.inf 笏Mibraries in C or C++. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4OMobjects Program 笏0nline book: 笏escribes each class, method, function, and 笏
笏3eference: 笏Dppwsomr.inf 笏Nacro defined in the SOMobjects Base Toolkit.笏
笏4C23-2681-01 笏 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
For more information about designing user interfaces, see:
OSF/Motif Style Guide, release 1.2
(Prentice Hall, 1993, ISBN 0-13-643123-2)
Visual Design with OSF/Motif
(by Shiz Kobara, Addison-Wesley, 1991, ISBN 0-201-56320-7)
Common User Access: Guide to User Interface Design
(IBM Corporation, 1991, SC34-4289)
The Windows Interface: An Application Design Guide
(Microsoft Corporation, 1992, document no. PC28921-0692)
Apple Human Interface Guidelines: The Apple Desktop Interface
(Addison-Wesley, 1987, ISBN 0-201-17753-6)
笊絶武笊 4. Part 1 Working with VisualAge for Basic Tools 笊絶武笊
笊絶武笊 5. Chapter 1 Quick Tour of VisualAge for Basic 笊絶武笊
The VisualAge for Basic visual development environment lets you develop
applications and server procedures using a set of reusable objects. In addition
to visual programming, VisualAge for Basic supports event-driven,
object-oriented programming.
You can integrate your VisualAge for Basic programs with other object systems
using: Object Linking and Embedding (OLE), System Object Model (SOM), OpenDoc,
and OLE custom controls (OCXs). You can communicate with other hosts and
programs using the communication components. Finally, you can write complete
client/server applications, call external databases, and extend VisualAge for
Basic by integrating your own or third-party objects.
This chapter provides an overview of VisualAge for Basic's features and
documentation. It also provides a quick tour of how to develop an application
in VisualAge for Basic.
笊絶武笊 5.1. Some Terminology 笊絶武笊
In VisualAge for Basic, forms are windows you use to design the graphical
interface of the major windows presented by your application. You can use other
kinds of windows with your application, such as pop-up windows for selecting
files or presenting messages. Each form has many associated attributes, or
properties. Some of these properties you set at design time, while others are
set by user actions at run time.
The forms contain other objects called components. Text boxes, command buttons,
and option buttons are just a few of the components that you place on forms.
Each component also has specific properties associated with it, which are set
in the same way as form properties.
Forms and components wait for the user to take an action, such as typing text,
moving a mouse, or clicking a mouse button. When these actions, or events
occur, they generate various system messages that interact with your code.
You write the code to respond to these events. This code is event-driven;
unlike traditional programs that force users to follow a predefined path,
event-driven programs respond to users, and allow them to control the flow of
execution.
笊絶武笊 5.2. How Do I Develop an Application? 笊絶武笊
To develop an application, follow these steps:
1. Start VisualAge for Basic
2. Create the user interface
3. Set properties
4. Program the behavior of objects
5. Run the application
6. Save the application
Each of these tasks is covered in greater detail later in this book and in the
online help. This section gives you a quick tour of these tasks, so that you
can start programming immediately.
This section shows you how to build a very simple application, called Touchy
Buttons. You will create a form with a text box and two buttons. The text
displayed in the text box depends on which button you press.
笊絶武笊 5.2.1. Starting VisualAge for Basic 笊絶武笊
To start VisualAge for Basic, double-click on the VisualAge for Basic icon .
The following windows appear on your screen:
笊絶武笊 5.2.1.1. Project window 笊絶武笊
The Project window is the main window of VisualAge for Basic. To help you
organize your work, it lists, in outline form, the objects contained in a
VisualAge for Basic project. The Project window contains a menu bar, tool bars,
an information line, and an outline area.
The information line displays information on each button or menu selection you
choose.
Tip: To access interface online help, click in the outline area and press F1.
See also: Chapter 2, Using the Project Window.
笊絶武笊 5.2.2. Creating the User Interface 笊絶武笊
The first step in creating an application is to develop your user interface.
The following sample interface contains two command buttons and a text box on a
form. After you complete Step 1 through Step 4, your sample interface should
look like this:.
Tip: VisualAge for Basic has a multiple undo feature. If at any time you make
a mistake selecting Edit=>Undo in the Project window undoes your mistake. The
order of the Undo and Redo operations are done in the same sequence as they
were performed.
笊絶武笊 5.2.2.1. Step 1. Create a Form 笊絶武笊
When you begin, a blank form titled Form1 automatically appears. If you would
like to create additional forms, follow the steps listed below. The rest of
this section assumes that you don't create a second form, so the figures show
Form1.
To create a form, choose File=> New form from the Project window, or click on
the tool bar icon .
VisualAge for Basic creates a new form titled Form2.
笊絶武笊 5.2.2.2. Step 2. Draw Components on the Form 笊絶武笊
Next you need to add visual objects for your form-a text box and two command
buttons. To draw the components:
1. Click on the Text Box component in the Toolbox using:
On Windows NT and Windows 95: the left mouse button.
On OS/2: the right mouse button.
2. Move the mouse over the form and click on the form.
A single Text Box appears using its default size setting.
When you release the mouse button, the text box appears on the form with
selection handles surrounding it. The component is drawn with a default height
and width. You can resize and move components to refine the appearance of the
interface.
Repeat steps 1 through 3 twice, selecting the Command Button component each
time, to create two command buttons on your form.
笊絶武笊 5.2.2.3. Step 3. Resize Your Components 笊絶武笊
To change the size of your components, follow these steps:
1. Click on a component with the left mouse button.
Selection handles appear around it, indicating that the component is
selected. (You must select a component before you can resize it.)
2. Move the pointer onto one of the selection handles.
The cursor changes to a double sided arrow ( , , , or ).
3. To drag the component:
Windows NT and Windows 95: Press and hold the left mouse button.
OS/2: Press and hold the right mouse button.
4. Drag the bottom right corner handle to change the size of the component.
An outline of the component's new size appears as you drag the handle.
Tip: When you move or resize your component on the form, a grid appears
facilitating your component alignment.
5. Release the mouse button.
The component resizes to the position of your release mouse button.
笊絶武笊 5.2.2.4. Step 4. Moving a component: 笊絶武笊
To move a component, follow these steps:
1. Position pointer over component, and click the appropriate mouse button.
2. Drag the component to its new location. An outline of the component
appears as you move it.
3. Release the mouse button. The component moves to its new position.
笊絶武笊 5.2.2.5. Step 5. Deleting a component: 笊絶武笊
To delete a component follow these steps:
1. Select the component.
2. Choose Edit=>Delete, Edit=>Cut, or press the Delete or Ctrl+X keys. The
component is deleted from the form.
See also: Chapter 3, Using the Toolbox and Visual Objects.
笊絶武笊 5.2.3. Setting Properties 笊絶武笊
Next you need to set properties for the three new components. You use the
Property Editor to set these properties. When you select a component on your
form, its properties appear in the Property Editor. For your program, Touchy
Buttons, you need to set the following properties-the caption for your form,
the initial text for the text box, and the names of the buttons.
Tip: To access language online help for any property in the List of
Properties, highlight the property and press F1. To access interface online
help, select the area of the interface and press F1.
1. To access the Property Editor for your form, click on your form and do
one of the following:
Select the Project window Window=>Property Editor menu item.
Click the Project window Property Editor button
The Property Editor appears displaying your form's name in the object
list area and a list of all its properties in the list of properties.
By default, the Property Editor displays the properties for all selected
objects in the current form.
To customize components you set the component's properties using the
Property Editor.
Tip: If you mistype or insert an incorrect value, the Property Editor
does not accept the error. A warning message appears, and the invalid
value is highlighted with an X. To remove the error, acknowledge the
error dialog box and re-insert the correct property value.
See also: Chapter 4, Using the Property Editor..
2. To change the text that appears in your form, locate the Caption property
and select the word Caption.
3. In the Caption edit area, where the word Form1 appears, remove the word
Form1 and type in Touchy Buttons.
4. Press Enter or click on the Apply button. The Form1 Caption accepts the
change and the name on Form1 changes.
Tip: If you change a property value and forget to click on another property,
or press the accept button, a warning dialog appears when you change the focus
to another component. To accept the change select OK.
Repeat these steps for the other components. Remember that you must click on
the component to load it into the Property Editor.
To have a blank text box initially, leave the value for the Text field empty.
The following table shows the values to use for these properties:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0bject 笏1roperty 笏7alue 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5ext Box 笏5ext 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommand Button 1 笏aption 笏lick Me 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommand Button 2 笏aption 笏o Not Click Me 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
See also: Chapter 4, Using the Property Editor for a detailed description of
how to use the Property Editor.
笊絶武笊 5.2.4. Programming the Behavior of Objects 笊絶武笊
You add behavior to objects by writing VisualAge for Basic code in the Code
Editor. You can open the Code Editor in several different ways:
Choose Window=> Code Editor from the Project window.
Click on the Code Editor icon in the Project window tool bar
Select a form from the Project window, and choose Selected=> Open code
Double-click on the object.
The Code Editor contains a menu bar, tool bars, a status line help area, a
navigation area, and a code area.
VisualAge for Basic code consists of event procedures. An event procedure
defines what happens when a user performs a certain action. For your Touchy
Buttons program, you need to define what happens when the user clicks a
button. Therefore you need two event procedures, one for each of your command
buttons.
See also: Chapter 6, Using the Code Editor.
笊絶武笊 5.2.4.1. Write Your Event Procedures 笊絶武笊
1. Move the pointer onto the Code Editor.
2. From the Object/Class drop-down selection box, select the down arrow to
view the list of objects. Select Command1.
3. Ensure that the Click event is selected in the Event/Method box. When you
select the name of an event or method, a template for the event or method
procedure appears in the text editor. VisualAge for Basic gives the
procedure a default name, based on the name of the component. For
example, the template for a Click event procedure for a command button
looks like this:
Sub Command1_Click()
End Sub
4. Click in the code area and type the following code for the Click Me
button between the Sub and End Sub statements. Use dot notation to
identify the object and the attribute, in the format: object.attribute.
Sub Command1_Click ()
Text1.Text = "Ahhh..."
End Sub
5. From the Object/Class box, select Command2, your second command button.
6. Click in the text window, and type the following VisualAge for Basic code
for the Don't Click Me button:
Sub Command2_Click ()
Text1.Text = "Ouch!"
End Sub
See also: Scripting Objects for more information on writing VisualAge for
Basic code.
笊絶武笊 5.2.4.2. Checking the Syntax 笊絶武笊
When VisualAge for Basic is in design mode, you can perform a manual syntax
check whenever you want. You can begin a syntax check in one of the following
ways:
Choose the Debug=> Check Syntax command from the menu bar.
Click on the Check Syntax button on the tool bar.
If you do not check your syntax before entering run mode, VisualAge for Basic
checks for syntax errors before running your application. If an error occurs,
the run-mode selection stops and an error drop-down box appears under the Code
Editor.
If you have typed in this entire example, there might be typographical errors.
Don't be discouraged, finding and correcting them is easy.
1. To go to the place in your code where the error occurs, either
double-click on the drop-down box error, or highlight the error line and
select the Go To button.
The code area displays the first syntax error from the bookmark area
list. The line of code containing the error is identified by the syntax
error icon
2. Correct your error.
3. To double-check that the error has been corrected, either repeat the
run-mode selection, or select the Check Syntax button
The Code Editor's status area has an icon that toggles between two states to
act as visual confirmation of whether or not the syntax has been checked-the
Verified Syntax icon and the Unverified/Error icon
笊絶武笊 5.2.5. Running Your Application 笊絶武笊
You start your application, switching from design mode to run mode, in one of
the following ways:
Choose Run=>Start/Continue from the menu bar.
Click the Start/Continue button on the tool bar.
On OS/2: Press F7.
On Windows NT and Windows 95: Press F5.
VisualAge for Basic checks for syntax errors, then begins execution of your
application if there are no errors. You work with your application as would an
end-user, making sure that your VisualAge for Basic application responds to
input as expected.
Platform-specific information: Shortcut keys (such as F5 and F7) vary from
platform to platform. To see the shortcut for a menu item, simply look to the
right of the item in the menu.
笊絶武笊 5.2.6. Return to Design Mode 笊絶武笊
Click on the Stop icon in the tool bar of the Code Editor or the Project
window, or
Choose Run=> End from the Project window.
See also: Chapter 7, Testing and Debugging Code for more information on
testing VisualAge for Basic code.
笊絶武笊 5.2.7. Saving Your Work 笊絶武笊
You have completed coding the project. By default, VisualAge for Basic saves
the forms contained in your applications with .i file extensions.
The first time you save a file or project, VisualAge for Basic prompts you for
a file name for each form in your project and for a project name.
1. Select File=>Save As in the Project window. A file dialog box appears.
Type in your new file name.
2. Type in the file name for form1.i
3. Select the directory where you will store your completed project and save
the .i file. The new .i file name is updated in the Project window list
of files.
4. You are prompted to save the form. Type in the filename.i and select OK.
5. The next prompt is the name of the project. Type in the name of your
project with the .prj extension and select OK.
The file, form1.i, appear in the Project window. The project name,
testname.prj, appears in the title bar of the Project window.
笊絶武笊 5.2.8. Exiting VisualAge for Basic 笊絶武笊
To exit VisualAge for Basic, choose File=> Exit from the Project window.
笊絶武笊 5.3. How Do I Get Help in VisualAge for Basic? 笊絶武笊
VisualAge for Basic provides a wide array of information, both printed and
online. It also provides sample applications and coding examples online. This
section explains where to look when you need help using VisualAge for Basic.
笊絶武笊 5.3.1. Where do I look first? 笊絶武笊
All VisualAge for Basic information is available online, in either integrated
online help, or in online books (.inf files). For help navigating the VisualAge
for Basic user interface and for help with specific tasks, consult the online
help. Use this book, VisualAge for Basic Programming Guide, to learn about the
VisualAge for Basic development process, and for help on more complex tasks,
such as managing data and integrating with other programs.
The following table provides a list of tasks, and where to look for help on
these tasks.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏or help on... 笏4ee... 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nstalling 笏nstallation information 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ustomizing 笏ustomizing VisualAge for Basic 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏earning VisualAge for Basic 笏1art 1, Working with VisualAge for Basic笏
笏 笏5ools, Online Help 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oding 笏1art 2, Writing Code 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏avigating the user interface 笏0nline Help 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4pecific language elements 笏0nline Language Reference Help 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏omponents and objects 笏0nline Language Reference Help 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reating, calling and browsing server 笏ata Access Guide 笏
笏Qrocedures 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 5.3.2. Online Help 笊絶武笊
You can access online help in several ways:
By selecting the Help menu on any VisualAge for Basic window. See Using
the Project Window for additional information about the Help menu.
By searching for a topic. This feature is platform specific; for
information on how to search for a topic, select Help=>How to use help.
By the context-sensitive help button and clicking on a Toolbar button,
you can get context-sensitive help for that button.
By clicking in any VisualAge for Basic window and pressing F1. Help for
that window is displayed. You can then get detailed help on any area in
the window.
笊絶武笊 5.3.3. Copying Code Examples 笊絶武笊
Many of the help panels provide code examples that you can copy and paste
directly into the Code Editor window. To copy code examples into the Code
Editor:
1. Select the appropriate language element in the Language Reference section
of the Online help system.
2. Click on the Example, located at the bottom of the window. The Examples
window appears containing sample code for that language element.
3. On Windows NT and Windows 95: Click on Copy. An editing window is
displayed. Use your mouse to highlight the code to copy and click on the
Copy button. Your selection is copied to the clipboard.
On OS/2: Click the right mouse button, and click Copy in the pop-up menu.
The example is copied to the clipboard.
4. Within the Code Editor, click to select the location where the text will
be inserted. Select Edit=>Paste. The stored text from the clipboard is
transferred to the Code Editor at your insertion point.
These examples are located in the samples\langref directory. You can view them
using a text editor or the VisualAge for Basic online help. You can copy and
paste them into your code modules in the VisualAge for Basic Code Editor and
then run them or modify them to suit your needs.
To see one of the examples:
1. From the VisualAge for Basic Project window or Code Editor, select
Help=>Language reference.
2. Click on Beep statement.
3. Click on More or Example.
4. Click on Example. (On OS/2, double-click to select hyperlinks.)
Tip: If you are running VisualAge for Basic client on OS/2 and you do not see
the examples in the online help, change the VisualAge for Basic working
directory to samples\langref by taking the following steps:
1. In the VisualAge for Basic folder, click with the right mouse button on
the VisualAge for Basic icon.
2. In the Settings notebook, select the Program page.
3. In the Working directory text box, specify the directory where you have
installed VisualAge for Basic and add samples\langref.
4. Double-click on the VisualAge for Basic icon.
Now try the procedure above to see the Beep statement example.
笊絶武笊 5.3.4. Sample Programs 笊絶武笊
All VisualAge for Basic sample programs are in the directory
\VisualAge_dir\samples. VisualAge for Basic provides a number of samples that
you can copy from. Please see the readme.txt file for information on the
samples provided.
笊絶武笊 5.4. What Else Can I Do With VisualAge for Basic 笊絶武笊
You can use VisualAge for Basic to build comprehensive, complete applications
with graphical user interfaces (GUIs). To create the user interface, you select
from a set of reusable objects, set the properties of these objects, and then
define how these objects behave by writing code. Then you test your code by
running it, and debug it if necessary. Finally, if you plan to distribute your
application to other users, you need to save it as an executable file. The
VisualAge for Basic programming environment supports each of these basic tasks.
VisualAge for Basic also provides a wide range of features to help you extend
your application. These features are described in the following sections.
笊絶武笊 5.4.1. Object-Oriented Programming 笊絶武笊
Although you don't need to understand object-oriented programming to use
VisualAge for Basic, it does support this programming technique. With
object-oriented programming, you define classes of objects, which are like
templates that define a set of objects. In object-oriented programming, an
object is an instance of a class. You define subclasses of existing VisualAge
for Basic objects, in order to create your own custom objects. You can call SOM
communication classes, as you would to any other integrated part.
See also: Chapter 12, Object-Oriented Programming.
笊絶武笊 5.4.2. Integrating Components 笊絶武笊
Using VisualAge for Basic's drag-and-drop visual development environment, you
can integrate classes and components created in non-Basic languages and using
external object systems into your VisualAge for Basic applications. Components
can be created in Microsoft Visual Basic, C++, and other languages using:
On OS/2: SOM and OpenDoc
On Windows NT and Windows 95: SOM, OLE 2, and OCX
See also: Chapter 14, Integration Overview.
笊絶武笊 5.4.3. Linking to OpenDoc Documents 笊絶武笊
VisualAge for Basic enables you to link an OpenDoc document part to a form
within your application. Drag the OpenDoc Container component to a form. You
can then link it to an existing OpenDoc document. You must install the OpenDoc
Runtime to make the link active.
See also: Chapter 18, Using OpenDoc Documents.
笊絶武笊 5.4.4. Accessing Data 笊絶武笊
On the Windows NT and Windows 95 client platforms, you can access data using a
visual GUI data control and coding to the data access classes.
On OS/2, Windows 95, and Windows NT, you can access data by embedding SQL
calls in your VisualAge for Basic with DB2 support applications. You can also
make function calls to DB2 CLI or ODBC.
笊絶武笊 5.4.5. Programming in DB2 SQL 笊絶武笊
VisualAge for Basic supports DB2 SQL programming for both client and server
environments. To use the DB2 SQL programming option, make sure the IBM DB2
Software Developers Kit is on your system, and when installing VisualAge for
Basic, select the SDK version.
If you just want to access non-IBM databases, or build GUI client applications
without database access, VisualAge for Basic provides a smaller, non-SDK
version that you can select during installation.
See also: For information on writing server procedures, see the Visual Age for
Basic Data Access Guide.
笊絶武笊 5.4.6. Controlling Communications 笊絶武笊
VisualAge for Basic provides communication components to support access to
hosts, servers, and other applications via the following communication
protocols:
Advanced program-to-program communication (APPC)
Asynchronous communication (ASYNC)
High Level Language Application Programming Interface (HLLAPI)
Network Basic Input/Output System (NetBIOS)
Transmission Control Protocol/Internet Protocol (TCP/IP)
笊絶武笊 5.4.7. Migrating from Microsoft Visual Basic** 笊絶武笊
If you are familiar with Visual Basic, you will find the transition to
VisualAge for Basic an easy one. VisualAge for Basic supports the Visual
Basic** language, while extending it in several ways. In VisualAge for Basic,
you can load and run your Visual Basic** programs that have been saved in text
format.
See also: Appendix B, Migrating Microsoft Visual Basic** Programs.
笊絶武笊 6. Chapter 2 Using the Project Window 笊絶武笊
When you first open VisualAge for Basic, the Project window displays with a
default project, called untitled.prj, the Toolbox, and a blank form called
Form1. You use the Project window to manage your projects and all the objects
that make up your project. You also have access to all the other VisualAge for
Basic tools, editors, and browsers you use to develop your applications, stored
procedures, and user-defined functions.
This chapter describes:
What is a project?
What is provided by the Project window.
What you can do using the Project window.
See also: Chapter 3, Using the Toolbox and Visual Objects for information on
using the Toolbox and forms to create user interfaces.
笊絶武笊 6.1. What is a Project? 笊絶武笊
A project is the collection of all of the objects that make up:
An application.
A stored procedure.
A user-defined function.
Project objects can be any of the object types in the Project window outline
area. For example, a project for a client application might contain:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0bject 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏orms 笏ake up the user interface 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odules 笏1rovide the application behavior 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Donstant.bas 笏7isualAge for Basic declaration file 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4OM objects and OLE objects 笏xternal objects that provide additional笏
笏 笏Gunctionality 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Whereas, a project for a stored procedure typically includes:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0bject 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odules 笏5he procedure source files 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Donstant.bas, sqlca.bas 笏7isualAge for Basic declaration files 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏uild files 笏4tored procedure definition file, or .sp笏
笏 笏Gile 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
VisualAge for Basic records information about your project in a project file.
When you first start VisualAge for Basic, a project file called untitled.prj
is opened so you can start developing your project right away. Of course, you
can rename the project using File=> Save Project As.
Important: Projects must have a .prj extension.
笊絶武笊 6.2. What the Project Window Provides 笊絶武笊
The Project window provides:
An outline area with information about your current project.
Menus of commands for manipulating your projects and project objects.
Toolbar buttons for quick access to the most frequently used menu
commands.
An information line that describes the item currently pointed to by the
mouse.
Tip: VisualAge for Basic provides context-sensitive help for all the major
interfaces, such as the Project window. Click in the outline area of the
Project window and press F1. The Project Window help topic displays.
笊絶武笊 6.3. Outline Area 笊絶武笊
The Project window presents project information in the outline area to help you
keep track of all the objects that make up a project. The objects are grouped
by category. The outline categories are expandable and collapsable. Click on
a plus (+) sign to expand the category. Click on a (-) sign to collapse it.
Your project may be composed of any combination of the following objects:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ategory 笏escription 笏4ee also: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏orms 笏6ser-interfaces. A form is a 笏hapter 3, Using the Toolbox and 笏
笏 笏Dontainer for graphical objects. A笏7isual Objects 笏
笏 笏Eefault form, calledForm1.i, opens 笏 笏
笏 笏Xhen you first start VisualAge for 笏 笏
笏 笏asic. You can rename this form 笏 笏
笏 笏Bnd and you can add additional 笏 笏
笏 笏Gorms. 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odules 笏4ource code Basic modules. Modules笏hapter 6, Using the Code Editor 笏
笏 笏Dan contain declarations, 笏 笏
笏 笏Gunctions, sub procedures, and 笏 笏
笏 笏Dlass definitions. VisualAge for 笏 笏
笏 笏asic adds constant.bas to all new 笏 笏
笏 笏Qrojects. This module contains 笏 笏
笏 笏Qredefined constants frequently 笏 笏
笏 笏Vsed when developing applications. 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏omponents 笏omponents integrated from external笏1art 3 Integrating with External笏
笏 笏Tystems, such as OLE and SOM. 笏4ystems and Chapter 12, 笏
笏 笏 笏0bject-Oriented Programming 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xtensions 笏4upported Object System Adapters 笏1art 3 Integrating with External笏
笏 笏(OSAs). Classes can be imported 笏4ystems and Chapter 12, 笏
笏 笏Grom another object system, using a笏0bject-Oriented Programming 笏
笏 笏Tupport OSA (SOM, OLE). This 笏 笏
笏 笏Dategory lists those object systems笏 笏
笏 笏Gor which you have support. 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xecutable 笏5he project .exe file. You can 笏hapter 22, Preparing Your 笏
笏 笏Iave only one .exe for each 笏pplication for Release 笏
笏 笏Qroject. The .exe is the file you 笏 笏
笏 笏Eistribute to the users or your 笏 笏
笏 笏Bpplication. 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏uildFiles 笏4erver procedure definition files: 笏7isualAge for Basic Data Access 笏
笏 笏Ttored procedure (.sp) and 笏uide 笏
笏 笏Vser-defined functions (.udf). You笏 笏
笏 笏Vse build files to specify how you 笏 笏
笏 笏Xant server procedures built and 笏 笏
笏 笏Segistered to the database. 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
VisualAge for Basic with DB2 Support: If you have installed the DB2 SDK and
VisualAge Basic with DB2 Support, then sqlca.bas is added to your project and
the BuildFile category is added to the outline. You can use this file to
create an instance of the DB2 SQL Communication Area in your stored procedures.
笊絶武笊 6.4. Project Window Menus 笊絶武笊
The Project window menus provide commands for working with your project and
project objects.
To select a command, click on the menu name, then click on the specific menu
command. Throughout this book, you are instructed to select menu commands this
way:
Menu name=> Menu Command
Platform Style: Windows NT and Windows 95 have slightly different interface
styles from OS/2 Warp. In this book, we have included some screen shots from
OS/2 and some from Windows so you can start to see some of the differences. In
Windows, menu commands are always captilized, such as New Form. (This is
called initial capitals style.) In OS/2 Warp, only the first word of a menu
command is capitalized, such as New form. (This is called sentence style.)
The screen shot above was taken on OS/2. We have chosen to provide
instructions in this book using the Windows style.
The commands are grouped as follows:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏enu 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ile 笏4elect File to choose commands that help you 笏
笏 笏Dreate and manage projects and files within your 笏
笏 笏Qrojects. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4elected 笏6se the Selected menu commands to work with the 笏
笏 笏Durrently selected object. The object may be any 笏
笏 笏Pf the items in the outline area of the Project 笏
笏 笏Xindow or an object on a form. The Selected Menu 笏
笏 笏Dontains different commands depending on what is 笏
笏 笏Durrently selected in the Project window. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dit 笏4elect Edit to choose editing commands that allow 笏
笏 笏Zou to modify your forms. Select an object on a 笏
笏 笏Gorm and then select an edit command. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7iew 笏4elect View to choose optional ways to view the 笏
笏 笏7isualAge for Basic environment. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3un 笏4elect Run to choose commands to control the 笏
笏 笏Fxecution (running) of your project. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0ptions 笏4elect Options to choose configuration options for笏
笏 笏Zour VisualAge for Basic session. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8indow 笏4elect Window to open another one of the VisualAge笏
笏 笏Gor Basic tools. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elp 笏4elect Help to choose a section of the VisualAge 笏
笏 笏Gor Basic online help system. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
VisualAge for Basic with DB2 Support: You must be running VisualAge for Basic
with DB2 Support to see some of the menu commands. Specifically, the following
menu commands are available only with this support:
File=> New Stored Procedure
File=> New User-Defined Function
Selected=> Open Definition
Options=> Database
Window=> Stored Procedure Catalog
Window=> User-Defined Function Catalog
See the VisualAge for Basic Data Access Guide for more information on using
these commands to develop, build, register, and call stored procedures and
user-defined functions.
笊絶武笊 6.5. Learning More About Menu Commands 笊絶武笊
For more information on individual Project window menu items, see the online
help. Help for the VisualAge for Basic interfaces is context-sensitive.
笊絶武笊 6.5.1. Information on Menu Commands 笊絶武笊
To get detailed information on a menu command
1. Click and hold the left mouse button on the menu name; for example, File.
2. Still holding the mouse button down, slide the mouse down to the desired
menu command, say Open Project, for example.
3. Still holding the mouse button down, press F1.
The help topic for the selected menu command (Open Project) displays.
笊絶武笊 6.6. Project Window Toolbars 笊絶武笊
The Project window provides horizontal and vertial toolbars for quick access to
the most frequently used menu commands
Each of the actions is available through the menus as well.
笊絶武笊 6.6.1. Help on Toolbar buttons 笊絶武笊
To get help on a Toolbar button:
1. Click on .
2. Click on the button for which you want help.
Tip: Press Esc if you want to get out of context-sensitive help mode.
Important: Context-sensitive help is not available for inactive toolbar
buttons. To get help on inactive toolbar buttons, click anywhere in the
outline area of the Project window and press F1. The Project window help
topic displays. Click on the desired button in the Project window image. The
help topic for that button displays.
笊絶武笊 6.7. Information Line 笊絶武笊
The Project window provides an information line that summarizes the purpose of
the item you currently have selected with the mouse.
笊絶武笊 6.7.1. Information Line for Toolbar Buttons 笊絶武笊
To see the information line for one of the toolbar buttons:
1. Position the mouse pointer over one of the active Toolbar buttons.
2. Press and hold the left mouse button.
The information line displays the summary statement for that button.
3. Slide the mouse pointer away from the button and release the mouse
button.
Important: The information line is not available for inactive toolbar
buttons. To get help on inactive toolbar buttons, click anywhere in the
outline area of the Project window and press F1. The Project window help topic
displays. Click on the desired button in the Project window image. The help
topic for that button displays.
笊絶武笊 6.8. What You Can Do in the Project Window 笊絶武笊
With the Project window you can:
Develop client applications
Develop stored procedures
Develop user-defined functions
Customize the VisualAge for Basic environment
Launch the other VisualAge for Basic tools
Get help
Important: You must have the DB2 SDK and VisualAge for Basic with DB2 Support
to access DB2 databases using embedded SQL or to develop stored procedures or
user-defined functions. See the VisualAge for Basic Installation Information
and the Visual Age for Basic Data Access Guide for more information about
developing a stored procedure or user-defined function.
笊絶武笊 6.9. Planning Your Work 笊絶武笊
This section describes a typical way you might plan to organize your work in
projects if you are developing a client application that calls a stored
procedure or uses a user-defined function:
1. Develop the client application in one project. See Creating Client
Applications in Help=> How Do I.
2. Insert "dummy" code in place of the part of the application to be
performed by a stored procedure or user-defined function.
3. Develop the stored procedure or user-defined function in a second
project.
See the Visual Age for Basic Data Access Guide.
4. Build the stored procedure or user-defined function for the target server
and register it to the database.
See the Visual Age for Basic Data Access Guide.
5. Add a call to the stored procedure or use the user-defined function in
your client application project.
See the Visual Age for Basic Data Access Guide.
6. Package the application for distribution to your users.
See Chapter 22, Preparing Your Application for Release.
笊絶武笊 6.10. Developing Client Applications 笊絶武笊
The fundamental steps for developing applications are the same for all
applications, no matter how simple or complex the application is. The table
below summarizes the tasks involved in developing applications and associated
Project window menu commands which assist you in performing the task. See the
online help for details on a specific command.
See also: Chapter 1, Quick Tour of VisualAge for Basic, for a typical scenario
for developing an application.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o perform this task: 笏6se this Project window menu command: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reate the user interface 笏ile=> New Form, or 笏
笏 笏ile=> New MDI Form 笏
笏 笏ll Edit menu commands 笏
笏 笏ll Selected menu commands with a form 笏
笏 笏Telected 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et design-time properties 笏8indow=> Property Editor 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8rite Basic code to program 笏ile=> New Module, or 笏
笏Cehavior 笏8indow=> Code Editor, or 笏
笏 笏4elected=> Open Code 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dd external objects or files 笏ile=> Add File, or 笏
笏Uo the project 笏8indow=> Component Catalog, or 笏
笏 笏4elected=> Open Component Catalog 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete objects or files from 笏4elected=> Remove 笏
笏Uhe project 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3un the application 笏ll Run menu commands 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5est and debug 笏ll Run menu commands 笏
笏 笏4ee Chapter 7, Testing and Debugging 笏
笏 笏ode. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave individual modules and 笏ile=> Save, or 笏
笏Gorms 笏ile=> Save As, or 笏
笏 笏4elected=> Save, or 笏
笏 笏4elected=> Save As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave the application 笏ile=> Save Project, or 笏
笏 笏ile=> Save Project As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dd calls to stored procedures笏ile=> New Module, or 笏
笏Pr user-defined functions 笏8indow=> Code Editor 笏
笏 笏4ee the Visual Age for Basic Data Access笏
笏 笏uide. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1ackage your application 笏ile=> Build Executable, or 笏
笏 笏ile=> Build Executable As 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 6.11. Developing Stored Procedures 笊絶武笊
To develop a stored procedure you follow the tasks in the table below, using
the Project window menu commands to assist you. For more information on
developing stored procedures see Creating server procedures=> Creating stored
procedures in the online help.
See also: The Visual Age for Basic Data Access Guide.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o perform this task: 笏6se this Project window menu command: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏evelop the procedure locally 笏ile=> New Module, or 笏
笏 笏8indow=> Code Editor, or 笏
笏 笏4elected=> Open Code 笏
笏 笏ode the Sub statement to develop a 笏
笏 笏Ttored procedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dd previously created Basic 笏ile=> Add File 笏
笏Giles to the project 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete files from the project 笏4elected=> Remove 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3un the procedure 笏ll Run menu commands 笏
笏 笏ou must code a main procedure to call 笏
笏 笏Zour procedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5est and debug 笏ll Run menu commands. 笏
笏 笏4ee also Chapter 7, Testing and 笏
笏 笏ebugging Code. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave individual modules and 笏ile=> Save, or 笏
笏Gorms 笏ile=> Save As, or 笏
笏 笏4elected=> Save, or 笏
笏 笏4elected=> Save As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave the application 笏ile=> Save Project, or 笏
笏 笏ile=> Save Project As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reate a stored procedure 笏ile=> New Stored Procedure 笏
笏Eefinition file 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odify a stored procedure 笏4elected=> Open Definition 笏
笏Eefinition file 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏uild and register the stored 笏ile=> New Stored Procedure, or 笏
笏Qrocedure on target servers 笏4elected=> Open Definition 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rowse stored procedure 笏8indow=> Stored Procedure Catalog 笏
笏Jnformation 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4pecify userids and passwords 笏0ptions=> Database=> Set DataBase Logon 笏
笏Gor connecting to target 笏nformation 笏
笏Tervers to build and register 笏 笏
笏Ttored procedures 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 6.12. Developing User-Defined Functions 笊絶武笊
To develop a user-defined function you follow the tasks in the table below,
using the Project window menu commands to assist you. For more information on
developing user-defined functions see Creating server procedures=> Creating
user-defined functions in the online help.
See also: The Visual Age for Basic Data Access Guide.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o perform this task: 笏6se this Project window menu command: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏evelop the function locally 笏ile=> New Module, or 笏
笏 笏8indow=> Code Editor, or 笏
笏 笏4elected=> Open Code 笏
笏 笏ode the Sub statement to develop a 笏
笏 笏Vser-defined function. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dd previously created Basic 笏ile=> Add File 笏
笏Giles to the project 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete files from the project 笏4elected=> Remove 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3un the function 笏ll Run menu commands 笏
笏 笏ou must code a main procedure to call 笏
笏 笏Zour function. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5est and debug 笏ll Run menu commands 笏
笏 笏4ee also Chapter 7, Testing and 笏
笏 笏ebugging Code. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave individual modules and 笏ile=> Save, or 笏
笏Gorms 笏ile=> Save As, or 笏
笏 笏4elected=> Save, or 笏
笏 笏4elected=> Save As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ave the function 笏ile=> Save Project, or 笏
笏 笏ile=> Save Project As 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reate a user-defined function笏ile=> New User-Defined Function 笏
笏Eefinition file 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odify a user-defined function笏4elected=> Open Definition 笏
笏Eefinition file 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏uild the user-defined 笏ile=> New User-Defined Function, or 笏
笏Gunction on target servers 笏4elected=> Open Definition 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3egister user-defined function笏8indow=> User-Defined Function Catalog 笏
笏Jnformation to the datebase 笏uild the User-Defined Function before 笏
笏 笏Segistering it. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rowse user-defined function 笏8indow=> User-Defined Function Catalog 笏
笏Jnformation 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4pecify user IDs and passwords笏0ptions=> Database=> Set DataBase Logon 笏
笏Gor connecting to target 笏nformation 笏
笏Tervers to build and register 笏 笏
笏Vser-defined functions 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 6.13. Customizing the VisualAge for Basic Environment 笊絶武笊
You can customize your VisualAge for Basic working environment by setting
options on the Options menu and by selecting viewing options using the Selected
and View menus.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o perform this task: 笏6se this Project window menu 笏
笏 笏Dommand: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏isplay or choose not to display a form 笏4elected=> Show 笏
笏 笏4elected=> Hide 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏isplay or choose not to display the 笏4elected=> Collapse 笏
笏Mist of files within a category on the 笏4elected=> Expand 笏
笏Putline 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏isplay the full path to objects in the 笏7iew=> File Path 笏
笏Putline area. 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏isplay icons and/or labels for Toolbox 笏7iew=> Toolbox 笏
笏Domponents 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et whether formal declarations for 笏0ptions=> Interpreter=> Variable 笏
笏Manguage variables are required 笏eclaration 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et the default array base subscript for笏0ptions=> Interpreter=> Array Base 笏
笏Brray variables. 笏6se the Option Base statement to 笏
笏 笏Pverride the setting, if desired. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et the default string comparison mode. 笏0ptions=> Interpreter=> String 笏
笏 笏omparison 笏
笏 笏6se the Option Compare statement to笏
笏 笏Pverride the setting, if desired. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et options to apply to the current 笏0ptions=> Project 笏
笏Qroject 笏5hese options are saved when you 笏
笏 笏Tave the project. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et options to tailor the display of the笏0ptions=> Environment=> Grid 笏
笏Hrid dots on the forms 笏7isible 笏
笏 笏0ptions=> Environment=> Align to 笏
笏 笏rid 笏
笏 笏0ptions=> Environment=> Grid Size 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et the number of Undo/Redo levels to 笏0ptions=> Environment=> Undo/Redo 笏
笏Tave 笏4tack Size 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4et the font size used in the Code 笏0ptions=> Environment=> Code Editor笏
笏ditor 笏ont Size 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4elect a database alias to use as 笏0ptions=> Database=> Set DataBase 笏
笏Eefault for all data acess operations 笏ame 笏
笏 笏ou must have VisualAge for Basic 笏
笏 笏Xith DB2 Support. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4pecify user IDs and passwords for 笏0ptions=> Database=> Set DataBase 笏
笏Donnecting to target servers to build 笏ogon Information 笏
笏Bnd register stored procedures and 笏ou must have VisualAge for Basic 笏
笏Vser-defined functions 笏Xith DB2 Support. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 6.14. Launching the other VisualAge for Basic tools 笊絶武笊
Use the Window menu commands or the toolbar buttons to launch other VisualAge
for Basic tools to assist you in developing your projects.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5ool 笏or more information, see... 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1roperty Editor 笏hapter 4, Using the Property Editor 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5oolbox 笏hapter 3, Using the Toolbox and Visual 笏
笏 笏0bjects 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏enu Editor 笏hapter 5, Using the Menu Editor 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ode Editor 笏hapter 6, Using the Code Editor 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏olor Selector 笏hapter 4, Using the Property Editor, 笏
笏 笏6sing the Specialized Editor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏omponent Catalog 笏hapter 14, Integration Overview. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tored Procedure Catalog 笏7isual Age for Basic Data Access Guide 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6ser-Defined Function Catalog 笏7isual Age for Basic Data Access Guide 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
See also: The Project Window Toolbars.
笊絶武笊 6.15. Getting help 笊絶武笊
You can access online help at any time in VisualAge for Basic. There are
several kinds of help available. We have already mentioned that you can get
context-sensitive help on the toolbar buttons, by clicking on and then
clicking on a button. You get interface help on the Project window by pressing
F1. For other kinds of help click on the Help menu and select one of the help
cateogries.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ontents 笏5able of Contents to primary help 笏
笏 笏Tections 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ndex 笏lphabetical list of terms in help 笏
笏 笏Uopics 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ow to Use Help 笏nstructions for using help more 笏
笏 笏Fffectively (varies by platform) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ow Do I...? 笏ist of tasks you can do with VisualAge 笏
笏 笏Gor Basic 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏anguage Reference 笏anguage elements in alphabetical order 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5erms and 笏ey VisualAge for Basic terms and 笏
笏efinitions 笏Fxplanations 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5echnical Support 笏ow to get in touch with IBM technical 笏
笏 笏Tupport for VisualAge for Basic 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏bout IBM VisualAge 笏3elease and copyright information 笏
笏Gor Basic 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
See also: How Do I Get Help in VisualAge for Basic? in Chapter 1, Quick Tour of
VisualAge for Basic.
笊絶武笊 6.16. Learning More About Project Window Tasks 笊絶武笊
VisualAge for Basic includes extensive online Task help.
To get help on Project window related tasks, you can either:
Select Help=> How Do I...?.
The VisualAge for Basic Task Help appears. Click on Manage Projects
under General Development Tasks.
or
Click anywhere in the outline area of the Project window and press F1.
The Project window interface help topic appears. Click on Tasks.
The Task help tells you how to create, modify, and save projects. You can
also see the higher level tasks, such as Creating client applications and
Creating server procedures, under Help=> How Do I.
笊絶武笊 7. Chapter 3 Using the Toolbox and Visual Objects 笊絶武笊
VisualAge for Basic provides a visual development environment where you build
applications by manipulating graphical objects on your screen. You create and
edit these graphical objects by pointing, clicking, and dragging and dropping.
For example, you create objects by dragging them from the Toolbox onto a form.
The Toolbox contains the objects that are the building blocks for the
appearance of your applications.
This chapter describes the types of VisualAge for Basic objects and instructs
you how to:
Create objects.
Select objects.
Resize, move, cut, copy, paste, and delete objects.
Undo and redo changes to objects.
Add objects to the Toolbox.
Assign an object to a new container.
笊絶武笊 7.1. Understanding the Toolbox 笊絶武笊
One of the first thing you see is the tool palette. The Toolbox contains
representations of all the components that can be used in the current project.
The Toolbox displays both the icons and the names of the components by default.
As you become familiar with the components, you can modify the Toolbox view to
show only the name of the component or only the icon.
The Toolbox contains a set of user interface objects, or primitives, such as
labels, text boxes, and command buttons. These objects represent standard user
interface objects.
笊絶武笊 7.2. Using the ToolBox 笊絶武笊
The objects, or primitives, are typically drawn on forms. You draw objects on
the form by selecting the type of object from the Toolbox and dragging the
mouse on the form. When you create an object on another object, for example a
button on a frame, the button is actually a "child" of the frame, not of the
form.
See also: Creating Objectsto learn different techniques for adding objects to
your form.
笊絶武笊 7.3. Understanding Objects 笊絶武笊
VisualAge for Basic provides a set of reusable objects that make up an
application's Graphical User Interface (GUI). These different types of objects
include forms, standard user interface objects, operating system objects, and
objects you create using VisualAge for Basic classes. You can refer to
operating system objects, such as the Printer, Screen, Clipboard, and App in
code modules.
See also: VisualAge for Basic Language Reference for a detailed description of
how to use the operating system objects.
笊絶武笊 7.4. Containers and Primitives 笊絶武笊
Containers are objects that can hold other objects and act as parents of the
objects they contain. Forms are containers for all user interface objects. A
form's only parent can be an MDI form (multiple document interface). An MDI
form is the only VisualAge for Basic component that never has a parent and can
only contain forms, menus, and picture boxes.
Other components such as the Frame, Grid, and Picture Box can act as both
parents and children. Objects that have a parent are called children.
Primitives are objects placed in containers, which cannot be parents of other
objects. Objects you create on container objects become children of that
container. For example, a frame containing three check boxes is the parent of
the check boxes. The frame is, at the same time, a child of the form.
笊絶武笊 7.5. Forms 笊絶武笊
Forms and MDI forms are containers. A form can contain other components but it
cannot contain another form. An MDI form is a multiple-document interface
providing an envelope in which to place other forms that have their MDIChild
property set to True. You can have many forms but only one MDI form per
application.
A form is a window containing objects that make up an interface. Most
applications have several different forms that make up their GUI environment.
For example, a database application has forms for data entry, record queries,
and report generation. All of these forms contain primitive objects like
labels, text boxes, and push buttons.
笊絶武笊 7.5.1. To Create a Form 笊絶武笊
You can create two types of forms, a regular form or an MDI form.
Form1 automatically loads when you start the VisualAge for Basic application.
To create a second form, you can either:
Select File=> New Form from the Project window, or
Click on the New Form button in the tool bar.
A new form appears on the desktop.
To create an MDI form:
Select File=> New MDI Form from the Project window.
An MDI form appears on the desktop.
You can create only one MDI form per project. After you create an MDI form,
the New MDI Form menu item is not selectable.
笊絶武笊 7.6. Dragging and Dropping 笊絶武笊
The drag visuals indicate how and where you drag and drop an object. A
rectangle outline representing the object displays when you are over a valid
drop site.The drag has different views specific to the drag operation you are
performing on the object.
The outline disappears and displays a non-valid symbol, , when you drag the
object over an invalid drop site, such as the desktop or an object that cannot
be a parent.
笊絶武笊 7.7. Creating Objects 笊絶武笊
VisualAge for Basic lets you create objects using a variety of techniques. You
can create objects using one of the following techniques:
Select-click - Selecting an object in the Toolbox and then clicking on a
form.
Select-drag - Dragging and dropping an object from the Toolbox onto a
form.
Select-click-drag - Selecting an object in the Toolbox and then drawing
it on a form.
Double-click - Selecting an object in the Toolbox and placing it in the
upper-left corner of the form.
Tip: To cancel any create operation, press the Esc key or click on the pointer
icon in the Toolbox.
笊絶武笊 7.7.1. Create a Default-Size Component - Select-Click 笊絶武笊
This technique is useful for creating individual components.
1. Select the List Box from the ToolBar.
2. Move the mouse over the form and click on the form.
A single List Box appears using its default size setting.
笊絶武笊 7.7.2. Create a Default-Size Component - Select-Drag 笊絶武笊
This technique is useful for creating individual components.
1. Select an object in the Toolbox using the mouse and hold down:
On OS2: the right mouse button.
On Windows NT and Windows 95: the left mouse button.
2. Drag the mouse cursor to the form.
A rectangular outline appears over the form.
3. Release the mouse button over where you want to create the object.
The object appears with default height and width. The cross-hair pointer
changes back to the normal pointer.
笊絶武笊 7.7.3. Create a Custom-Size Component - Select-Click-Drag 笊絶武笊
This technique is useful for creating individual components of a certain size.
1. Select the List Box from the ToolBar.
2. Move the mouse over the form.
The pointer changes to cross-hairs () when it is over an area where you
can create an object.
3. Press the appropriate mouse button, hold, and drag the cursor across the
form.
A rectangular outline of the object is drawn, enlarging as you drag the
cursor.
4. Release the mouse button.
A list box appears drawn with the dimensions of the outline. The
cross-hair pointer changes back to the normal pointer.
笊絶武笊 7.7.4. Creating Multiple Objects 笊絶武笊
You can create several copies of an object without having to repeat the same
operations between the Toolbox and the form.
You use the Ctrl key to create several copies of an object that can vary in
size as well as be drawn on different forms. Alternatively, you use the Shift
key to create several copies of an object in one operation, resulting in a
component array.
笊絶武笊 7.7.4.1. Create Multiple Components using Ctrl-Click 笊絶武笊
This technique is useful for creating multiple copies of a component anywhere
on your form.
1. Press and hold the Ctrl key.
2. Select a Label from the Toolbox.
3. Release the Ctrl key.
4. Move the mouse over Form1.
The cursor changes its shape to crosshairs () .
5. Click several times on the form in different areas.
A label appears for each place that you clicked on.
6. To get out of the continuous add component mode, press the Esc key or
click on the pointer icon in the Toolbox.
笊絶武笊 7.7.4.2. Create Multiple Components using Shift-Drag 笊絶武笊
This technique is useful for creating an array of components.
1. Using the mouse, select the Option Button from the Toolbox.
2. Press and hold the Shift key.
3. Move the mouse over Form1.
4. Click the mouse on the form, hold, and then drag the mouse over the form
to create multiple option buttons at the bottom of your form. Drag both
vertically and horizontally to see the objects as they are created. You
can extend the drag area outside of your form
The outlines of the option buttons appear inside your drag area.
Tip: If the form is too small to display all the buttons, select the
form and resize it using the side handles.
5. When the option buttons appear, release the mouse and the Shift key.
6. A dialog box appears asking if you want to create an array.
Select NO to create individual components. Selecting YES creates a group
of components that share similar properties, methods, and events. You
reference an array as a single unit using code.
The option buttons are loaded onto your form.
笊絶武笊 7.8. Naming Objects 笊絶武笊
Each object has a unique name that you use to refer to it in code. For each
object you create, the system gives it a name and appends an integer to each
instance of the object, by default. For example, each time you create a Label
object, VisualAge for Basic names them Label1, Label2, Label3, in ascending
order.
Using the Property Editor, change the object names to names that indicate their
purpose, making it easier for you to read code and find errors. Use consistent
abbreviations that indicate the type of object. For example, the names lblName,
lblAge, and lblSex indicate the type and purpose of the objects.
The system objects App, Clipboard, Debug, Printer, and Screen cannot be
renamed. Also, the data objects, Database and Recordset, cannot be renamed.
笊絶武笊 7.9. Adding New Objects 笊絶武笊
You can add new objects to the Toolbox. Objects added to the Toolbox are
represented by a their own icon and can be used in VisualAge for Basic
applications in the same way as the built-in components shown in the Toolbox.
笊絶武笊 7.9.1. Adding Objects from Other Object Systems 笊絶武笊
VisualAge for Basic can use objects conforming to many object systems, using
special translation tools called Object System Adapters (OSAs). You can use
objects from any object system for which an OSA has been installed in VisualAge
for Basic. VisualAge for Basic currently supports OSAs for the following object
systems:
SOM
OLE
Important: If you want to use SOM objects, ensure that the VWADDSOM
environment variable is set to YES. You can either set the variable in your
config.sys (for OS/2) or autoexec.bat (for Windows NT and Windows 95) file, or
you can set the variable when you need it. If you added SOM after installing
VisualAge for Basic, you might need to update this environment. You use the
Component Catalog to select the specific part or class of parts to add to the
Toolbox. You call the Component Catalog by highlighting a file, class, or
extension in the Project window and selecting:
Selected=>Component Catalog
The Component Catalog menu item is only available if the selected file in the
Project window contains information on an object system adapter.
Window=>Component Catalog
笊絶武笊 7.9.1.1. To add a new object from a supported OSA: 笊絶武笊
1. Select Window=>Component Catalog menu item to access the Component
Catalog. VisualAge for Basic determines what OSAs are in the Component
Catalog.
The Component Catalog appears.
2. Select the Object System you want to add using the drop-down selection
box.
The drop-down selection box shows all OSAs currently available.
3. Select the Classes selection to display the list of SOM classes.
4. Select the class by clicking on the box in front of the class.
A mark appears in the box and the class loads into the Toolbox.
The selected OSA's classes display in the outline of classes.
笊絶武笊 7.9.1.2. To remove an OSA object: 笊絶武笊
You remove the class in the same manner as you load the class.
Click on the marked box in the Component Catalog.
The box clears and the class is removed from the Toolbox.
Important: If your VisualAge for Basic application is currently using an
instance of the class you want to remove, you cannot remove the class.
笊絶武笊 7.9.1.3. Customizing an Integrated Class 笊絶武笊
You can customize the visual behavior of objects added to VisualAge for Basic
that rely on an OSA. For example, there may be no icon assigned to represent a
SOM object in the Toolbox. You can specify an icon by adding integration
information for the class in an integration file.
笊絶武笊 7.9.1.4. Structure of the Integration File 笊絶武笊
Integration files are plain text files that have a specific format. Integration
data files have the same name as the class with the .i extension. For example,
the Hello class has an integration file, Hello.i, to which you add an icon, a
help context number, and a help file:
*Hello.IconLabel: Hello
*Hello.IconFileName: /path/file
*Hello.ContextID: 55555
*Hello.HelpFileName: helpfile
See also: Customizing Integration with an Integration Data File in Chapter 14,
Integration Overview.
笊絶武笊 7.10. Selecting Objects 笊絶武笊
To select an object:
Click on the object. Selection handles appear around the object
indicating it is selected.
Selecting an object deselects any previously selected objects.
To select a group of objects:
1. Move the pointer onto an empty area of the form.
2. Press the appropriate mouse button.
3. Drag the pointer to outline an area surrounding the objects you want to
select.
This procedure is called marquee selection An outline appears around the
area of objects as you drag the pointer around the objects.
4. Release the mouse button. Handles appear around the selected objects.
To select an additional object:
Hold down the Ctrl key and select more objects by clicking on them or by
dragging the pointer around them. Previously selected objects remain
selected.
笊絶武笊 7.10.1. Deselecting Objects 笊絶武笊
You can deselect an object in two ways:
Click on an unselected object.
All other objects are deselected.
Hold down the Ctrl key and click on the object you want to deselect.
Only the object you click is deselected.
To deselect a group of objects
Hold down the Ctrl key and drag the appropriate mouse button around the
selected objects you want to deselect. Release the mouse button. The
objects are deselected.
笊絶武笊 7.11. Editing Objects 笊絶武笊
As you create objects you will want to make changes to them. VisualAge for
Basic's editing features let you move, resize, cut, copy, paste, and delete
objects in the same way you would edit text in a word processor.
笊絶武笊 7.11.1. Moving Objects 笊絶武笊
You can move objects in several ways. You can:
Use the mouse to drag objects to a new location.
Set the Left and Top properties in the Property Editor to move objects to
a precise location.
Use code at run time to move objects, by writing VisualAge for Basic
statements.
When you move an object, its children are included. For example, option
buttons contained within a frame are moved with the frame, even if only the
frame is selected.
You can move objects from one form to another. The drag over and drag under
visuals change as you move the object across the desktop. Groups of objects
retain the same relative distance they had in their original location.
You can also move objects by cutting and pasting them to a new location. This
method is described in this chapter; see Cutting, Copying, and Pasting Objects
笊絶武笊 7.11.1.1. To move an object: 笊絶武笊
1. Select the object you want to move.
2. Press the appropriate mouse button.
3. Drag the object to its new position. An outline of the object appears
under the pointer as you move. The object remains where it is.
4. Release the mouse button. The object moves to its new location.
笊絶武笊 7.11.1.2. To move a group of objects: 笊絶武笊
1. Select the objects you want to move.
2. With the cursor over one of the selected objects press the appropriate
mouse button.
3. Drag the objects to their new position. Outlines of the objects appear,
showing the displacement of the group of objects. The original objects
remain where they are.
4. Release the mouse button. The objects move to the last known location of
the mouse-the release location.
笊絶武笊 7.11.1.3. Moving Objects Using Code 笊絶武笊
The Left property controls the distance of an object's upper left corner from
the left side of its parent. The Top property controls the distance of an
object's upper left corner from the top of its parent.
You can load the objects you want to move in the Property Editor and change
their Left and Top properties. The objects show the change as soon as you
apply, , the change.
You can also change the Left and Top properties in code modules, showing the
changes at run time. When you change the Left and Top properties for an object,
the object moves first horizontally then vertically, yielding a jump effect.
Use the Move method for a smooth diagonal motion.
See also: VisualAge for Basic Language Reference Online Help for more
information about Left and Top properties and the Move method.
笊絶武笊 7.11.2. Resizing Objects 笊絶武笊
After you create some objects for an application interface, you might want to
change their height and width. You can resize the objects individually or in a
group by manipulating the handles that appear when objects are selected.
The cursor changes (, , , or ) at the selection handles signifying the
direction of the resize operation.
笊絶武笊 7.11.2.1. To resize objects: 笊絶武笊
1. Select the object you want to resize. Selection handles appear around the
object.
2. Move the pointer onto one of the handles.
3. Press the appropriate mouse button and drag one of the handles.
笊絶武笊 7.11.2.2. To resize a group of objects: 笊絶武笊
1. Select the objects you want to resize. Selection handles appear around
all of the selected objects.
2. Press the appropriate mouse button on one of the selection handles.
3. Drag the handle to resize the objects to the new desired size.
Outlines appear around all the objects, projecting their new size as you drag
the handle. The distance between the objects remains proportional to the new
sizes of the objects. The objects are resized equally and proportionally.
Another way to resize objects is to change the Left, Top, Height, and Width
properties settings in the Property Editor or in code modules. When you apply
the property settings you have changed in the Property Editor, the selected
objects reflect the changes immediately. Property settings in code modules
change the object size at run time.
笊絶武笊 7.11.3. Cutting, Copying, and Pasting Objects 笊絶武笊
Objects can be cut or copied to the clipboard and later pasted from the
clipboard to another location. If the object has children, its children are
also copied or cut to and pasted from the clipboard.
Cutting objects deletes them from their current location and copies them to the
clipboard. You can cut, copy, and paste objects individually or in a group.
笊絶武笊 7.11.3.1. To cut objects to the clipboard: 笊絶武笊
1. Select the objects you want to cut.
2. Choose Edit=> Cut from the Project window.
笊絶武笊 7.11.3.2. To copy objects to the clipboard: 笊絶武笊
1. Select the objects you want to copy.
2. Choose Edit=> Copy from the Project window.
笊絶武笊 7.11.3.3. To paste objects from the clipboard to a new location: 笊絶武笊
1. Select the object that will receive the object you cut or copied to the
clipboard.
2. Choose Edit=> Paste from the Project window.
When you want to paste an object, you must ensure that you are pasting on a
container object. If you try to paste objects on an invalid site or primitive
object, an error message appears. For example, you cannot paste a label on a
push button.
笊絶武笊 7.11.3.4. To delete objects 笊絶武笊
1. Select the objects you want to delete.
2. Choose Edit=> Delete from the Project window. Objects listed in the
Project window, such as form, are deleted using the Project window File
menu.
or
1. Choose the object you want to remove from the File List Area in the
project window.
2. Choose File=> Remove from the Project window.
When you delete an object, it is removed from your application interface and
any editor into which it is loaded-Property Editor, Code Editor, or Color
Selector. However, you must remove typed-in references to the deleted object
in code modules to avoid run-time errors.
笊絶武笊 7.12. Undoing and Redoing Changes 笊絶武笊
Most changes that affect the objects that you build are reversible. You can
undo the following operations by choosing Undo from the Edit menu: move,
resize, cut, copy, and paste, and delete.
Tip: If a command cannot be undone, VisualAge for Basic warns you before
performing the command. For example, you cannot undo a Remove=> File operation
for files that you remove from the Project window.
You can undo and redo multiple levels of changes that you make to objects while
you build interfaces. The system keeps track of the operations you make on
objects. The order of operations are undone and redone in the same sequence as
they were performed.
笊絶武笊 7.12.1. To Undo an Operation 笊絶武笊
Choose Edit=> Undo [operation] from the Project window. The most recent
operation appears after Undo in the menu. For example, if the most recent
operation you made was resize, the menu item shows Undo Resize.
The object is restored to its state prior to the operation. The Edit menu is
modified to show that a Redo operation is available for the operation that is
just undone.
When you undo an operation for the first time in a sequence of operations, the
Undo menu item is gray until you redo it.
笊絶武笊 7.12.2. To Redo an Operation 笊絶武笊
Choose Edit=> Redo [operation] from the Project window.
The change appears as it did before you chose Undo.
A redo operation is only available after at least one undo operation is made.
The first Undo operation makes the Redo menu item gray. Accordingly, when you
have redone the most recent operation in the sequence of operations, the Redo
menu item is gray. As soon as you undo an operation, the Redo menu item is
selectable again, showing Redo [ ].
笊絶武笊 7.13. Moving Objects to a Different Container 笊絶武笊
When you drag an object onto a form, the form becomes the object's parent.
Similarly, when you drag an option button into a Frame component, the frame
becomes its parent. You cannot move an object to a form if the object has the
same Name property as an object already existing on the form. As discussed in
Naming Objects make sure each object you create has a unique name.
Objects can be moved to a different container as follows:
Interactively-by dragging an object from one form to another. For
example, you can move a push button from a form, Form1, to another form,
Form2. Form2 is the push button's new parent.
Using the Property Editor.
Each object has a Container property that identifies its parent. You can
change its value by typing the object name of the new parent. If the object is
not a valid parent, the system displays an error dialog.
See also: Chapter 4, Using the Property Editor, Assigning a New Container
Property.
笊絶武笊 8. Chapter 4 Using the Property Editor 笊絶武笊
The Property Editor lets you customize the appearance and behavior of the
objects in your application. At design time, you use the Property Editor to set
initial property values for objects as you build your application. At run time,
statements in your code modules can change certain property values as your
application executes and interacts with the user.
The Property Editor enables you to:
View all property values of a single selected object.
View the common property values of multiple selected objects.
Change the values of selected objects, facilitated by drop-down lists and
specialized editors.
Customize the Property Editor to suit your needs; for example, you can
control which properties it displays.
Create control arrays.
Undo one or more of your changes through a multiple-undo feature.
Change common values for multiple objects in one step.
View and. change values as constants or expressions.
笊絶武笊 8.1. Understanding the Property Editor 笊絶武笊
When you open the Property Editor, it displays all selected objects by default.
To open the Property Editor do one of the following:
In the Project window, choose the Windows=>Property Editor menu item.
In the tool bar, click on the Property Editor button.
When the Property Editor appears, it displays the properties of the object (or
objects) currently selected. The Property Editor allows you to customize the
appearance and behavior of objects in your application. You use the Property
Editor to set initial property values for objects as you build your
application at design time.
The Property Editor, shown in Figure 4-1, consists of a menu bar, a control
bar containing restore and apply buttons, a list of objects, and a list of
properties.
Figure 4-1 Property Editor
The following table describes the parts of the Property Editor.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1art 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏enu bar 笏ontrols the objects and properties displayed in 笏
笏 笏Uhe object list area and the properties list. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3estore button 笏3estores the previous property values. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏pply button 笏pplies the new property values. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0bject list area 笏isplays a scrolling list of selected objects. 笏
笏 笏xpands, using the resizeable sash, to show 笏
笏 笏Nultiple objects. View=>Show Class. displays both 笏
笏 笏Uhe object name and class. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ist of Properties 笏isplays a scrolling list of property rows. Each 笏
笏 笏Sow contains a property name and shows the current笏
笏 笏Qroperty setting. You use the resizeable sash to 笏
笏 笏Fxpand the properties list area. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xpression mode 笏isplays an icon indicating the property is 笏
笏 笏Eisplayed as an expression. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tatus area 笏isplays a change bar (| ) if the property value 笏
笏 笏Ias been modified but not applied. When more than 笏
笏 笏Pne object is listed in the object list area, the 笏
笏 笏Ttatus area displays a not equal sign if the 笏
笏 笏Pbjects have different settings for the same 笏
笏 笏Qroperty. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7alue area 笏4hows the current property value. You can edit 笏
笏 笏Uhis field to change the property value. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 8.2. Selecting Objects for Display 笊絶武笊
When you select objects in your form, the Property Editor displays their
properties automatically. To display properties of multiple objects, select
multiple objects. To remove an object, deselect the object.
Tip: To selectively add more objects to the object list area, hold down the
Ctrl key and select the objects you want to add. To selectively delete objects
from the object list, hold down the Ctrl key and click on the selected object
on your form.
See also: Selecting Objects.
All selected object names and classes are displayed in the object list area. If
you select two or more objects, the only properties shown are those common
among the selected objects. Not-equal signs appear in the status area for
object property values that are different among the selected objects in the
Property Editor.
笊絶武笊 8.3. Viewing and Editing Properties 笊絶武笊
When you select any object on the form, the Property Editor displays the
property values of that object. For example, if you click on Button1, the
Property Editor displays the property values of Button1.
To edit a particular property value, follow these steps:
Select the property to edit.
Edit the property value. Different ways are provided to edit different
type values, as discussed below.
笊絶武笊 8.3.1. Selecting the Property to Edit 笊絶武笊
To edit a particular property, click anywhere in the row that displays that
property. Note that this causes that row to be highlighted with a different
color border, selecting it for editing.
You can change which row is selected for editing by using the up and down
cursor keys. This selects the row above, or the one below, the row that is
currently selected.
笊絶武笊 8.3.1.1. Entering a new value 笊絶武笊
The way you enter a new value depends on the type of property value in the row
you selected:
For integer, float or string type property, you will see an I-beam, which
enables you to type in the new value.
For Boolean properties and other enumerated types, a drop-down list is
provided. To change the value, select one item from the drop-down list.
For color and other properties that have a specialized editor, an editor
icon appears on the selected row. To change a value, click on the editor
icon and choose one of the displayed options.
To change a property value you can:
Type the required value in the text box. The standard text editing
operations are available, for example, cut, copy, paste, backspacing,
highlighting text and over-writing.
Apply a change in the specialized editor.
Click on the value area's combo button and selecting a value from the
drop-down list. If the property is an enumerated type, the drop-down list
contains all the possible values. The left and right cursor keys are used
to scroll through the enumerated values without opening the drop down
list.
笊絶武笊 8.3.2. Confirming a Property Value Change 笊絶武笊
By default, you apply a change to a property value of the selected objects by:
Pressing the Enter key.
Selecting a new value from a combination drop-down list.
Applying a change in a specialized editor.
Clicking on the Apply button
Changing property rows.
Choosing Properties=> Apply Change
If the value area contains an invalid property value when you apply your
changes, a message dialog informs you that the update is not valid. The
invalid property values remain in their field for editing.
Tip: Whenever a property value has been changed but not yet applied, a change
bar indicator is shown to the left of the property value area.
笊絶武笊 8.3.3. Undoing Property Value Changes 笊絶武笊
You restore unapplied changes to initial property values by clicking on the
Restore button , by choosing Properties=> Restore from the Property Editor, or
pressing the Esc key.
For changes to property values that have already been applied choose Edit=>
Undo Property Change (a multi-level edit feature) from the Project window.
To reset all changes to the default setting, choose Selected=> Set To Default
in the Property Editor.
See also: Undoing and Redoing Changes to understand more about the Undo and
Redo features from the Project window.
笊絶武笊 8.3.4. Setting the Name Property 笊絶武笊
To recognize and reference objects in the system, each object must have a
unique Name property. When you create a series of options buttons, the system
assigns names in numerical sequence for each class of object. You should rename
the object with more meaningful names that indicate their type and purpose.
Tip: The names you assign to objects in the Property Editor using the Name
property are updated in the Code Editor navigation area. For example, if you
name a command button cmdTransaction, the event procedure automatically shows
cmdTransaction_Click when you select a Click event.
Important: If you assign duplicate names to either the Name or Container
property for two or more components, you create a component array.
See also: Creating Component Arrays Using the Property Editor.
笊絶武笊 8.4. Viewing and Editing Properties for Multiple Objects 笊絶武笊
The Property Editor allows you to edit properties for more than one object at a
time. If more than one object appears in the object list, only the properties
those objects share appear in the properties area. Changes made to any shared
property apply to all objects in the object list. For example, to change the
background color for multiple objects, select the objects, change the BackColor
property value, and then apply the changes.
A property shared by several objects but with values that differ from object to
object is highlighted by a not-equal sign to the left of the Value field. For
example, consider two objects that share the BackColor property. For one,
BackColor is set to Blue; for the other, Grey. If both objects are selected, a
not-equal sign appears and the Value field is blank.
By selecting a property with a not-equal sign, a drop-down box appears. To
assign the same value to all selected objects, select the value you want from
the drop-down box and press Enter. When the same property value is applied to
all selected objects, the not-equal sign disappears.
笊絶武笊 8.5. Creating Component Arrays Using the Property Editor 笊絶武笊
Definition: A component array is a group of objects that share the same name
and behavior. Each element in a component array has a unique Index number used
to access it in the array. You can create or modify component array elements
from the Property Editor by changing the values of the Index and Name
properties. You can also use the Container property to create a component
array.
A specific component array can only contain objects of the same class. That is,
a component array made out of command buttons can only have command buttons as
items of the array.
Important: Component array elements share event code but they do not have to
share property values. Component arrays can be created from the Property Editor
by:
Changing the Name property of an object to that of an existing object.
22660'.
Setting an object's Index property.
Assigning duplicate names to the Name or Container property for two or
more components.
Restriction: With the exception of forms and MDI forms, any child object can
be part of a component array.
笊絶武笊 8.5.1. Setting the Index Property 笊絶武笊
By default a component's Index property is blank. Setting the Index property
causes a message dialog to appear, asking if you want the component to be part
of a component array. Selecting OK turns that component into a component array.
To return a component array object to a regular object:
1. Change the name of the object that you want to delete.
2. Set the Index value to blank.
Restriction: Setting the Index property of a component that is already part
of the component array to the same value as another component in the array
produces a property validation error. The objects in a component array cannot
have the same index value.
笊絶武笊 8.5.2. Undoing a Component Array 笊絶武笊
If you create a component array using the Shift-Drag technique, selecting
Edit=>Undo Create undoes the creation of the array and removes all components
from your form.
To permanently remove an existing component array object, select it and press
Delete. To remove an array component from the array and use it as a regular
component:
1. Change the Name property for that component to another name and accept
the change.
form cannot have the same name and index number.
2. Set the Index value to be blank and accept the change.
Tip: If the component array object is the last object in the array, you do
not have to change the Name property as there is no other component on that
form with that name.
笊絶武笊 8.6. Assigning a New Container Property 笊絶武笊
When you change the Container property you are also reorganizing the object
family tree. You can do this with an object within the same form or from one
form to another. Using the selected component's Container property, type in the
new parent's name.
For example, to move Form1.Command1 to inside Frame1 on Form2, type in
Form2.Frame1 in Command1's Container property. This moves Command1 into the
Frame component on Form2- Form2.Frame1.Command1.
笊絶武笊 8.7. Showing and Hiding Property Rows 笊絶武笊
You can tailor which properties appear in the properties list by choosing
options in the View menu: Hide Default, Hide Changed, Hide Equal, and Hide Not
Equal. The Property Editor has a filtering mechanism that lets you control the
object properties you want to view and modify. You filter the properties list
view to simplify how you edit property values. You might want to edit the same
properties several times for multiple objects or just edit them once.
You can control the display of rows to simplify the editing task. To edit the
same property for multiple objects, select Hide Default to display only those
properties that have been previously set. For example, to set a different color
property for different objects:
1. Select an object and change its background color.
2. Select View=>Hide Default. The property list is shortened showing only
those properties that changed. Because you changed the BackColor
property, it is no longer in its default state; therefore it stays in the
shortened list.
3. Select any other object that has a BackColor property. The shortened list
includes the BackColor property.
Conversely, the Hide Changed displays only those properties that have the
default value. Use the menu entries Hide Equal and Hide Not Equal to see how
objects differ or are the same. Hide Equal displays only those properties that
differ for multiply-selected objects. Hide Not Equal displays only those
properties that are the same for multiply-selected objects.
The following table tells how to set your different viewing options:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o: 笏o: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ide properties with default 笏hoose View=> Hide Default. The properties with 笏
笏Walues 笏Eefault property values disappear from the 笏
笏 笏Qroperties list. Only properties whose values are 笏
笏 笏Oon-default settings are visible in the Property 笏
笏 笏ditor. You make the default property values 笏
笏 笏Wisible again by choosing View=>Hide Default. You 笏
笏 笏Dan reset selected objects to display their 笏
笏 笏Jnitial (or default) settings by choosing 笏
笏 笏4elected=> Set To Default. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ide properties with unequal 笏hoose View=> Hide Not Equal. The properties 笏
笏Walues 笏Thowing in the status area disappear from the 笏
笏 笏Qroperties list. You make property values that are笏
笏 笏Oot equal visible again by choosing View=>Hide Not笏
笏 笏qual. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ide changes 笏hoose View=> Hide Changed to hide properties 笏
笏 笏Xhose property values you have already modified. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 8.8. Showing Object Classes 笊絶武笊
By default, the Property Editor shows object classes alongside object names in
the object list area. You can hide and show object classes by choosing View=>
Show Class from the Property Editor. The check box is checked on the View menu
for the Show Class menu item when object classes appear in the object list
area. The menu item is a toggle for either showing or hiding object classes.
笊絶武笊 8.9. Displaying Property Values by Constant or Expression 笊絶武笊
Property values can be displayed and entered as either constants or expressions
by selecting the appropriate mode from the menu. When you select Expression,
VisualAge for Basic interprets the property valuesas expressions. This means
that property values can be computed at run time. In this mode, you must enter
all strings with double quotes.
Property values are displayed in constant mode by default.
To display a property as an expression, choose Selected=> Expression.
The letter E appears to the left of the property, indicating that it is an
expression. A string is displayed with quotation marks ("") and values are
displayed as numerics; for example, True and False are displayed as 0 and -1.
You can specify a Basic expression as a property value that returns an
appropriate type, including constants, global variables, and functions that
take arguments. You can use this powerful technique to set values dynamically
at run time, build user interfaces that depend on user-input parameters, or
build interfaces that take their strings from a message catalog tailored to a
specific locale.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty Value 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nteger 笏ither an integer or a Basic expression that 笏
笏 笏Fvaluates to an integer. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏loat 笏n integer, a float, or a Basic expression that 笏
笏 笏Fvaluates to an integer or a float. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tring 笏 string enclosed in quotation marks (""), or a 笏
笏 笏asic expression that returns a String. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oolean 笏n integer, -1 (True) or 0 (False) or a Basic 笏
笏 笏Fxpression that returns an integer. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏olor 笏n integer, any color name recognized by your 笏
笏 笏Pperating system and enclosed in quotes, or a 笏
笏 笏asic expression that returns a Long integer. 笏
笏 笏 笏
笏 笏6se the QBColor function to set the color 笏
笏 笏Qroperty-QBColor(10) 笏
笏 笏 笏
笏 笏6se the RGB() function to set the Red, Green, and 笏
笏 笏lue levels. For example: RGB(192,192,192) sets 笏
笏 笏Uhe color property to gray. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏numerated Type 笏 string enclosed in quotation marks (""). 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏asic 笏ny legal Basic expression or statement of the 笏
笏 笏Dorrect type for the property. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 8.10. Using the Specialized Editor 笊絶武笊
What dialog the Specialized Editor button calls depends on the property it
appears with-selecting the Picture property calls the Graphic Selector and
selecting the Backcolor property calls the Color Property Tool.
笊絶武笊 8.10.1. Selecting Graphics 笊絶武笊
The Graphic Selector is a file selection box that lets you add graphic files
for the Picture, Icon, and DragIcon properties. The displayed list of available
images is platform specific.
How you enter the graphic file depends of whether you select constant mode or
expression mode. In constant mode, the Specialized Editor button is available,
and you can select the graphic file from the Graphic Selector.
In expression mode, the Graphic Selector is not accessible. The expression you
set in the Property Editor is equivalent to a statement
object.property=expression that you write in code modules. In constant mode the
path does not have to be written as a string. In expression mode, you must
incorporate the LoadPicture function format.
When you switch from constant mode to expression mode, the string viewed in the
property slot appears in quotes and is incorporated into a LoadPicture()
function format. For example:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty value in Constant 笏:\krista\expres.bmp 笏
笏Node 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1roperty value in Expression 笏oadPicture("D:\krista\expres.bmp") 笏
笏Node 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
The contrary is true when switching from expression mode to constant mode. That
is, the LoadPicture prefix and the quotes are removed. For example:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty value in Expression 笏oadPicture("D:\krista\expres.bmp") 笏
笏Node 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1roperty value in Constant 笏:\krista\expres.bmp 笏
笏Node 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 8.10.2. Selecting Colors 笊絶武笊
You can use the Property Editor to change the color properties (BackColor,
FillColor, and ForeColor) of an object or a group of objects. You can also use
the Project window Window=> Color Selector menu item to change colors.
The Color Selector and the Color Property Tool let you select color from your
operating system's color selection. The customizable color palette lets you
create your own colors using the Color Editor. You access the Color Editor from
either the Project window or the Property Editor by clicking on the Edit Custom
Colors button to create custom colors. The colors you create are added to your
color palette.
The Property Editor Color Property Tool and the Project window Color Selector
are functionally similar in that they both set colors-however, the Color
Selector behaves like a property editor window. Color properties can be edited
in the Color Selector without the Property Editor.
Tip: Use the Project window Color Selector when you only want to change the
colors of your objects,which is faster than going through the Property Editor.
The Color Selector displays objects as you select them in your form. A group of
objects with common color properties can be changed with a single edit.
For example, you can select an array of check boxes and modify their Backcolor
property to be the same color shade in one step. The Color Property drop-down
list shows the common color properties.
Restriction: Selecting objects without color properties causes the Color
Property drop- down list to be blank. You can only access the Color Property
Tool through the Property Editor. First you select an object, then you select a
color property to modify and click on the Specialized Editor button
When you click on a color in the Color Property Tool, the selected object's
color property changes to the selected color.
笊絶武笊 8.10.2.1. Customizing Colors 笊絶武笊
If the color windows do not contain the color you want, you can create a color
using the Color Editor. Click on the RGB Color Selector. When the crosshair
pointer appears, move it to customize the color. Click on Set Color to add the
custom color to the palette.The new color is saved in the custom colors area of
the window. To apply your custom color, select it as you would any of the other
colors.
You set your custom color using Hue-Saturation-Intensity and Red-Green-Blue. As
you manipulate the gray value arrow, the values in the Red, Green, Blue, Hue,
Sat, and Value areas update to follow the color selection. The color selection
area creates a visual cue, providing an intuitive way to choose colors.
You can create a color by using the color area and the value areas, or by
entering numbers into the input areas. The following table describes the parts
of the Color Editor:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1art 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3GB Color Selection 笏1rovides a graphical way to select the hue and 笏
笏 笏Taturation of the color you want to create. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏olor Display 笏1rovides a visual cue for the selected color mix. 笏
笏 笏epending on the selection of the Solid Color 笏
笏 笏Dheck box, the color selection area divides into 笏
笏 笏Uwo display areas, one to show the color as 笏
笏 笏Eithered, the other to show the color as solid. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4olid Color 笏4elected - displays selected color as a solid 笏
笏heck Box 笏Dolor. 笏
笏 笏eselected - displays selected color as dithered. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ray Value Bar 笏1rovides a graphical way to select the lightness 笏
笏 笏Pr darkness of the color you want to create. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nput value area: Hue, Sat, 笏1rovides a non-graphical way to select the 笏
笏Bnd Value 笏Mightness or darkness of the color you want to 笏
笏 笏Dreate. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nput value area: Red, Green, 笏1rovides a nongraphical way to specify the hue, 笏
笏Bnd Blue 笏Taturation, and value of the color you want to 笏
笏 笏Dreate. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 9. Chapter 5 Using the Menu Editor 笊絶武笊
This chapter describes how to use the Menu Editor to create menus, which play
an important role in polished, commercial-quality applications. Specifically,
this chapter shows how to:
Create standard pull-down menus with multiple levels of menu items.
Create pop-up menus that the user displays with the right mouse button.
Create menus with component arrays of menu items, so your application can
build menus at run time.
笊絶武笊 9.1. Understanding the Menu Editor 笊絶武笊
Figure 5-1 shows the Menu Editor opened to a form with a File and an Edit menu:
Figure 5-1 Menu Editor
笊絶武笊 9.1.1. Understanding the Menu Editor Outline 笊絶武笊
Figure 5-1 shows an outline of items, such as File, Save As, or Paste, in the
lower part of the Menu Editor window. Each item represents a menu, submenu, or
menu command: depending on its indentation level in the outline:
Menu title - when the item is indented least, flush left in the outline;
for example, Edit.
Menu command - when the item is indented most in that menu; for example,
Cut.
Submenu (not shown) - when there are more than two indentation levels on
the same menu, and the item is in the middle-neither the most nor least
indented.
笊絶武笊 9.1.2. Editing Menu Properties from the Menu Editor 笊絶武笊
Each item in the Menu Editor outline is a menu component-a visual object you
can edit. First, you select it by clicking on it. Then, you can edit in any of
the ways described in this section.
笊絶武笊 9.1.2.1. Editing Text Displayed in the Menu Editor 笊絶武笊
The Menu Editor highlights the text of the selected item and displays it as two
entities, separated by a \t:
The caption - the text the user sees on the menu; for example, Save As.
A shortcut - enter the shortcut text after the \t. Certain keys have a
special representation in shortcut text; for example, you represent a
Control-C as ^c (caret c) and the Insert key as {Ins}. For further
information, see Adding Shortcuts.
For a picture of a selected item in the Menu Editor outline, see Figure 5-1;
Copy is selected. If there is no shortcut, you see just the caption and the
\t.
笊絶武笊 9.1.2.2. Adding New Items 笊絶武笊
You can add a new item below the selected item in these ways:
Choose Selected=>Add Item or enter Control-Insert from the keyboard. This
adds the new item at the same indentation level as the selected item.
Choose Selected=>Add Subitem or enter Shift-Insert from the keyboard.
This adds the new item indented below the selected item, as a "child."
笊絶武笊 9.1.2.3. Adjusting Items 笊絶武笊
You can adjust the indentation level of the selected item in these ways:
Choose Selected=>Move Left or click on the Left button. This moves the
item left in the outline, typically to become a menu title.
Choose Selected=>Move Right or click on the Right button. This moves the
item right in the outline, typically to become a menu command.
Similarly, you can move the selected item up or down in the outline:
Choose Selected=>Move Up or click on the Up button.
Choose Selected=>Move Down or click on the Down button.
Tip: When you move a item that has subitems (children), the subitems move
with the item.
笊絶武笊 9.1.3. Editing Menu Properties from the Property Editor 笊絶武笊
Figure 5-2 shows the Property Editor displaying properties of the selected Copy item:
Figure 5-2 Property Editor displaying the Copy item.
In the figure, you see Caption and Shortcut properties, which are initially set
to the text you entered with the menu item. In the Property Editor, you can
view all menu properties and edit most of them.
笊絶武笊 9.2. Using the Menu Editor 笊絶武笊
This section provides detailed steps for common Menu Editor tasks; for other
menu tasks, see Using the Property Editor to Edit Menu Properties.
笊絶武笊 9.2.1. Opening the Menu Editor 笊絶武笊
To open the Menu Editor, choose one of the following commands in the Project
window:
Choose Windows=>Menu editor.
Choose Selected=>Open menu.
Click on the Menu editor tool bar button
If a form is selected when the Menu Editor is opened, the menus of that form
are displayed. To select another form, use the drop-down list at the top of
the Menu Editor window.
笊絶武笊 9.2.2. Creating Menus on a Menuless Form 笊絶武笊
To show how to create menus on a form, we will build File and Edit menus. Each
of the next sections will add another part toward this goal. When complete, the
Menu Editor outline should look as follows:
File
Open
Save As
Close
Edit
Copy
Cut
Paste
Begin with the following steps:
1. Click on the form, to select it.
2. In the Project window, choose Selected=>Open Menu. The Menu Editor
appears, displaying an empty window.
3. In the Menu Editor window, choose Selected=>Add Item. This adds the first
item. The Menu Editor outline should look as follows:
Menu1
4. Press Enter. This displays Menu1 on the form (prior to this, it was only
in the outline).
笊絶武笊 9.2.3. Adding an Item 笊絶武笊
Continuing with the example, add commands to the Menu1 menu:
1. In the Menu Editor, click on Menu1 to select it.
2. In the Menu Editor, choose Selected=>Add Subitem. This indents an item
below Menu1. Note that you can do the same thing by typing
Control-Shift-Insert.
Menu1
Menu2
3. Then, click on the Menu2 item, choose Selected=>Add Item, and press
Enter. The Menu Editor outline should now look as follows:
Menu1
Menu2
Menu3
笊絶武笊 9.2.4. Editing Captions 笊絶武笊
At this point, you have a menu with three commands, but the text in the
captions is incorrect. Follow these steps to edit the caption:
1. In the Menu Editor, click on Menu1 to select the text.
2. Type over the selected text with File. Similarly, type over Menu2, and
Menu3 with Open and Save As and press Enter. The Menu Editor outline
should now look as follows:
File
Open
Save As
3. To add an item for the Edit command, select the File item and choose
Selected=>Add Item. Note that this adds Menu4 after Save As, not Open.
The Menu Editor outline should now look as follows:
File
Open
Save As
Menu4
4. To complete the File and Edit menus, use the commands just shown to add
items and edit the selected text to produce the following outline:
File
Open
Save As
Close
Edit
Copy
Cut
Paste
These menus are now ready to be connected to event procedures. For steps to do
this, see Using the Code Editor to Define Menu Behavior, which completes this
example.
Tip: File and Edit, in the menu edit outline, now have a dash (-) and a file
symbol to the left of their names. The dash or negative symbol indicates that
the menu title has submenus and is in an expanded state. To collapse the menu
selection, click the - symbol. The negative symbol changes to a positive
symbol. The - and + symbols are toggle switches to collapse or expand menu
titles and make it easier for you to view and edit your menus.
The positive symbol illustrates that the menu title contains submenus but is
in a collapsed state. To expand the list to view all the submenus, click the +
symbol.
笊絶武笊 9.2.5. Deleting an Item 笊絶武笊
To delete an item, select it in the outline; then click on the Remove item
button or choose Edit=> Delete and the item is removed. Any items indented
below the selected item (that is, children) are also deleted.
笊絶武笊 9.2.6. Adding a Separating Line 笊絶武笊
When you pull down the Menu Editor Selected menu, notice there are lines (that
is, separator bars) separating the different programming functions. To include
a separator bar in your menus, use a hyphen (-) as the caption of an item.
笊絶武笊 9.2.7. Undoing Menu Value Changes 笊絶武笊
The Menu Editor supports a multi-level undo feature. To undo an edit operation,
choose Edit=> Undo. In the Menu Editor you can undo the following operations:
Editing an item and pressing Enter.
Choosing a Menu Editor menu command.
Clicking on the Left, Right, Up, or Down button.
If you choose Undo repeatedly, one edit command at a time is "undone" until
the Undo/Redo Stack Depth limit is reached.
Tip: To increase this depth limit, choose Options=>Environment=>Undo/Redo
Stack Depth in the Project window. If you have undone an edit by mistake, you
can use the Edit=> Redo to reinstate the edit operation.
笊絶武笊 9.3. Using the Property Editor to Edit Menu Properties 笊絶武笊
The Property Editor can display the properties of an item that you selected in
the Menu Editor. Most menu properties can be edited using the Property Editor.
Tip: When you select an item in the Menu Editor outline, this deselects any
objects on your form, such as buttons or text boxes, that were previously
selected.
笊絶武笊 9.3.1. Opening the Property Editor with Menu Properties 笊絶武笊
If you double-click on an item in the Menu Editor outline, the Property Editor
displays properties of that item. Alternatively, you can select the item in the
outline and choose Window=> Property Editor in the Project window (or simply
press F4).
笊絶武笊 9.3.2. Adding Mnemonics 笊絶武笊
If you insert mnemonics (also called access keys) in your pull-down menus, the
user sees certain designated characters underlined: File, Open, Save, Save As,
and Close. To select an item, the user holds down a meta key (for example, Alt
or Ctrl+Alt) and presses the designated character.
To add a mnemonic, you can edit the Caption property of an item selected in the
Menu Editor outline, using the Property editor. Or, you can edit selected text
in the Menu Editor outline. Specifically, you insert an ampersand (&) in the
caption of an item before each designated character. The following example
shows items with ampersands in the Menu Editor outline:
&File
&Open
&Save
S&ave As
&Close
To choose File=>Save As, the user enters Alt F A (if Alt is the meta key).
笊絶武笊 9.3.3. Adding Shortcuts 笊絶武笊
A shortcut is a key or combination of keys that activates a menu command
whether the menu item is visible or not. For example, the OS/2 shortcuts for
the edit commands include:
Copy Ctrl+INS
Cut Shift+DEL
Paste Shift+INS
And the Windows NT and Windows 95 shortcuts for the edit commands include:
Copy Ctrl+C
Cut Ctrl+X
Paste Ctrl+V
The shortcut associated with a menu item is displayed beside its caption on the
menu, as shown above.
笊絶武笊 9.3.3.1. Representing Special Keys in Shortcuts 笊絶武笊
The following keys have a special representation as you enter them in
shortcuts:
For the Control key, enter a caret (^). For example, for Ctrl+C, set the
Shortcut property to ^c.
For the Shift key, enter a plus sign (+). For example, for Ctrl+Shift+C,
set the Shortcut property to ^+c.
For the Alt key, enter a percent sign (%). For example, for Ctrl+Alt+F,
set the Shortcut property to ^%f.
For the Insert or Delete keys, enter {INS}, {insert}, {DEL}, or {delete}
For example, for Ctrl+INS, set the Shortcut property to ^{INS}.
For a function key, enter f and an integer enclosed in braces. For
example, for Function key F12, set the Shortcut property to {f12}.
Enter the characters in the order they are to appear on the menu. For example,
^{INS} appears on the menu as CTRL+INS. The characters you enter are case
insensitive; the Menu Editor standardizes your entries. So, ^{ins} and ^{INS}
both appear as Ctrl+Ins.
Only the keys commonly used for shortcuts are shown here. To get a complete
list of the way to represent keys, see the Shortcut Property in the VisualAge
for Basic Language Reference Online Help.
笊絶武笊 9.3.3.2. Entering the Shortcut Text 笊絶武笊
You can add the encoded shortcut text in two ways:
Add the text after a \t in the item's selected text in the Menu Editor
outline.
Edit the ShortCut property of the selected item using the Property
Editor.
Follow these steps to enter a shortcut for the Copy command:
1. In the Menu Editor window, double-click on the Copy item.
2. When the Property Editor appears, displaying properties of Copy, set the
ShortCut property to the text ^{ins} or ^c, depending on customary usage
on your platform.
笊絶武笊 9.3.4. Creating Component Arrays for Menus 笊絶武笊
It is often convenient to reference menu commands as elements of an array,
rather than as isolated commands. This is especially useful when your
application builds some menus at run time; for example, in a menu of file names
of open files.
As an example of how to create a component array, consider the Edit menu
mentioned throughout this chapter. As an alternative to menu items named mCopy,
mCut, and mPaste, you could have an array, Edit[n], with n having index values
of 0, 1 and 2. To do this, you must select each item (Copy, Cut, and Paste, in
this case), item by item, in the Menu Editor outline and assign it the same
name: Edit. See Chapter 4, Using the Property Editor., for further information
about Creating Component Arrays.
笊絶武笊 9.4. Using the Code Editor to Define Menu Behavior 笊絶武笊
This section describes how to make your menus functional; specifically, you
need to know the following information:
How the menus are connected to the event procedures.
How to enter the necessary code.
笊絶武笊 9.4.1. Connecting Menu Commands and Event Procedures 笊絶武笊
When an end-user chooses a menu, VisualAge for Basic calls the event procedure
you specify to process that event. The name of the event procedure is derived
from the name of the item and the name of the event. For example, Menu1_Click
is derived from Menu1 and the Click event.
笊絶武笊 9.4.1.1. Using the Name Property to Connect 笊絶武笊
For any menu object, although the Caption property specifies the text the user
sees (for example, Copy), the Name property specifies the object in your code.
When you create an item in the Menu Editor outline, VisualAge for Basic
automatically assigns it a name, such as Menu1. However, if you change the name
to something more mnemonic, such as mCopy, you also make the name of the event
procedure more understandable-changing it from Menu1_Click to mCopy_Click.
笊絶武笊 9.4.1.2. Changing Item Names 笊絶武笊
To change the Name of an item selected in the outline, edit the Name property
using the Property Editor. You can use Copy both as the Name property and the
Caption property of an item.
To continue with the File and Edit menu example, use the Property Editor to
change the Name property of your items-the names to use in your code. Take the
following steps to change the Name property of Copy:
1. In the Menu Editor, double-click on Copy, to open the Property Editor.
2. In the Property Editor, change the Name property to mCopy.
Similarly, change the Name property of Cut and Paste items to mCut, and
mPaste. Now, you can supply code for these menu commands.
笊絶武笊 9.4.2. Adding Code to the Menu Sub Procedures 笊絶武笊
Enter code for the Copy command as follows:
1. In the Menu Editor, click on the Copy item to select it.
2. From the Project window, choose Selected=>Open Code.
This opens the Code Editor, which displays the mCopy_Click Sub procedure.
When the Code Editor opens, it displays a starter procedure, which you can
edit to add the code to process your command.
To construct an example that make a functional Edit menu with Copy, Cut, and
Paste commands, follow these steps:
1. Create a new application, draw a text box on the form, and change its
name to Text1..
2. Set the Multiline property of Text1 to True.
3. Use the Code Editor to add code, one by one, to the Sub procedures
mCopy_Click, mCut_Click, and mPaste_Click:
Sub mCopy_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText
End Sub
Sub mCut_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.SelText = ""
End Sub
Sub mPaste_Click()
Text1.SelText = Clipboard.GetText()
End Sub
Finally, to try out your menus, do the following:
1. In the Project Window, choose Run.
2. Use the Copy, Cut, and Paste commands to edit text in Text1, or to and
from Text1 and another object or application, using the clipboard.
笊絶武笊 9.5. Editing Other Menu Properties with the Property Editor 笊絶武笊
This section describes some other menu properties that you can view and edit
using the Property Editor. You can open the Property Editor to edit an item
selected in the Menu Editor outline using Selected=>Properties or by
double-clicking on the item in the Menu Editor outline.
See also: Chapter 4, Using the Property Editor, for more about editing
properties.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏hecked 笏5rue places a check mark beside a menu item; False removes 笏
笏 笏Jt. You can set Checked at run time to show a user whether a笏
笏 笏Uoggle is on or off; for example, to show whether a lock is 笏
笏 笏Tet or unset. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nabled 笏ontrols whether or not a menu item is available. You can 笏
笏 笏Fnable and disable menu items at run time. For example, you 笏
笏 笏Dan disable menu items when the commands or features they 笏
笏 笏Domplement are invalid. When you disable a menu item, it 笏
笏 笏Bppears dimmed (gray). To remove a disabled menu item 笏
笏 笏Dompletely, set its Visible property to False. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elpContextID 笏1rovides your application with context-sensitive help. To 笏
笏 笏Nake a menu item context sensitive, assign the same number 笏
笏 笏Uo both the menu item's HelpContextID property and the .h 笏
笏 笏(header file) used to compile the help file. A help file 笏
笏 笏Dalls the identified topic by the current context number 笏
笏 笏Xhen you press the F1 key. 笏
笏 笏5ip: The name of the application help file is set using the 笏
笏 笏elpFile property. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7isible : 笏5rue shows, and False hides, a menu item at run time. 笏
笏 笏5ip: A menu item can only receive focus if both properties 笏
笏 笏7isible and.Enabled are set to True. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8indowList 笏4pecifies at design time whether a menu contains a window 笏
笏 笏Mist selection. You use this property if your application 笏
笏 笏Dan have many windows open at the same time. The WindowList 笏
笏 笏Qroperty allows you to switch between the different windows 笏
笏 笏Pr files. WindowList is read-only at run time. Only one menu笏
笏 笏Domponent on a Form can have a Window List selection. 笏
笏 笏4etting the WindowList property to True causes the Window 笏
笏 笏ist menu to add menu items below it. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 9.6. Creating a Pop-Up Menu 笊絶武笊
The menus described in this section are called pop-up menus because they appear
only when the user takes a specific action, typically a click with the right
mouse button.
笊絶武笊 9.6.1. Creating a Pop-up Menu 笊絶武笊
You can use the Menu Editor to build a pop-up menu the same way you do other
menus. First, you build items on the menu bar and set the Visible property of
the title item to False. When the user presses (and releases) the right mouse
button, a MouseUp Sub procedure on the form is called. The MouseUp Sub
procedure uses the PopupMenu method to display the menu you have built, at the
position where the user clicks the right mouse button. The PopupMenu method
displays the menu, ignoring the Visible property.
To try this, follow these steps:
1. Click on a new form.
2. Choose Selected=>Open menu in the Project window.
3. In the Menu Editor window, choose Selected=>Add item.
4. Choose Selected=>Add Subitem.
5. Choose Selected=>Add Subitem. This gives you a Menu1 menu with commands
Menu2 and Menu3.
6. Double-click on Menu1 to open the Property Editor and set the Visible
property to False.
7. Also in the Property Editor, change the Name property to pMenu.
8. Choose Selected=>Code in the Project window, to open the Code Editor
9. In the Code Editor, select the Form object and the Mouse_Up event.
10. Enter the following code, which calls the PopupMenu method with the name
you gave the invisible menu on the menubar:
Sub Form_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If Button = 2 Then 'Right mouse button?
PopupMenu pMenu; 'Call method
End
End Sub
11. Run the application. Click the form with the right mouse button, and
choose one of the commands displayed by the PopupMenu method.
The pop-up menu appears and then disappears after you choose the command.
Consider placing calls to a MsgBox command in the appropriate event Sub
procedures to make these menus functional. See Connecting Menu Commands and
Event Procedures and Adding Code to the Menu Sub Procedures for further
information.
笊絶武笊 9.6.1.1. More on Pop-up Menus 笊絶武笊
Pop-up menus follow these rules:
There can be only one pop-up menu at a time.
To anchor the pop-up menu in a specific location, set the X and Y
coordinates.
To display the pop-up menu at the current cursor position, do not set the
coordinates.
When the pop-up menu is called, all code processing is suspended until the
pop-up menu is closed or the user selects a menu item. Then, normal code
processing continues.
See also: VisualAge for Basic Language Reference Online Help, PopupMenu
method.
笊絶武笊 10. Chapter 6 Using the Code Editor 笊絶武笊
You use the Code Editor to create, edit, and debug your project's source code.
The Code Editor accelerates the entry and organization of code, saving you
development time and cost. The Code Editor organizes your VisualAge for Basic
project code into manageable groups of task units called classes, subroutines,
functions, and declarations.
The Code Editor allows you to:
Display a program as a continuous flow of instructions.
Organize your code into individual procedures attached to objects.
Add behavior to objects to respond to user actions.
Browse through all the procedures within your application.
Create class declarations.
Undo one or more of your changes through a multiple-undo feature.
The Code Editor's organizational approach simplifies programming and reduces
the time required to test and locate errors.
This chapter details how to create and edit your code. Chapter 7, Testing and
Debugging Code provides more information on how to test and debug your
project.
笊絶武笊 10.1. Code Editor Features 笊絶武笊
The Code Editor has the following features:
A multi-functional code area allowing you to create, edit, and delete
VisualAge for Basic code.
A navigation area for moving between procedures in different objects and
modules.
A built-in code indentation mechanism.
A divisible edit window displaying two sections of the same code module
or two separate modules.
Familiar editing tools to accelerate common editing tasks.
A powerful search and replace tool including support for regular
expressions.
Options for colorizing code.
An ability to test your application's execution prior to generating an
executable.
A bookmark area to locate specific sections of your code.
The ability to print part or all of your project code.
A complete debugging facility that helps you find and correct errors, as
well as test the functions of your code modules.
笊絶武笊 10.2. Understanding the Code Editor 笊絶武笊
The Code Editor consists of a menu bar, a horizontal and vertical tool bar, a
navigation area, a code area, and a status area. By default, the Code Editor
displays one window code pane. You can display a second code pane by using the
sash to resize the code area window.
See also: The VisualAge for Basic Online Help, detailed information on each of
the toolbars and icons.
笊絶武笊 10.3. Using the Navigation Area 笊絶武笊
The Code Editor contains a navigation area containing combination boxes for
Module, Object/Class, and Event/Method. You use these combination boxes to
navigate through your code.
The ability to navigate through your code allows you to organize and edit code
in smaller, more manageable sections. The "compartmentalization" of code lets
you find and edit specific events or methods for the various objects within
your project, thus avoiding needless scrolling through the code.
VisualAge for Basic is able to recognize events and methods attached to objects
and classes. Because separate events are recognized, VisualAge for Basic
automatically organizes the code into the individual events or methods. When
you enter code for several events at once, VisualAge for Basic separates the
code into the individual events as soon as you have finished entering the code
for a specific event and started entering the code for another. When VisualAge
for Basic fragments your code, you might notice that what you have just entered
appears to have vanished-it has been organized into its own event or method. To
view code for a specific event, open the Event/Method combination box to list
the object's associated events and select the one you wish to view.
笊絶武笊 10.3.1. Working with Modules 笊絶武笊
You use the Module combination box to select the module that contains the
VisualAge for Basic procedures you write. The Project window displays the
modules that are part of your project. Code modules are shown in the Project
window with a .bas file extension. Form modules are shown with a .i file
extension.
笊絶武笊 10.3.1.1. Module Selector 笊絶武笊
The Module selector allows you to select which code module is displayed in the
current Code Editor pane. The Module drop-down list displays all modules and
objects available in your current project. The active editing pane displays the
selected module. For example, when you first launch VisualAge for Basic, it
opens with an empty form, named Form1-this is the type of object that would be
found listed in the Module selector.
Important: If you change a module's Name property, the new name automatically
replaces the name in the Module selector. You must modify any references to the
module in your code.
笊絶武笊 10.3.1.1.1. Specifying Scope 笊絶武笊
You use the keywords Dim, Private, Global, and Public to set the scope of the
variables. Where you place these keywords determines if the scope is for all
modules or just the current module. For example, selecting the Module drop-down
selection box, choosing Form1, and placing your code in the Form1.i module,
determines the scope to be public. This means that Form1 and all its contained
objects can access the value of the variable.
See also: Chapter 9, Working with Data and Object Variables for more
information about variables and scope.
笊絶武笊 10.3.1.2. Object/Class Selector 笊絶武笊
The Object/Class selector allows you to select a specific object or class in
the selected code module. The Object/Class selector lets you assign code to a
specific object within the module, or to a general procedure, available to all
objects in the project. For example, if you place a command button on your
default startup form and you want to assign behavior specifically to this
button, choose Command1 from the Object/Class selector.
Tip: Arrays use square brackets ([]) for easy identification in the
Object/Class selector.
Important: If you change an object's Name property, the new name automatically
replaces the name in the Object/Class selector. You must modify any references
to the object in your code.
笊絶武笊 10.3.1.3. Event/Method Selector 笊絶武笊
The Event/Method selector allows you to select a specific method or event
associated with an object in your project. After selecting an object, choose
any of the object's specific events and set the object's behavior using
VisualAge for Basic code.
Tip: An ellipsis (...) appears next to an event already containing code.
笊絶武笊 10.4. Programming Behavior 笊絶武笊
To access the Code Editor:
Select Windows=>Code Editor menu item from the Project window.
Click the Code Editor button in the Project window.
For every module, object, and event you select, the code area displays a
procedure template ready for you to fill in. A procedure template is exclusive
to the object and event. The template contains Sub and End Sub statements.
You define how the object responds to other objects and to user input by
adding VisualAge for Basic code between the Sub and End Sub statements.
The event procedure template appears in the code area after you select an
object in the Object/Class combination box and an event in the Event/Method
combination box.
Tip: The Code Editor provides Sub and End Sub, Function and End Function,
Property Set and End Property, Property Get and End Property, and Class and
End Class as templates.
笊絶武笊 10.5. Adding Code to the Form_Load Event: 笊絶武笊
To set or initialize Form1, add the following code to Form1's Load event.
1. Click on the drop-down button of the Module selector combination box. A
drop-down list containing all available project modules displays.
2. Click on Form1 module or press the cursor keys to scroll to Form1 module.
3. Click on the drop-down button of the Object/Class selector combination
box. A drop-down list containing all the module's available objects and
classes displays.
4. Click on Form or press the cursor keys to scroll to Form.
5. Click on the drop-down button of the Event/Method selector combination
box. A drop-down list containing all the available events and methods
displays.
6. Highlight Load... if it does not already appear as a selection.
The drop-down selection box closes and Load... appears under the words
Event/Method.
Tip: To quickly select a drop-down list item, type the first letter of
the desired item. For example, press the L key to select a Load event.
The Code Editor's editing pane displays a procedure template for the Form
Load event.
7. Type in the following:
Sub Form_Load()
'List of instructions to perform on startup.
End Sub
The code is now attached to the Form_Load event.
To add code to the other components, click on the component in the form or
select the component from the Object/Class drop-down box.
笊絶武笊 10.6. Adding code to a General Procedure: 笊絶武笊
Event procedures do not contain all your code. You can also use the navigation
area to create general procedures or class declarations. General procedures are
not connected to a specific event. General procedures stored in a form are
available to all procedures within that form. Procedures stored within a code
module are general by definition and are globally available within the
application.
To create a general procedure:
1. Select the desired module from the Module combination box.
2. Select (General) in the Object/Class combination box.
3. Select (Declarations) in the Event/Method combination box.
4. Enter VisualAge for Basic code in the code area for the form's new
procedure. The general procedures you create apply to all objects
contained within the selected form
Tip: You can create a new procedure automatically by entering the declaration
on a new line in the Code Editor. The Code Editor detects when you press the
Enter key and automatically creates the new procedure.
You can also enter a specific subroutine, including the object and event,
without selecting it in the navigation area. For example, you can code a Click
event for the Command1 object by entering Sub Command1_Click() in the code
area. The Code Editor automatically sorts and saves the code under Command1's
Click event.
See also: Chapter 11, Organizing Code for more details on event and general
procedures.
笊絶武笊 10.7. The Code Area 笊絶武笊
The Code Editor's code area displays the code for your VisualAge for Basic
project. When you first open the Code Editor, a single editing pane appears. To
view code that is outside of the code area, you can scroll up, down, left, or
right. You can scroll through the code area using the scroll bars, the cursor
keys, or the Page Up or Page Down keys. You can also split the code area to
display a second editing pane.
笊絶武笊 10.7.1. Logical Lines 笊絶武笊
A single line of continuous code is called a logical line. When you enter a
long line of code, the Code Editor scrolls to display the text you enter until
you press the Enter key (hard return). VisualAge for Basic scrolls the viewing
window when you enter code that exceeds the width of the code area window.
If you need to break the logical line into one or more physical lines, you must
join the lines with the continuation character (_). A continuation character is
similar to a soft return in a word processor. The following example shows how
to break the logical line of a Declare function:
Declare Function GetWindowsDirectory Lib "Kernel" (ByVal WDir$,_
ByVal Size%) As String
笊絶武笊 10.7.2. Using Two Edit Panes 笊絶武笊
The VisualAge for Basic Code Editor allows you to split the code area into two
editing panels. Each panel can be used to edit separate sections of the same
code module, or two different code modules at the same time.
Using two editing panes limits the amount of scrolling back and forth within
the same code module. Each pane scrolls separately, both horizontally and
vertically, making it easy to compare different code segments. You can also
cut, copy, or paste code from one pane to another.
To quickly move or copy text between procedures and code modules, split the
code area into two panes.
To split the Code Editor into two panes:
1. Select the sash with your mouse pointer. The cursor changes shape
indicating the sash can be moved.
2. Drag the sash downward to size the two editing panes. The code area
splits to show two edit panes.
As you switch between the panes, the Navigation area displays the
corresponding module, object, and procedure.
笊絶武笊 10.7.3. Using the Navigation Area with Two Edit Panes 笊絶武笊
The pane containing the cursor is the active pane. Several Code Editor
operations apply only to the active editing pane. For example, to select a new
code module to edit, the active edit pane (with the cursor) displays the new
module. To choose which of the two panes displays the module you want to edit,
click on the desired pane.
笊絶武笊 10.8. Editing Code 笊絶武笊
The code area provides you with editing operations to cut, copy, and paste
text. You can select text with the mouse or by using keyboard commands. When
you move the mouse into the code area, as with any text field, the mouse
pointer changes from its normal pointer ( ) to a text pointer called the I-beam
pointer ().
The following table describes the editing operations available in the Code
Editor.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏5o: 笏o This: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nter code 笏4elect the code area and type. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏orrect mistakes as you type 笏6se the Backspace key. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete selected text 笏6se the Delete key or choose Edit=> 笏
笏 笏elete. The text is deleted without 笏
笏 笏Ceing saved in the clipboard. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4elect a word 笏ouble-click. or Hold down the Shift key笏
笏 笏Xhile pressing the right or left arrow 笏
笏 笏Ley to extend the selection. If you 笏
笏 笏Ttart typing while text is selected, the笏
笏 笏Telected text is replaced. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4elect a line 笏5riple-click. or Hold down the Shift key笏
笏 笏Xhile pressing the up or down arrow key 笏
笏 笏Uo extend selection. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4elect a large section of text 笏rag the text pointer over the text you 笏
笏 笏Xant to edit from the beginning to the 笏
笏 笏Fnd of the text range. or Hold down the笏
笏 笏4hift key while pressing the up or down 笏
笏 笏Brrow key, then mark the lines you want 笏
笏 笏Uo edit. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏hange the text insertion mode 笏6se the Insert key. The Insert key works笏
笏 笏Bs a toggle, enabling you to switch 笏
笏 笏Cetween insert and overwrite text 笏
笏 笏Fditing modes. The Code Editor status 笏
笏 笏Brea displays a confirmation of the 笏
笏 笏Durrent editing mode: Insert mode is 笏
笏 笏Jndicated by a bold INS. Overwrite mode 笏
笏 笏Js indicated by a grayed-out INS. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏avigate through lines of text 笏6se the up, down, left, and right cursor笏
笏 笏Leys, or use the code area scroll bars. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ut text 笏hoose Edit=> Cut, click on the Cut icon笏
笏 笏, or use the Ctrl+X keyboard shortcut. 笏
笏 笏ou can cut, copy, and paste text 笏
笏 笏Cetween the two text panes in the Code 笏
笏 笏ditor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏opy text 笏hoose Edit=> Copy, click on the Copy 笏
笏 笏Jcon, .or use the Ctrl+C keyboard 笏
笏 笏Thortcut. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1aste text 笏hoose Edit=> Paste, click on the Paste 笏
笏 笏Jcon,. or use the Ctrl+V keyboard 笏
笏 笏Thortcut. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: You can access help on VisualAge for Basic syntax while working in the
Code Editor. Select a property, event, method, or keyword in the code area and
press the F1 key. The F1 key is also available for each event in the navigation
area.
笊絶武笊 10.8.1. Undoing Changes in the Code Area 笊絶武笊
Most changes that affect the objects that you build are reversible. You can
undo the following operations by choosing Undo from the Edit menu: Insert,
Delete, Cut, Copy, Paste, and Replace.
Tip: If a command cannot be undone, VisualAge for Basic warns you before
performing the command.
You can undo and redo multiple levels of changes that you make to objects while
you build interfaces. The system keeps track of the operations you make on
objects. The order of operations are undone and redone in the same sequence as
they were performed.
笊絶武笊 10.8.1.1. To Undo an Operation 笊絶武笊
Choose Edit=> Undo [operation] from the Code Editor. The most recent
operation appears after Undo in the menu. For example, if the most recent
operation you made was resize, the menu item shows Undo Resize.
The object returns to its state prior to the operation. The Edit menu shows
that a Redo operation is available for the operation that was just undone.
When you undo an operation for the first time in a sequence of operations, the
Undo menu item is gray until you redo it.
笊絶武笊 10.8.1.2. To Redo an Operation 笊絶武笊
Choose Edit=> Redo [operation] from the Code Editor.
The change appears as it did before you chose Undo.
A redo operation is only available after at least one undo operation. The
first Undo operation makes the Redo menu item gray. Accordingly, when you have
redone the most recent operation in the sequence of operations, the Redo menu
item is gray. As soon as you undo an operation, the Redo menu item is
selectable again, showing Redo [ ].
笊絶武笊 10.8.2. Loading Code 笊絶武笊
In addition to writing code from scratch, you can bring existing Basic or text
files into the Code Editor. VisualAge for Basic not only loads external code
files, it automatically sorts the code in the Code Editor.
1. Select File=>Add File menu item. A file list box appears.
2. Locate the directory of your file, and select the *.bas file.
3. Acknowledge the file selection. The file *.bas loads into your project.
The Project window shows the file name. Select the Module drop-down
selection box to show the code in the Code Editor.
Tip: Files with a .bas extension load Basic files into your project. Files
with a .i extension load existing forms into your project.
笊絶武笊 10.8.3. Saving Code 笊絶武笊
The Code Editor provides various file saving options that let you save code in
the code area in text format.
After you finish coding your project, save it so you can open the file again:
1. Select File=>Save As in the Project window. A file dialog box appears.
Type in your new file name.
2. Type in the file name for form1.i
3. Select the directory where you will store your completed project and save
the .i file. The new .i file name is updated in the Project window list
of files.
You are prompted to save the module.
4. Type in the filename, with a .bas extension, and select OK. The new .bas
file name is updated in the Project window list of modules.
The next prompt is the name of the project.
5. Type in the name of your project.prj and select OK.
笊絶武笊 10.9. Finding and Replacing Text 笊絶武笊
You use the Find and Replace, operations to:
Search for occurrences of text in the current module or across all
modules in your project.
Search for text forward and backward from the cursor position.
Search for text that matches the uppercase and lowercase letters you type
in the Find field.
Replace specific occurrences of text.
To search for text in your code modules:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏hoose: 笏5o: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dit=> Find 笏ocate occurrences of the text you 笏
笏 笏Tpecify. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dit=>Replace 笏hange text or code fragments throughout笏
笏 笏Zour modules. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dit=> Find Next, Find Previous after a 笏ocate the next or previous instance of 笏
笏ind or Replace command 笏Pf the text. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
The Code Editor Edit=>Find menu selection calls the Find window.
The Find and Replace windows have similar functions. The following table
describes the Find and Replace windows.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0peration 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ind/What 笏4pecifies the text you want to find. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8ith 笏4pecifies the text that replaces the 笏
笏 笏ind text. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8hole words 笏inds entire words, not strings embedded笏
笏 笏Jn a larger word. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ase sensitive 笏4earches for text with the same 笏
笏 笏Dapitalization as the text in the Find 笏
笏 笏Gield. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3egular expression 笏nterprets the specified text as a 笏
笏 笏Qattern (containing alphanumeric or 笏
笏 笏Tpecial characters) to be searched for. 笏
笏 笏f not selected, performs a literal 笏
笏 笏Natch. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4cope 笏4pecifies whether to search the text in 笏
笏 笏Uhe current module only or all modules. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ext 笏4earches for the next occurrence of the 笏
笏 笏Uext you want to find. When the 笏
笏 笏Tpecified text is found, the text is 笏
笏 笏Iighlighted in the code area. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1revious 笏inds the previous occurrence of the 笏
笏 笏Uext you want to find. When the 笏
笏 笏Tpecified text is found, the text is 笏
笏 笏Iighlighted in the code area. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3eplace 笏3eplaces occurrences of the Find text 笏
笏 笏Xith replacement text you specify. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ancel 笏ancels the search and closes the 笏
笏 笏Xindow. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
The Code Editor Edit=>Replace menu selection calls the Replace window.
If you select Regular expression mode, the Find/What text is interpreted as
such. The syntax for regular expressions is defined as:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏3eg.Exp.Mode Syntax 笏eaning 笏
笏0ptions 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏D 笏5he character c where c is not a special character. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏c 笏5he character c where c is any character, except a digit in 笏
笏 笏Uhe range 1-9. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏5he beginning of the line being compared. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏$ 笏5he end of the line being compared. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏. 笏ny character in the input. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏s] 笏ny character in the set s, where s is a sequence of 笏
笏 笏Dharacters and/or a range of characters, for example, [c-c].笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏^s] 笏ny character not in the set s, where s is defined as above.笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏S* 笏ero or more successive occurrences of the regular 笏
笏 笏Fxpression r. The longest leftmost match is chosen. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏S+ 笏0ne or more successive occurrences of the regular expression笏
笏 笏S. The longest leftmost match is chosen. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏S? 笏ero or one occurrence of the regular expression r. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏S1r2 笏5he occurrence of regular expression r1 followed by the 笏
笏 笏Pccurrence of regular expression r2. (Concatenation) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏(r\) 笏5he regular expression r. When \n (where n is a number 笏
笏 笏Hreater than zero) appears in a constructed regular 笏
笏 笏Fxpression, it stands for the regular expression x where x 笏
笏 笏Js the nth regular expression enclosed in \( and \) that 笏
笏 笏Bppeared earlier in the constructed regular expression. For 笏
笏 笏Fxample, \(r\)x\(y\)z\2 is the concatenation of regular 笏
笏 笏Fxpressions rxyzy. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏(r) 笏5he nested regular expression r. Nesting is used so that the笏
笏 笏Nultiplier characters (*, + and ?) can be applied to a 笏
笏 笏Domplex regular expression. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: If you are loading projects designed in other applications please note
that the ?, *, and # may have different meanings.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏4yntax Option 笏efinition 笏0ther Apps 笏quivalent for Other笏
笏 笏 笏efinition 笏pps 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏? 笏0 or 1 occurence of 笏atches any single 笏. 笏
笏 笏Uhe prevision 笏Dharacter 笏 笏
笏 笏Segular expression. 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏* 笏0 or more occurences笏atches any number 笏.* 笏
笏 笏Pf the previous 笏Pf characters 笏 笏
笏 笏Segular expression 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏# 笏atch any single 笏atch any single 笏0-9] 笏
笏 笏Eigit character. 笏Eigit character. 笏 笏
笏 笏 笏6sed as a shortcut 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Characters that have special meaning except when they appear within square
brackets ([]) or are preceded by \ are: ., *, [, \. Other special characters,
such as $ have special meaning in more restricted contexts.
The following table describes the meaning of special characters:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏4pecial Character 笏eaning 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏 At the beginning of an expression permits a 笏
笏 笏Tuccessful match only immediately after a new 笏
笏 笏Mine. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏$ 笏t the end of an expression requires a trailing 笏
笏 笏Oewline. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏- only when used 笏enotes a range, [c-c], unless it is just after 笏
笏Xithin square 笏Uhe open bracket or before the closing bracket, 笏
笏Crackets 笏-c] or [c-] in which case it has no special 笏
笏 笏Neaning. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 only when used 笏eans complement of, if it immediately follows the笏
笏Xithin square 笏Ppen bracket (example: [^c]). Elsewhere between 笏
笏Crackets 笏Crackets (example: [c^]) it stands for the 笏
笏 笏Prdinary character ^. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 operator 笏5o read as an ordinary character with no special 笏
笏 笏Neaning must be preceded with another \, for 笏
笏 笏Fxample, \\. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 10.10. Code Colorization 笊絶武笊
To help you indentify the different elements in your source code, VisualAge for
Basic displays keywords, user-defined types, and comments in different colors
within the code area.
As you type in the code area, the Code Editor recognizes an VisualAge for Basic
keyword and changes the color or font style for that keyword. By default,
VisualAge for Basic colorizes keywords.
You can specify a color or font style for variants and user-defined types,
making them easy to recognize as you review your code. For example, you can
specify the display color for specific data types, such as Currency and Long.
Comments are easier to recognize if you set them to a different color or font
style. By default, each time you type the comment symbol ('), the font color
and style of the comment text, including the comment symbol, changes
immediately.
See also: Customizing VisualAge for Basic for complete details on how to set
the colors for your code. The default colors VisualAge for Basic uses to
colorize keywords and comments depend on the display settings of your
environment.
笊絶武笊 10.11. Viewing Code 笊絶武笊
The Code Editor View menu provides several menu items that make it easy for you
to view procedures, locate definitions, and view bookmarks.
The Next Procedure and Previous Procedure menu items let you view declarations
and procedures. The GoTo Definition menu item locates procedure declarations.
The Bookmarks menu item lets you view the sections of your code where you
inserted bookmarks.
笊絶武笊 10.11.1. Viewing Procedures 笊絶武笊
The Code Editor helps you find and view individual procedures.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏hoose: 笏5o: 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ext Procedure and Previous 笏1rocedures appear in alphabetical order in the 笏
笏1rocedure 笏Dode area. VisualAge for Basic ignores empty 笏
笏 笏Fvent templates . 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7iew=>Next Procedure 笏7iew the next procedure. The next procedure 笏
笏 笏Bppears in the active pane of the code area. Any 笏
笏 笏Domments before the procedure appear at the top of笏
笏 笏Uhe active pane. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7iew=>Previous Procedure 笏7iew the previous procedure. The previous 笏
笏 笏Qrocedure appears in the active pane of the code 笏
笏 笏Brea. Any comments before the procedure appear at 笏
笏 笏Uhe top of the active pane. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 10.11.2. Locating Definitions 笊絶武笊
To look up procedure definitions quickly, use the Go To Definition menu item in
the Code Editor's View menu. For example, the Catalog_Click procedure contains
a call to the CardSelector_Click event procedure.
To display the CardSelector_Click procedure in the code area:
1. Select CardSelector_Click in the Catalog_Click procedure.
2. Choose View=> Go To Definition or the GoTo button The code for the
CardSelector_Click procedure appears in the code area.
You can locate variable declarations for variables you reference in your code.
To verify if the variable is an integer or a string:
1. Select the variable in the code area.
2. Choose View=> Go To Definition or click on the GoTo button.
The module containing the variable declaration appears in the Code Editor.
Choosing the Go To Definition menu item causes the interpreter to parse all
source code and display any errors in the bookmark area.
笊絶武笊 10.12. Running Your Application 笊絶武笊
You can test your project prior to compiling it, to make sure that the
application's execution runs as expected. The Run menu commands lets you
execute all or part of your project. With the syntax checking function, syntax
and run-time errors are detected within your code and you must correct them
prior to resuming execution. The ability to test your application and correct
run-time and syntax errors reduces the chances of errors appearing after the
project is compiled.
When you go to test mode, two types of errors could occur-syntax errors and
run-time errors.
Run-time errors occur after you check your syntax and begin executing your
application. Run-time errors are faults in logic (such as division by 0) or
user commands that VisualAge for Basic cannot execute.
To start execution of your project:
Press the Start/Continue button on the Project window or the Code
Editor.
Choose Run=>Start/Continue from the menu bar.
On Windows NT and Windows 95: Click on the F5 key
On OS/2: Click on the F7 key
Your project changes from design mode to run mode. The Toolbox, Property
Editor, and Code Editor disappear from your screen.
You can also step through the code, line by line, to test each individual line
of code. Testing of individual lines of code can include or exclude
subroutines. You use the Run=>Step or Run=>Step over commands to test your
project line by line.
You can pause execution of your application by choosing Run=>Break or by
clicking on the Break button
When you pause execution of your project, you can make changes to the code
during run time. When the changes are complete, click on the Start/Continue
button to resume the project's execution.
You can resume a project's execution by either:
Choosing Run=>Start/Continue or clicking on the Start/Continue button.
Choosing Run=>Restart.
The Code Editor also lets you set breakpoints within your project. When
program execution encounters a breakpoint the execution pauses.
See also: Chapter 7, Testing and Debugging Code, for more information on the
Code Editor's debugging interfaces, including breakpoints.
笊絶武笊 10.13. Using Bookmarks 笊絶武笊
The Code Editor's Bookmark area lets you set bookmarks within your project
code. A bookmark is a placeholder in your code that lets you quickly locate and
view marked sections. Bookmarks are useful when the size of your code modules
increase and you need to refer back to certain code sequences. When VisualAge
for Basic detects errors in your code, the bookmark area automatically lists
each error.
To display the bookmark area: 257693'.
Click on the display bookmark area toggle , or
Choose View=> Bookmarks from the Code Editor menu bar.
You add a bookmark by clicking on the Toggle Bookmark button As you add
bookmarks, the bookmark area displays.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏uttons 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete Marker 笏eletes the selected bookmark. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏o To 笏ocates a bookmark and updates the view of the 笏
笏 笏Dode area with the corresponding line of code. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lear Markers 笏lears all bookmarks in the code area. Errors 笏
笏 笏Misted in the bookmark area are removed only when 笏
笏 笏Uhe error is fixed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ookmark icon or 笏isplays the corresponding line of code in the 笏
笏rror icon 笏Dode area when you click on the icon. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ocation 笏ndicates the location of the bookmark within your笏
笏 笏Qroject code. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tatement/Error 笏ndicates the line of code that contains the 笏
笏 笏Cookmark or a description of the error detected by笏
笏 笏7isualAge for Basic . 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
To set a bookmark:
1. Position the cursor next to the line of code you want to mark.
2. Select Edit=> Add Bookmark.
You can also click on the Toggle Bookmark button. A bookmark icon appears in
the left margin of the code line and an entry is added to the bookmark list.
To locate bookmarks in your code modules, select the bookmark you want from
the bookmark area list and click on the Go To button. The code area updates to
display the module containing the bookmark.
Tip: You can double-click anywhere on a bookmark line to go directly to that
bookmark's location in your code. To delete bookmarks, select the bookmark you
want to remove and click on the Delete Marker button. To remove all bookmarks
at once, click on the Clear Markers push button.
The bookmark area also serves as an error directory. Any errors in your code
have a syntax error icon in the code area and a list of the errors appears in
the Bookmark. Syntax errors are spelling mistakes in your source code or
improperly used expressions. You locate syntax errors by selecting the Check
Syntax button
See also: Chapter 7, Testing and Debugging Code to learn more about the
bookmark area and handling errors. Errors listed in the bookmark area can not
be removed using the Delete Marker or Clear Markers buttons. You must correct
any errors and perform a syntax check to remove the errors.
笊絶武笊 10.14. Printing from the Code Editor 笊絶武笊
You can print your code using your operating system's print features. Use the
File=>Print menu command to activate the Print dialog box. The option buttons
let you select the current module, current object, current event, method or all
modules defined in the application.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏4election 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odule 笏1rints the text of code of the current 笏
笏 笏Nodule in the Code Editor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0bject 笏1rints the text or code of the current 笏
笏 笏Pbject in the Code Editor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏vent method 笏1rints the code of the current event or 笏
笏 笏Nethod in the Code Editor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ll 笏1rints all module text or all code in 笏
笏 笏Uhe application. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rinter... 笏isplays the Printer Select dialog box. 笏
笏 笏isplays a list of installed printers. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: The print feature uses the current operating system's printer drivers.
笊絶武笊 11. Chapter 7 Testing and Debugging Code 笊絶武笊
Debugging refers to the act of cleaning up of your program's source code.
Programming bugs are not unlike insects: they are small, usually overlooked,
and can be highly annoying-especially when they are recurring. VisualAge for
Basic has several interfaces and tools that can help you exterminate the bugs
within your application.
Bugs can consist of simple syntax errors or more complex run-time errors.
Syntax errors are usually due to spelling mistakes or improperly-used language
elements. Run-time errors contain correct syntax, but cause your VisualAge for
Basic application to act in unexpected ways. VisualAge for Basic does not allow
you to test your application or create an executable file while syntax errors
exist within the code. Syntax errors are fairly easy to correct-run-time errors
require a deeper analysis and evaluation of the expressions within your project
code.
In Chapter 6, Using the Code Editor, you learned about the tools you commonly
use when creating and editing code. In this chapter, you will learn about the
Code Editor's extensive debugging facilities. When debugging your application,
you primarily use the Breakpoints window and the Inspector. These interfaces
let you set conditions to pause execution of your application and evaluate how
it is treating certain watch expressions.
笊絶武笊 11.1. Understanding Program Modes 笊絶武笊
VisualAge for Basic can operate in three modes: design, run, or break mode. In
design mode, you create interfaces, set properties, and add behavior. When you
test your applications, VisualAge for Basic is in run mode. When there are
errors or if you suspend testing of your program, VisualAge for Basic is in
break mode.
The Project window title bar indicates the current mode by displaying [Design],
[Test], or [Test-Break] in the title bar.
In the different program modes, certain Run menu items are enabled while others
are disabled. The following table lists the Run menu items that are enabled and
disabled for each mode. The corresponding tool bar buttons are also enabled or
disabled.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ode 笏nabled Menu Items 笏isabled Menu Items 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏esign[Design] 笏4tart/Continue Step, Step 笏reak, End, Restart Set Next笏
笏 笏0ver (Code Editor only) 笏4tatement (Code Editor only) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3un[Test] 笏reak, End 笏4tart/Continue, RestartStep, 笏
笏 笏 笏4tep Over, Set Next Statement 笏
笏 笏 笏(Code Editor only) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reak[Test-Break] 笏4tart/Continue, End, 笏reak 笏
笏 笏3estartStep, Step Over (Code 笏 笏
笏 笏ditor only) 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 11.2. Checking Syntax 笊絶武笊
When you enter code in the Code Editor, mistakes sometimes find their way into
the code. The mistakes can range from simple typing errors to misused language
elements. These mistakes are called syntax errors. VisualAge for Basic
interprets your code, locates syntax errors and lists them in the bookmark
area. VisualAge for Basic also marks syntax errors in the code area. You can
check your application's syntax in one of two ways:
Initiate a manual syntax check.
Have VisualAge for Basic check the syntax for you before testing your
application.
Both syntax-checking methods go through your code, line by line, and list the
syntax errors one at a time.
Important: Errors stop the syntax checking process. To continue after
correcting an error, re-initiate the syntax check.
笊絶武笊 11.2.1. Manual Syntax Checking 笊絶武笊
When VisualAge for Basic is in design mode, you can perform a manual syntax
check whenever you want. You can begin a syntax check in one of the following
ways:
Choose the Debug=> Check Syntax command from the menu bar.
Click on the Check Syntax button on the tool bar.
Tip: When saving your project, you might want to do a manual syntax
check-this prevents a lengthy, error-by-error check prior to testing the
application. After starting a manual syntax check, the Code Editor opens the
bookmark area to list all the syntax errors.
The code area displays the first syntax error from the bookmark area list. The
syntax error icon identifies the line of code containing the error.
If VisualAge for Basic detects more than one error in your code, the bookmark
area lists all the errors. After correcting a syntax error, select the next
error in the bookmark area and click on the Go To button; the code area
displays the selected procedure. You might have to scroll through the bookmark
area list to locate the next syntax error. You can also double click on an
error listed in the bookmark area to update the display of the code area.
You can update the error list in the bookmark area by manually checking the
syntax again. Corrected errors are no longer in the error list.
笊絶武笊 11.2.2. Syntax Checking in Run Mode 笊絶武笊
When you run your application in test mode, VisualAge for Basic automatically
checks the syntax for errors. VisualAge for Basic prevents testing until you
correct all syntax errors in your code.
You correct errors and update the error list in the bookmark area in the same
way you perform a manual syntax check.
Important: When you modify a procedure and verify its syntax, VisualAge for
Basic automatically verifies the syntax of all dependant procedures.
笊絶武笊 11.2.3. Correcting Syntax Errors 笊絶武笊
After correcting syntax errors, you can either resume entering code, or you can
begin (or resume) running your application in test mode. If there are no more
errors, VisualAge for Basic closes the bookmark area and proceeds with the
execution of your application in test mode.
Tip: You should save your project after you correct the syntax errors-this
prevents you from having to correct the same mistake twice. The Code Editor's
status area has an icon that toggles between two states to act as visual
confirmation of whether or not the syntax has been checked. When a syntax check
does not locate any errors, VisualAge for Basic displays the Verified Syntax
icon
As you enter new code, or if there are syntax errors, the Verified Syntax icon
changes to the Unverified/Error icon.
VisualAge for Basic recognizes procedures that depend on others. If you modify
a procedure that references another, the Unverified/Error icon displays for the
current procedure and all of its dependant procedures.
笊絶武笊 11.2.4. What is a Run-Time Error? 笊絶武笊
Run-time errors occur after you check your syntax and begin executing your
application. Run-time errors are faults in logic (such as division by 0) or
user commands that VisualAge for Basic cannot execute.
When you test your VisualAge for Basic project, run-time errors cause the
testing to pause. A run-time error dialog appears on your screen and the
Run-time Error icon identifies the line of code containing the error.
When a run-time error is found, VisualAge for Basic suspends execution by
entering break mode until you correct the run-time error. You correct errors
and update the error list in the bookmark area in the same way you perform a
manual syntax check.
Chapter 16, Handling Errors for more information on run-time errors and how to
deal with them.
笊絶武笊 11.3. Testing the Application Behavior 笊絶武笊
After you have corrected all the syntax errors, test the appearance and
behavior of your application's user interface. Verify that the application
responds properly to mouse clicks and key presses and that the application
updates data entered in text fields appropriately. As you test your
application, you can pause execution, as well as specify statements you want to
execute or bypass. When you test your program's execution, the system is in run
mode.
笊絶武笊 11.3.1. Running Your Application 笊絶武笊
In previous chapters, you learned how to design your application. You test your
application before creating an executable file to ensure everything works the
way you expect. In run mode, your application functions exactly as it does when
you create an executable file. Run mode saves you time because it lets you test
your application and correct errors without having to create an executable file
each time.
Testing your code requires attention to detail; you must ensure that each
command executes correctly. Some commands execute too quickly for you to notice
them when the application is running at normal speed. In order to suspend the
execution of your project, you can insert special markers, watchpoints, that
allow you to evaluate the execution of specific instructions or the value of
specified expressions.
You use breakpoints when you want the application to stop execution, allowing
for a more in- depth analysis of how a line of code executes. VisualAge for
Basic lets you choose whether you use stop statements, or to suspend testing
without modifying your project's source code (using breakpoints).
Important: If you use stop statements to suspend testing of your application,
use bookmarks to locate and remove the statements before creating an
executable. Removing these stop statements prevents your application from
stopping when the user least expects it.
See also: VisualAge for Basic Language Reference Online Help, Stop Statement
and Chapter 6, Using the Code Editor, for more information on using bookmarks.
笊絶武笊 11.3.1.1. Starting Execution 笊絶武笊
You start your application, switching from design mode to run mode, in one of
the following ways:
Choose Run=>Start/Continue from the menu bar.
Click the Start/Continue button on the tool bar.
On Windows NT and Windows 95: Press the keyboard shortcut: F5.
On OS/2: Press the keyboard shortcut: F7.
VisualAge for Basic checks for syntax errors, then begins execution of your
application if there are no errors. You work with your application as would an
end-user, making sure that your VisualAge for Basic application responds to
input as expected.
笊絶武笊 11.3.2. Detecting Problems 笊絶武笊
As you detect problems in the response or the behavior of your application, you
can pause execution and put the system in break mode. VisualAge for Basic goes
into break mode automatically when it detects run-time errors. In break mode,
you can modify your application code, evaluate watch expressions, and perform
other debugging operations.
笊絶武笊 11.3.3. Breaking Execution 笊絶武笊
You can force your application to pause execution and enter break mode by
placing breakpoints within your code. You can also include Stop statements,
press the Ctrl+Break key, choose Run=>Break, or you can click on the Break
button to put your application in break mode. With the program in break mode,
you can inspect the current state of the program.
When the interpreter encounters a run-time error, a breakpoint, or a Stop
statement in your application, execution is suspended. You can break execution
manually in one of the following ways:
Choose the Run=>Break menu command.
Click the Break button.
Using a Stop statement is an alternative to setting a breakpoint; however, it
is only recommended for use in debugging. Unlike breakpoints, Stop statements
remain in your programs unless you remove them manually. Remove all Stop
statements prior to generating the final version of your application.
笊絶武笊 11.4. Using Breakpoints 笊絶武笊
Breakpoints are markers you assign to a line of code to pause execution of your
application for an analysis of code handling. Your application pauses after
executing the line of code that precedes the line containing the breakpoint.
When execution pauses, the Code Editor displays and identifies the line of code
with a pointing hand.
When your project reaches a line containing a breakpoint, it stops and enters
break mode. You can set and inspect actions that respond to a breakpoint in the
Immediate window of the Inspector. You can then step through the line of code
to observe the results more closely, verify the value of watches you have set,
or change the values of variables using the Quick Watch window.
When your application pauses, you can verify the state of your code and test
the value of expressions within your code. You can then step through the code
line by line, or you can resume execution by clicking on the Start/Continue
button. The application resumes normal execution until it encounters the next
breakpoint.
Important: Breakpoints and watch expressions set in your code are not saved
with your project. They also are not included in the generated applications.
笊絶武笊 11.4.1. Adding Breakpoints 笊絶武笊
Breakpoints can be set either in design or break mode. In design mode, you can
set breakpoints on any line of your code module. If you set a breakpoint that
cannot pause execution, VisualAge for Basic informs you before executing your
application in test mode. When you set breakpoints in break mode, only lines
that contain executable code accept a new breakpoint.
Important: VisualAge for Basic disables any breakpoints set on lines that do
not contain executable code, such as comment lines, variable declarations, and
blank lines.
To add a breakpoint to your project code and display the Breakpoints window:
1. Select the code module and procedure.
2. Place the cursor at the line of code.
3. Choose Debug=> Add Breakpoints from the menu bar.
The next line of code displays the breakpoint and the Breakpoints window
displays, highlighting the newly set breakpoint.
To add a breakpoint to your project code without displaying the Breakpoints
window:
1. Select the code module and procedure.
2. Place the cursor at the line of code.
3. Choose Debug=> Toggle Breakpoint or click on the Toggle Breakpoint
button on the toolbar. The code displays a new breakpoint without
opening the Breakpoints window.
Tip: You can also toggle a breakpoint on or off in the Code Editor by
double-clicking in the margin of the line of code.
笊絶武笊 11.4.2. Viewing Breakpoints 笊絶武笊
You use the Breakpoints window to locate and monitor the breakpoints you set
within your project code. The Breakpoints Window lets you select, enable or
disable breakpoints, as well as delete one or all your breakpoints.
The Breakpoints window lists all breakpoints set in your project. You can
resize the window to display more breakpoints, or you can scroll through the
list using the scroll bars, the Page Up and Page Down keys, or the up and down
arrow keys.
The Location field displays the location of a breakpoint in the source code. A
breakpoint's location corresponds to the settings in the line (Ln), procedure,
and module where the breakpoint is set.
See also: Chapter 6, Using the Code Editor, for more information on the
Navigation area. You display the Breakpoints window in one of the following
ways:
Choose Debug=> Edit Breakpoints from the menu bar.
Click on the Edit Breakpoints button on the toolbar.
笊絶武笊 11.4.3. Enabling and Disabling Breakpoints 笊絶武笊
You can toggle a breakpoint on or off while maintaining the breakpoint's
location in your project code. When you disable a breakpoint, execution of your
program ignores the disabled breakpoint. When you disable a breakpoint, the
Enable/Disable breakpoint marker in the Breakpoints window toggles from red to
gray. The breakpoint marker remains as part of the code module in your source
code.
To toggle a breakpoint on or off:
1. Open the Breakpoints window.
2. Select the breakpoint you want to toggle on or off.
3. Click on the Enable/Disable breakpoint marker When the marker turns gray,
the breakpoint is disabled.
笊絶武笊 11.4.4. Deleting Breakpoints 笊絶武笊
You should delete breakpoints when you no longer need them-this prevents
unwanted breaks in testing execution during later stages of application
development. You can delete breakpoints one at a time or you can delete all the
breakpoints listed in the Breakpoints Window.
To delete a single breakpoint using the Code Editor:
1. Locate the breakpoint you want to delete.
2. Place the cursor on the line containing the breakpoint.
3. Choose Debug=> Toggle Breakpoint from the menu bar or click on the Toggle
Breakpoint button. The code area removes the breakpoint marker and the
Breakpoints Window removes the reference to the breakpoint.
To delete a single breakpoint using the Breakpoints Window:
1. Open the Breakpoints Window.
2. Select the breakpoint you want to delete.
3. Click on the Delete button. The breakpoint is removed from both the
Breakpoints window and the Code Editor. The list of breakpoints in the
Breakpoints window updates automatically.
To delete all breakpoints from your VisualAge for Basic project:
1. Open the Breakpoints Window.
2. Click on the Delete All button. This removes all breakpoints in your
project from both the Breakpoints window and the Code Editor. The
Breakpoints window remains open, without any breakpoints.
笊絶武笊 11.5. Editing in Break Mode 笊絶武笊
VisualAge for Basic lets you make changes to your project code when the
application is in break mode. The ability to edit in break mode lets you
correct errors or change your source code without restarting program execution.
Some edits made in break mode, such as changing variables, require that you
restart program execution. VisualAge for Basic displays a message informing you
to restart your application. When you restart, the source code initializes and
runs from the beginning. When you continue program execution, VisualAge for
Basic checks the syntax of the new text and reports any syntax errors to the
bookmark area.
Any changes you make to your source code in break mode can be undone when you
end program execution. The undo buffer retains a list of the operations you
perform in break mode and lets you undo them when your application returns to
design mode.
Important: When you edit your source code in break mode, VisualAge for Basic
clears previous operations from the undo buffer (made in design mode). The undo
buffer only retains operations you perform in the current program mode (design
or run).
笊絶武笊 11.5.1. Resuming Program Execution 笊絶武笊
You can resume execution of your application from the break position (without
re-executing the code at the beginning of the module) by choosing
Run=>Start/Continue from the menu bar or by clicking on the Start/Continue
button. If you want to resume program execution from the first line of code,
choose Run=>Restart to reinitialize your application.
笊絶武笊 11.5.2. Ending Program Execution 笊絶武笊
You end program execution by choosing Run=>End, or by clicking on the End
button. When you end execution, VisualAge for Basic returns to design mode,
enabling design time menu items and tool bar icons.
笊絶武笊 11.6. Controlling Program Execution 笊絶武笊
You run your application to test it and to find problematic sections. When an
error stops the execution of your application, or you pause the program because
it does not respond as you expect, you can apply several techniques to resolve
problems in your code.
Although there is no precise sequence of steps in the debugging process, you
need to control the execution of your program. In doing so, you can test
individual lines of new or edited code, and walk through your code. Part of
walking through your code includes testing the integrity of each line of code.
笊絶武笊 11.6.1. Using Step and Step Over 笊絶武笊
While your program runs, you can watch errors as they occur. You can step
through (execute one line of source code at a time) or step over (skip the next
procedure) lines of source code.
The Code Editor's Run=>Step command executes a single line of source code and
updates the current execution line automatically.
The Run=>Step Over menu command steps over a procedure call. This means it
treats sub and function procedures as single executable statements, while it
executes one statement at a time and then pauses. You run the next statement
exclusively by choosing the Step Over menu command.
To step through code line by line:
1. In the Code Editor, select the line of code to begin execution.
2. Choose Run=>Step from the menu bar.
You can also click on the Step button.
The line of code executes and the pointing hand icon advances one line. If
the next line is a subroutine call, it also executes. The call stack in the
Inspector displays the current subroutine.
To resume normal execution, choose Run=>Start/Continue or click on the
Start/Continue button.
To step through code, treating subroutines as a single line:
1. In the Code Editor, select the line of code to begin execution.
2. Choose Run=>Step Over from the menu bar. You can also click on the Step
Over button.
The next line of code executes, and the current-line icon advances one
line. If the next line is a subroutine call, VisualAge for Basic treats
it as a single statement. The subroutine executes, but you do not step
through its code line by line. The call stack in the Inspector displays
the line of code after the subroutine call.
3. To resume normal execution, choose Run=>Start/Continue or click on the
Start/Continue button.
笊絶武笊 11.6.2. Setting the Next Statement 笊絶武笊
Sometimes when testing or debugging code, you might want to start your program,
then jump immediately to a specific section of code and execute it. In step
mode, you can bypass statements without executing them, by choosing Run=> Set
Next Statement command from the Code Editor's menu bar. This command lets you
control the execution order of the lines of code in the same procedure.
To bypass statements without executing them:
1. Choose Run=>Step from the menu bar. You can also click on the Step
button.
2. In the Code Editor, position the cursor in the line of code you want to
execute next. VisualAge for Basic always executes an entire line of code.
3. Choose Run=>Set next statement from the Code Editor. If the statement you
selected is in a different subroutine, the call stack (in the Inspector)
reflects the result.
4. Choose Run=>Start/Continue or click on the Start/Continue button on the
toolbar. The program continues, beginning with the line of code you
selected.
笊絶武笊 11.7. Using Watch Expressions 笊絶武笊
You use watch expressions to determine the value of selected expressions in
your source code. Watch expressions let you monitor how your VisualAge for
Basic application handles certain expressions as execution unfolds. You can
also evaluate how your application handles user input.
Watch expressions are evaluated only when your application is in break mode.
You can have expressions evaluated instantly or over a longer period of time.
The Quick Watch window is a fast way of viewing an expression's value. The
Inspector lets you track the changing values of several expressions over time.
Important: Watch expressions and breakpoints set in your code are not saved
with your project. They also are not included in the generated applications.
You use the Inspector window and the Quick Watch window to analyze errors and
their causes by evaluating how watch expressions are treated. The watch
expressions you set let you verify if the application is giving the expected
results. Use the Quick Watch window to quickly evaluate a single VisualAge for
Basic expression. You can monitor the changing values of several watch
expressions during program execution using the Inspector.
When your project enters break mode, VisualAge for Basic displays the value of
the watch expression in the Inspector window. Unlike breakpoints, watchpoints
are not associated with any particular line of code.
笊絶武笊 11.7.1. Evaluation Scope of Watch Expressions 笊絶武笊
Almost any VisualAge for Basic identifier (variables, functions, and
subroutines) can be used as a watch expression. VisualAge for Basic identifiers
can be defined on four levels:
Program-level, where you define the identifier globally for the entire
application.
Module-level, where you define the identifier for the entire code module.
Class-level, where you define the identifier for the class and its
procedures.
Procedure-level, where you define the identifier locally for the
procedure.
You can define a watch expression privately in the currently displayed
procedure (local) as well as publicly in the code module (global). If you
evaluate the expression in the procedure where it is defined, the Inspector
uses the local definition. If you evaluate the watch expression in a procedure
that does not contain the expression's definition, the Inspector then expands
its search, until it finds either a class-level, module-level, or global
definition.
The Inspector evaluates a watch expression within the current context of the
call stack. When the Inspector evaluates a watch expression, it first searches
for the expression locally (the procedure where the watch expression was
selected), then expands its search to the next-highest level, until it locates
the definition and evaluates the expression. The highest level the Inspector
can search for a definition is the program-level, where the expression is
defined globally.
Important: If you try to evaluate a watch expression that is not defined in
your application, VisualAge for Basic returns an error message that the
selected expression cannot be evaluated. The following illustration shows a
variable, V1, being defined both locally and globally. Three different
procedures evaluate the V1 variable, with each procedure resulting in a
different watch expression value.
In Procedure A, the Inspector returns the local value of V1 because it is
defined locally. In Procedure B, the V1 variable is used but not defined; the
Inspector uses the global definition to return the value for the V1 variable.
Using the V1 variable as a watch expression in Procedure C returns an error,
because the variable is not being used.
笊絶武笊 11.7.2. Inspecting Variables and Data Structures 笊絶武笊
You can set watch expressions within your code to display their values when the
application enters break mode. You set and monitor watch expressions using the
Quick Watch or Inspector windows.
You can also evaluate VisualAge for Basic expressions in the Immediate window
of the Inspector. The Immediate window gives you direct access to the
interpreter. When your application is in break mode, you use the Immediate
window to prompt the interpreter about the status of a variable or any other
expression.
The interpreter cannot recognize bugs that are contained in error-free
instructions. You use the debugging tools to assess the values of variables
that are passed from one procedure or another. These tools let you control the
program, and set watch values. In this way you can isolate and resolve errors.
As your application's code modules grow and multiply, you might want to review
variable definitions to prevent using them improperly. VisualAge for Basic lets
you quickly go to a variable definition in order to view or change it.
To go to a variable definition:
1. In the Code Editor, highlight the name of a variable, constant, or the
name of a procedure.
2. Choose View=>Go to definition from the menu bar.
You can also click on the Go to definition button on the toolbar.
The Code Editor displays the procedure containing the first occurence of the
variable or constant.
Important: If your application is in break mode and you change the variable
definition, you must restart program execution.
笊絶武笊 11.7.3. The Quick Watch Window 笊絶武笊
You use the Quick Watch window when you want to evaluate the selected
expression immediately. It can only be opened if your project is in break mode.
The Quick Watch window lets you quickly determine the value of an expression
while in break mode and then return to testing your application. The following
illustrations show the Quick Watch window with collapsed and expanded
subfields:
The watch expression you select might have subfields that can be expanded or
collapsed. Watch expressions that can be expanded are indicated by a plus sign
(+) to the left of the watch expression. Expressions that can be collapsed are
indicated with a minus sign (-) to the left of the expression. Click on the
Expand/Collapse toggle button to expand or collapse the expression's subfields.
You can also double-click on the plus sign (+) to expand or the minus sign (-)
to collapse the subfield information.
To determine the value of a selected expression:
1. To enter break mode, either:
Set a breakpoint in your project, and choose Run=>Start/Continue to
start execution of your project, or
Select Run=>Step to enter step mode
2. Select the expression you want to evaluate.
3. Choose Debug=>Quick watch from the menu bar or click on the Quick watch
button on the toolbar.
The Quick Watch window is displayed, showing your watch expression and
its current value.
4. Click on the Close button to close the Quick Watch window and return to
your application in break mode.
笊絶武笊 11.7.4. The Inspector Window 笊絶武笊
You use the Inspector window to maintain a list of expressions in your code
that you want to evaluate during program execution. The Inspector window allows
you to select a specific procedure call on the current execution stack, view
the value of your watch expressions, delete selected watch expressions, and
enter VisualAge for Basic expressions to be evaluated. The following image
shows the Inspector window:
To set a watch expression and open the Inspector window:
1. Select an expression within your code module by clicking on it.
2. Choose Debug=> Add Watch from the menu bar or click on the Add Watch
button.
The Inspector window displays and adds the selected expression to the
Watch expression list.
To set a new watch expression from the Inspector window:
1. Scroll through the Watch expression list to display the empty row.
2. Click in the Watch column of the empty row.
3. Enter the watch expression you want to evaluate.
4. Press the Enter key.
The Inspector immediately evaluates the expression and displays the
result in the Value column.
To edit a watch expression:
1. Scroll through the Watch expression list to display the expression you
want to edit.
2. Double-click the watch expression to highlight it.
3. Edit the watch expression.
4. Press the Enter key. The Inspector immediately evaluates the expression
and displays the result in the Value column.
To remove a watch expression from the Watch expression list:
1. Select the watch expression you want to remove in the Watch expression
list.
2. Click on the Delete button. The selected watch expression is removed from
the Inspector window.
Important: You can only delete watch expressions one at a time.
笊絶武笊 11.7.4.1. The Call Stack 笊絶武笊
The Call Stack provides a selection list of the calls contained in the current
execution stack. The displayed call provides the scope for both the watchpoints
you inspect and the expressions you enter in the Immediate Window. The active
thread is included in the Call Stack list when it is in break mode.
To select a call contained in the navigation area:
1. Click on the arrow at the end of the Call Stack field. The Call Stack
drop-down list opens, displaying the most recent calls.
2. Click on the desired call in the list. The Call Stack drop-down list
closes and the selected call displays in the Call Stack field.
笊絶武笊 11.7.4.2. Watch Expression and Value Lists 笊絶武笊
The Watch expression and Value lists let you evaluate the watchpoints you have
set. The Watch expression list provides an area for you to list the simple
watchpoint expressions you want to inspect. You can also enter new expressions
directly in the field by double-clicking in the field to highlight the current
text. The Value list shows the current value of the selected watch expression.
笊絶武笊 11.7.4.3. Split Pane Sash 笊絶武笊
You use the Split Pane Sash to resize the two main areas of the Inspector
window. Drag the sash to display more or less of the Watch expression and Value
list, and the Immediate Window. When you drag the sash, you might have to
scroll through the lists to see information hidden by the resizing operation.
笊絶武笊 11.7.4.4. Immediate Window 笊絶武笊
The Immediate window lets you enter VisualAge for Basic expressions for the
execution state on the current call of the call stack. When you type the
expression and press the Enter key, VisualAge for Basic evaluates the
expression immediately.
You can use the Immediate window in one of the following ways:
Type ? before an expression that you want evaluated. The result displays
on the next line after you press the Enter key.
Assign the Debug.Print object in your project's source code to a
specified string. The string is displayed in the Immediate window as it
is executed.
Important: The Inspector must be open to view the results of the Debug.Print
object.
Tip: It is good programming practice to remove Debug.Print references from
your project's source code.
笊絶武笊 11.7.5. Tracing Procedure Calls 笊絶武笊
The Inspector's Call Stack browser is a selection list of the active procedure
calls in your program. Active procedure calls are the procedures that start but
are not complete. The Inspector helps you understand what causes errors in the
source code by identifying the current state of the stack. The stack is a
region of reserved memory that stores procedures, function call return
addresses, passed parameters, and, in some cases, local variables.
Many of the procedure calls in your program contain calls to other procedures.
When a procedure call invokes a subsequent procedure, the subprocedure is said
to be nested. Because you can view the procedure calls on the Call Stack
Browser, you can easily trace the flow from one procedure call to the next. You
use the Inspector to view nested procedures that either precede or follow a
selected procedure call in the Call Stack Browser.
You browse the call stack area by selecting the entry for the call you want to
view. The list of arguments and local variables update to correspond to the
selected procedure call.
When VisualAge for Basic executes the code in your procedures, the call stack
adds each procedure to a list-the list of active procedure calls. After the
execution completes, the list updates, removing the procedure from the stack.
笊絶武笊 12. Part 2 Writing Code 笊絶武笊
笊絶武笊 13. Chapter 8 Scripting Objects 笊絶武笊
This chapter describes how to add behavior to a visual interface. You do this
by "scripting" the behavior of objects using VisualAge for Basic statements.
This chapter is intended to introduce you to some of the fundamental concepts
you need to script objects.
VisualAge for Basic is a powerful language, but you can start simply, learning
only what you need to perform a given task. For example, if you need to change
the background color of Form1 in your application, you can add a simple
statement to your script:
Form1.backcolor = BLUE
You can also control objects that have been developed outside of VisualAge for
Basic, by using VisualAge for Basic statements. VisualAge for Basic supports
these types of external objects:
OLE
OCX
SOM
Opendoc
VisualAge for Basic statements are the script that provides direction and
intelligence to the objects in your application.
You add behavior to objects by defining event procedures-sets of statements
that are executed as soon as a certain event (such as a mouse click) occurs.
An event procedure is stored with the object for which the event is defined.
笊絶武笊 13.1. Driving an Object 笊絶武笊
Properties and methods simplify the control of software objects, because they
hide the complexity within the object itself. When you change a property or
invoke a method, you do not need to know how the object actually accomplishes
the operations you request. Using an object is like driving a car-although very
few people understand the details of how a car engine works, many people can
drive cars by learning a limited number of controls. Properties and methods,
then, are the steering wheel, gas pedal, and brake controls you use to "drive"
a software object. When you write a script that controls the behavior of an
object, you are simply giving the computer a list of tasks to perform, using
the names of properties and events to specify the different operations you
require from an object.
Objects combine data and functionality-they contain not only information, but
the skills (functionality) needed to manipulate that information. Although
objects can contain complex inner workings, they are simple to control through
properties and methods.
笊絶武笊 13.1.1. What is a Property? 笊絶武笊
A property is a value that specifies some aspect of the object, such as its
color or location on a screen. For example, you use the FontName property to
specify which font should be used for text in many of the components.
笊絶武笊 13.1.2. What is a Method? 笊絶武笊
A method performs an action within an object. For example, some objects have a
print method-you invoke this method in order to print the contents of the
object on your computer's printer.
笊絶武笊 13.1.3. Accessing Properties 笊絶武笊
You access properties and methods within a VisualAge for Basic script by using
object-oriented syntax. Object-oriented syntax uses the dot operator to
separate object names from property and method names within a source code
reference. For example, to determine the current background color of a text box
called Text1, you refer to the object in the following way:
ColorVariable = Text1.BackColor
To set the BackColor property of a text box called Text1, enter the statement:
Text1.BackColor = BLUE
Tip: BLUE refers to a value that has already been defined as a constant.
Constants are discussed in greater detail in Chapter X, Working with Variables
and Constants. To make Form1 appear, you call its Show method:
Form1.Show
See also: The VisualAge for Basic Language Reference Online Help Controlling
Other Objects
To refer to objects located in forms other the current form, use the ! (bang)
operator to prefix the name of the object with the name of its form:
Form2!Text1.BackColor = BLUE
In addition to the ! operator, VisualAge for Basic accepts the dot (.) operator
as a separator between form names, for compatibility with older source code.
You should use the ! operator exclusively for this operation. It reduces the
possibility of the object name conflicting with a form property of the same
name.
笊絶武笊 13.2. Using Variables 笊絶武笊
In VisualAge for Basic, you can use special memory areas called variables to
store words, numbers, and other kinds of information temporarily while a
program is running. If you write a script where a number of values depend on
user input or the result of calculations, you can use variables to store those
values temporarily. For example, if your script manipulates a sentence, a
slogan, and values for the length and width (total area) of a carpet, you could
declare the following variables within your script:
Private Sentence
Private Slogan
Public CarpetLength
Private CarpetWidth
Private CarpetArea
Private LoopCounter
The LoopCounter variable, as its name suggests, is a counter that keeps track
of how many times a loop has been executed. You often need variables for things
like decisions and loops.
See also: Chapter 9, Working with Data and Object Variables.
笊絶武笊 13.3. Expressions and Operators 笊絶武笊
After you have stored values in variables, you can perform operations by
combining the names of variables using operators. This is analogous to creating
formulas in Algebra. It also looks similar to simple Algebra.
笊絶武笊 13.3.1. Expressions 笊絶武笊
When you combine variables and keywords in a formula, you create an expression
that VisualAge for Basic must resolve:
CarpetArea = CarpetLength * CarpetWidth
笊絶武笊 13.3.2. Operators 笊絶武笊
The expression, CarpetArea = CarpetLength * CarpetWidth, uses the * operator.
VisualAge for Basic uses + for addition, - for subtraction, * for
multiplication, and / for division. The = sign that appears in expressions is
also an operator-it tells VisualAge for Basic to resolve the formula to the
right of the = sign and store the resulting value in the variable on the left
side of the = sign.
Some operators support non-arithmetic functions. For example, you use the &
symbol for string concatenation (connecting two strings):
Sentence = "Your carpet will have a total area of "
Print Sentence & Str(CarpetArea) & " square feet."
See also: For a complete list of the operators accepted by VisualAge for
Basic, refer to Appendix C of the VisualAge for Basic Language Reference Online
Help.
笊絶武笊 13.4. Making Decisions with the If...Then Statement 笊絶武笊
The whole point of creating a script is to delegate tasks to the computer.
However, sometimes a script should only be executed if certain criteria are
met. You can describe these criteria to VisualAge for Basic in terms of "If X
happens, then do Y." By creating decision constructs using the "If...Then"
statement, your script can make limited decisions.
This feature allows you specify several alternate courses of action, each
appropriate for a certain situation. The following statements test the value of
the CarpetLength variable. Different messages appear, depending on whether the
value is longer or shorter than 12 feet:
If CarpetLength >= 12 Then
Print "We will have to place a special order."
Else
Print "We have that item in stock."
End If
笊絶武笊 13.5. Performing Repetitive Tasks 笊絶武笊
Computers are very good at performing repetitive tasks. You can organize your
statements within special structures called looping constructs. Looping
constructs repeat a set of statements a predetermined number of times, or until
reaching an Exit loop statement.
笊絶武笊 13.5.1. For...Next Loops 笊絶武笊
You can tell your VisualAge for Basic script to execute the commands between
the For and Next lines a certain number of times. In the example shown below,
the statements execute 12 times, and the value stored in the variable
CarpetLength:
CarpetLength = 12
For LoopCounter = 1 to CarpetLength
Printer.Print "This coupon good for $1 rebate on a carpet."
Printer.NewPage
Next LoopCounter
笊絶武笊 13.5.2. Do While 笊絶武笊
The statements above use a For...Next loop structure. However, the following
code gives the same results:
LoopCounter = 0
CarpetLength = 12
Do While LoopCounter < CarpetLength
LoopCounter = LoopCounter + 1
Printer.Print "This coupon good for $1 rebate on a carpet."
Printer.NewPage
Loop
笊絶武笊 13.5.3. Exit Do 笊絶武笊
Here's another way to achieve the same results as the previous examples:
LoopCounter = 0
CarpetLength = 12
Do While True
If LoopCounter > (CarpetLength) Then
Exit Do
End If
Printer.Print "This coupon good for $1 rebate on a carpet."
Printer.NewPage
LoopCounter = LoopCounter + 1
Loop
The Exit statement provides a way of exiting the Do...Loop construct.
Otherwise, the loop would never end.
笊絶武笊 13.5.4. Combining Loops and Decisions 笊絶武笊
Notice also that the If...Then structure is nested within the Do While...Loop
structure. In VisualAge for Basic, you can nest decisions and loops within each
other as necessary to make decisions and perform repetitive tasks.
笊絶武笊 13.6. Organizing Source Code 笊絶武笊
Event procedures are not the only way to organize VisualAge for Basic
statements. Some procedures are not associated with events. Event procedures
are actually a form of sub procedures, but VisualAge for Basic also provides
non-event sub procedures, function procedures, and classes. You create
procedures to automate certain tasks -- such as the processing of a payroll, or
a series of file operations.
笊絶武笊 13.6.1. Forms and Modules 笊絶武笊
Forms are the graphical background on which you can place components and other
objects. They can act as containers for visual interfaces as well as the
scripts that brings those interfaces to life. Modules are special files that
store procedures and functions not associated with a specific form-they are
available to all the forms within your application. Modules also store other
information, such as constant declarations.
See also: Chapter 9, Working with Data and Object Variables.
笊絶武笊 13.6.2. Sub Procedures 笊絶武笊
Event procedures are actually a form of sub procedures. Sub procedures are
scripts that contain statements to be executed. You can run one script from
within another script-just call it by name within the body of your script. Sub
procedures are usually, but not always, associated with object events.
笊絶武笊 13.6.3. Function Procedures 笊絶武笊
Function procedures are special scripts that usually perform calculations or
conversions. Function procedures are different from sub procedures in two ways:
They cannot be associated with events.
They return a result.
A function accepts arguments and returns a value. The order of parameters and
type of return value depend on the individual function. VisualAge for Basic
contains built-in functions, but you can create your own functions as well.
Function procedures are sometimes convenient because they allow you to execute
a script by simply referring to the name of that script as a variable within
an expression. For example, if you create a function procedure that converts
pounds to dollars, you can use that function within other scripts in the
following way:
ConvertedValue = Pounds2Dollars(InputAmount)
笊絶武笊 13.6.4. Classes 笊絶武笊
Although you can create simple scripts using sub and event procedures, when
your application becomes large and complex you should create classes to improve
productivity. When you create classes, you are essentially creating objects of
your own-complete with properties and methods you can control in the same way
you control the other objects available in VisualAge ts for Basic, such as
built-in components.
See also: Chapter 12, Object-Oriented Programming.
笊絶武笊 13.7. Reacting to Events 笊絶武笊
The simplest container for VisualAge for Basic statements is called an event
procedure. An event procedure is a set of statements that are executed whenever
a predefined event occurs. The most common kind of event is the click event:
when the person using your program clicks their mouse over a specific
component. By creating an event procedure associated with the click event, you
are telling VisualAge for Basic how to react in a given situation. Most objects
have events with which you can associate event procedures.
You can define different event procedures for every component in your
interface. This kind of programming, where you tell the computer how to react
to events, is called event-driven programming. Event-driven programming is
better than simply giving the computer a list of statements, since it places
the user of your program in control of what's happening.
笊絶武笊 13.7.1. Naming an Event Procedure 笊絶武笊
VisualAge for Basic knows you have created an event procedure when you combine
the name of the object with the name of the event. To create an event procedure
executes when the user clicks on a component, declare the script using a name
and following this format:
Sub ComponentName_Click ()
笊絶武笊 13.7.2. Sharing an Event Procedure within a Component Array 笊絶武笊
All elements of a component array share the same event procedures. The index
number of the component array element that calls the procedure automatically
passes as an argument to that procedure. Ensure that the index number is
captured by the procedure as an argument:.
Sub ComponentName_Click (Index as Integer)
笊絶武笊 13.8. Communicating with Other Objects and Applications 笊絶武笊
In VisualAge for Basic, everything is an object, and everything can be
controlled using the same tools, no matter where it comes from. VisualAge for
Basic allows you to use built-in components, SOM objects, and OCX controls, and
script their behavior using the same commands.
On the Microsoft Windows NT and Windows 95 platforms, you can use VisualAge for
Basic statements to control the behavior of other applications via OLE (Object
Linking and Embedding). You can use OCX controls in any VisualAge for Basic
application running on a Windows NT or Windows 95 machine, and SOM objects on
any platform supported by VisualAge for Basic.
笊絶武笊 14. Chapter 9 Working with Data and Object Variables 笊絶武笊
VisualAge for Basic lets you store various kinds of information in the
computer's memory while your application is running. These range from a simple
piece of information like a number or a name, to a complex piece of
information, such as an instance of a component. Pieces of information stored
in the computer's memory are called variables; simple pieces are called data
variables. You can use the names of variables in order to store, retrieve, or
modify the values stored in variables. When an instance of a component is
stored in memory, an object variable is created to manage that instance.
笊絶武笊 14.1. Understanding Variables 笊絶武笊
VisualAge for Basic uses variables to store information, as well as to manage
references to the class instances that are active in your application. It
handles data variables and object variables in much the same way, except that
you use data variables to store information, while you use object variables to
manage information.
笊絶武笊 14.1.1. Data Variables 笊絶武笊
VisualAge for Basic uses variables to store numeric, string, and date
information while a program is running. VisualAge for Basic provides several
variable types such as numeric, string and date, each with special
characteristics that help you process information within your applications. A
generic variable type, called Variant, provides a flexible way to store and
manipulate data, allowing you to combine different kinds of data within the
same operation. Specialized variable types provide more rigorous data typing
than Variant. Arrays and user-defined types serve as compound data references.
Several pieces of related data can be combined under a single variable name.
笊絶武笊 14.1.2. Object Variables 笊絶武笊
VisualAge for Basic treats forms and components as objects. Each time you
create an object, VisualAge for Basic implicitly declares an object variable
corresponding to the component's Name property. When you refer to objects such
as Form1 within your procedure, you are referring to object variables, not to
the original object, a form.
Using object variables, you can create additional instances of existing forms
within your application. Object variables simplify your task as a programmer,
providing a simple way to manipulate instances using VisualAge for Basic
statements.
More than one object variable can point to the same object. You can create
generic object variables to control form modules within generic procedures. You
can use specific object variables to control form modules or components. Each
object variable is also an object variable type.
You can create multiple instances, or objects, of the form class within your
application. An instance begins with the exact structure and configuration of
the original object or instance. The instance then evolves separately.
To create a new form instance based on the structure of an existing form, refer
to the name of the existing form as an object variable type. Use the New
keyword to specify that you are creating a new instance of the form.
You can use the New keyword with a generic object variable to create an object
based on any component type found in the VisualAge for Basic Toolbox. However,
you cannot create new instances of existing components.
笊絶武笊 14.2. Naming Variables 笊絶武笊
When assigning names to variables in VisualAge for Basic, observe these
guidelines:
Names must begin with a letter.
Names can only include alphanumeric characters and the underscore (_)
character.
Names cannot match reserved words in the VisualAge for Basic language
See also: For a list of reserved words, see the VisualAge for Basic Language
Reference Online Help.
笊絶武笊 14.3. Data Types 笊絶武笊
The data type of a variable determines its characteristics and how it behaves
in different operations.
See also: Appendix B, "Data Types" in the VisualAge for Basic Language
Reference Online Help for a detailed description of the data types available in
VisualAge for Basic.
笊絶武笊 14.4. Declaring Variables 笊絶武笊
You can declare variables explicitly, or have VisualAge for Basic create them
for you automatically when you use a variable name within an expression.
笊絶武笊 14.4.1. Declaring Variables Implicitly 笊絶武笊
You do not have to declare variables explicitly before you use them. When
VisualAge for Basic encounters an undeclared variable name in an expression, it
assumes that you are making an implicit declaration, and creates a variable of
that name of Variant type. For example, the following expression uses the
variable Apple even though it was not previously declared:.br
Private Orange
Orange = 2
Apple = Orange + 1
VisualAge for Basic treats an undeclared variable name within an expression as
an implicit declaration. In this example, VisualAge for Basic creates a
variable of type Variant called Apple and makes it local in scope.
笊絶武笊 14.4.2. Declaring Variables Explicitly 笊絶武笊
Explicit variables are declared using the Private, Dim, Global, and Public
statements. Explicit declarations allow you to specify the type of variables. A
variable declaration has the form:
Private VariableName [As VariableType]
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7ariableName 笏5he name of the variable. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7ariableType 笏5he type of the variable. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Unless otherwise instructed by a DefType statement, VisualAge for Basic assigns
the Variant type to variables declared without a specific type.
笊絶武笊 14.4.2.1. Using the Option Explicit Statement 笊絶武笊
If you want to declare all variables explicity, use the Option Explicit
statement. The Option Explicit statement disables implicit variable declaration
within a module. When this option is in effect, undeclared variables within
expressions are treated as errors. This eliminates mistyped variable names
being mistaken for a new implicit variable declaration. Each module must have
its own Option Explicit statement.
Forcing the explicit declaration of variables is good programming practice, and
reduces the likelihood of run time errors. Consider using the Option Explicit
statement in the final versions of your applications, especially if they are
intended for critical projects.
Tip: You can configure VisualAge for Basic so that Option Explicit is added to
each new form and code module automatically by setting the Project Window
Option=> Environment=> Require Variable Declaration option to Yes.
See also: VisualAge for Basic Language Reference Online Help, Option Explicit
statement.
笊絶武笊 14.4.3. Object Variables 笊絶武笊
The syntax for declaring an object variable is similar to that used to declare
other kinds of variables. This section discusses those aspects of object
variable creation and management that differ from other variable types within
VisualAge for Basic.
笊絶武笊 14.4.3.1. Using the New Keyword 笊絶武笊
Use the New keyword to create object variables that are self-instantiating. If
you refer to an object variable that you declared with the New keyword, it
creates a new instance of the object designated by the pointer (if one does not
exist already). A self-instantiating object variable ensures that an instance
of the object is always available.
笊絶武笊 14.4.3.2. Scope 笊絶武笊
The scope of an object variable is unrelated to the scope of the object to
which it is pointing. Because an object variable is a pointer, only the
pointer's scope is affected by the location of its declaration.
Object variables follow the same rules for scope as other VisualAge for Basic
variables .
笊絶武笊 14.4.3.3. Type 笊絶武笊
You can create specific or generic object variables in your application.
Generic variables can manipulate any form or component in your application.
Specific variables refer directly to individual forms and components.
Using Specific Form Types
VisualAge for Basic lets you create a new instance of a form based on an
existing form in your application. In terms of object-oriented programming,
this means that you can create an instance of an instance. A typical use for
this feature would be the reproduction of a complex form-you use the form as a
template to create other instances of that form.
Using Specific Component Types
You are restricted to using the default component types as models in the
creation of new components. This means that you cannot configure one instance
of the component with specific property settings, and then use that instance as
a model to create other instances of the component at run time. However, you
can create objects at run time by specifying one of the following keywords for
specific component object types:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏heckBox 笏abel 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏omboBox 笏ine 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommandButton 笏istBox 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommonDialog 笏enu 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ata 笏0ptionButton 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏irListBox 笏0LE 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏riveListBox 笏1ictureBox 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ile List Box 笏4hape 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rid 笏5extBox 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rame 笏5imer 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ScrollBar 笏7ScrollBar 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏mage 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Comparison of Generic and Specific Object Types
When you pass an object to a procedure, use generic object types when your
procedures refer to more than one component. If you create a procedure to be
used with several forms in your application, you must use a generic object
type. For example, you may need to create a procedure that activates the Show
or Hide method on a series of forms within your application.
You should use specific object types instead of generic object types wherever
possible. Generic object types are significantly slower than specific object
types at run time. The behavior of generic object types is harder to monitor
during the debugging process.
笊絶武笊 14.4.4. Creating Instances of Forms 笊絶武笊
VisualAge for Basic automatically creates an object type for each form object
within your application. You can use the Set statement to create new instances
or to create associations between generic objects and specific instances within
your application.
笊絶武笊 14.4.4.1. Creating an Instance 笊絶武笊
You can create an additional instance of a form by using the Set statement with
the New keyword:
Set MemberForm as New YearlyForm
笊絶武笊 14.4.4.2. Referring to an Instance 笊絶武笊
You can use object variables as pointers rather than instantiation agents.
Generic variables must be associated with a specific object instance within the
application prior to accessing the object. You can associate multiple object
variables as pointers to the same object instance within your application. You
refer to an existing instance with the following syntax:
Set GenericVariable = Panel!btnStop
This allows you to use generic procedural code with specific instances of
objects within your application. You probably will want to automate this type
of assignment, based on an argument that you pass either to the generic
procedure or through a global flag value.
笊絶武笊 14.4.4.3. Instance Lifetimes 笊絶武笊
Object instances follow the same rules for lifetime behavior as other variables
in VisualAge for Basic.
笊絶武笊 14.5. Setting the Scope of Variables 笊絶武笊
The scope of a variable determines which parts of the program can access its
contents. Although the examples shown here are for data variables, object
variables are subject to the same rules of scope.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏4cope 笏eclaration Method 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ocal 笏mplicit declarations, 笏 local variable is accessible笏
笏 笏Fxplicit declarations within 笏Pnly within the procedure in 笏
笏 笏Uhe body of procedures. 笏Xhich it is declared. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏odule-level 笏xplicit declaration placed in笏 module-level variable is 笏
笏 笏Uhe declarations section of a 笏Bccessible by any procedure 笏
笏 笏Nodule. 笏Xithin the module in which it 笏
笏 笏 笏Js declared. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1ublic 笏xplicit declaration prefixed 笏 public variable is 笏
笏 笏Xith Public keyword, placed in笏Bccessible by any procedure 笏
笏 笏Uhe declarations section of a 笏Xithin the application. 笏
笏 笏Nodule. 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 14.5.1. Making Variables Local 笊絶武笊
You make variables local by using implicit declaration, or by placing their
explicit declarations within the body of a procedure or function. The following
procedure stores information in an implicitly declared variable:.
Function Rollit ()
Randomize
DiceRoll = Int(Abs(Rnd * 6) + 1)
Rollit = DiceRoll
End Function
The example declares DiceRoll implicitly as soon as it is used in an
expression. As the result of an implicit declaration, it is automatically local
in scope.
You can also make an explicit declaration local in scope, by placing it within
the body of a sub or function procedure; for example:
Function Rollit ()
Private DiceRoll
Randomize
DiceRoll = Int(Abs(Rnd * 6) + 1)
Rollit = DiceRoll
End Function
Assigning local scope to a variable prevents other sub or function procedures
from modifying its value. Local variables of the same name can exist in several
sub or function procedures within an application. Each variable holds a
different value without causing a conflict.
笊絶武笊 14.5.2. Making Variables Static 笊絶武笊
The end of a sub or function procedure frees the memory of its local variables
for use by other parts of the program. This can pose a problem if the variables
should retain their values for the next execution of the procedure. To create
local variables that retain their values, even when the procedure ends, use the
Static keyword:
Sub CreditCheck ()
Static CreditCheckDone
If Not CreditCheckDone Then
MsgBox "Credit check not yet performed."
CreditCheckDone = True
End If
End Sub
To make all local variables in the procedure static, precede the declaration of
a sub or function procedure with the Static keyword:
Static Sub PageCounter ()
...
End Sub
笊絶武笊 14.5.3. Making a Variable Available within a Module 笊絶武笊
If different sub and function procedures need to share information in a module,
declare a module- level variable. You declare a module-level variable by
placing its declaration in the Declarations section of the module. You can only
access module-level variables using procedures residing in the same module.
Module-level variables can be read and modified by any procedure within the
module, and retain their values as long as the application is running.
笊絶武笊 14.5.4. Making Variables Public 笊絶武笊
A public variable is accessed by any procedure in any module. Declare a public
variable by placing its declaration in the declarations section of the module
using the Public keyword:
Public NumberReportsGenerated
Like module-level variables, public variables retain their values as long as
the application is running.
笊絶武笊 14.6. Working with Variants 笊絶武笊
The Variant is a flexible variable that holds numbers, words, dates, and other
kinds of information. VisualAge for Basic lets you mix Variants containing
different kinds of data in expressions, converting the data's format where
necessary.
笊絶武笊 14.6.1. Using the Variant Type 笊絶武笊
The Variant type is the default data type in VisualAge for Basic. When a
variable is declared implicitly, or when a variable is declared explicitly but
without a type, VisualAge for Basic assigns it the Variant data type. The
Variant data type can also be specified as part of an explicit variable
declaration.
Variants can be used in expressions with other Variants, as well as with
variables of various fundamental types. VisualAge for Basic converts the data
in Variants as necessary to perform operations between mixed data types.
Variants maintain an internal representation of the type of data they hold. For
example, storing a string in a Variant causes its internal representation to be
of String type. Conversely, if a Variant contains a number, its internal
representation may be of Integer or Double type, depending on the precision
required to store the value. VisualAge for Basic uses these internal
representations to convert Variant data into common data types. For example,
when Variants of type Date and String are combined, VisualAge for Basic changes
one of the data types to the lowest common denominator in order to complete the
function.
笊絶武笊 14.6.1.1. String Operations 笊絶武笊
You use variants containing string data in string operations just like real
string variables. When string operations are performed with Variants containing
non-string data, the conversion behavior depends on the combination of the data
types. In general, a Variant treated as a string behaves as a string,
regardless of the internal representation of its data. The following example
combines a Variant containing string data with a Variant containing numeric
data:
NameString = "Jane Doe"
EmployeeNumber = 2756
Print ("Employee Data: " &Name &" " &EmployeeNumber)
笊絶武笊 14.6.1.2. Numeric Operations 笊絶武笊
You use variants containing numeric or currency data with any function designed
to manipulate numeric data. However, if a numeric operation is attempted on a
Variant containing non-numeric data, the program ends with a Type Mismatch
error.
Use the IsNumeric() function to test the contents of a Variant before
attempting a numeric operation:
If IsNumeric(InputData) Then
PercentageData = InputData * 100
PercentageString = Str(PercentageData) &"%"
Else
PercentageString = "Error: Non-numeric data!"
End If
VisualAge for Basic's data conversion functions convert the internal
representation of Variants between different formats. However, if VisualAge for
Basic can not convert the Variant's contents to the required type
automatically, you probably will not obtain meaningful data from conversion
functions.
The internal representation of numeric data in a Variant is assigned
dynamically, using the type that is most efficient for the current value.
Depending on its current contents, a Variant might have an internal
representation of Integer, Single, Double, or some other numeric type.
Tip: You can not force a Variant to hold data in a fixed internal
representation (data type). If this degree of data typing is required, use
explicitly declared variables with a data type.
笊絶武笊 14.6.1.3. Date Operations 笊絶武笊
The flexibility of Variants is ideally suited to operations involving date and
time values . Use system functions to store date and time values within a
Variant. For example, this code stores the current date and time in a Variant:
TheTime = Now
Use the IsDate() function to determine whether a Variant's contents represent
date information.
Assign date values by enclosing the information between # signs. For example:
BirthDate = #March 26, 1966 2:30am#
Use the CVDate() function to convert a string representation of a date to its
date value:
DateString = "June 24, 1969"
DateVariable = CVDate(DateString)
See also: Variants containing date and time information are compatible with
any of VisualAge from for Basic's date and time functions. Consult the
VisualAge for Basic Language Reference eric dataOnline Help for more
information about these functions.
笊絶武笊 14.6.1.4. The Empty Value 笊絶武笊
The Empty value indicates that a Variant has been declared but never used. Test
for this condition by using the IsEmpty() function, which can be useful in
debugging operations. If needed, assign the Empty value to a Variant and copy
the contents of another Variant containing the Empty value.
笊絶武笊 14.6.1.5. The Null Value 笊絶武笊
The Null value has a special meaning in database operations. Null values
propagate- meaning the appearance of a single Null within an expression causes
the entire expression to evaluate to Null. In addition, most VisualAge for
Basic functions return Null if Null was passed as one of the parameters in the
function call. Test for the Null value by using the IsNull() function. Assign
Null to a Variant by using the Null keyword:
ThisVariable = Null
笊絶武笊 14.7. Using Symbolic Constants 笊絶武笊
You can use symbolic constants to represent values that do not change in
programs. Constants represent numbers, strings, and other kinds of data. The
syntax for declaring constants is similar to the syntax used to declare
variables. Unlike variables, however, constants cannot be modified after they
have been declared.
笊絶武笊 14.7.1. Creating Symbolic Constants 笊絶武笊
To declare a symbolic constant that is accessible within a module, place a
declaration in the declarations section of that module. Use the following
syntax to declare symbolic constants:
Const CONSTNAME = value
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ONSTNAME 笏ame of the constant. By convention, this is typed笏
笏 笏Jn uppercase. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Walue 笏n expression representing the value to be placed 笏
笏 笏Jn the constant. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
As with variables, the location of a constant's declaration determines its
scope:
To create a constant that is only accessible within a procedure, declare
the constant within the body of the procedure.
To create a constant that is accessible to all procedures within a
module, declare the constant in the declarations section of that module.
To create a constant that is publicly accessible within an application,
declare the constant with the Public keyword in the declarations section
of a module.
For example, to declare a public constant called EARTH_CIRCUMFERENCE,
place the following declaration in the Declarations section of a module:
Public Const EARTH_CIRCUMFERENCE = 24000
笊絶武笊 14.7.2. Using the constant.bas File 笊絶武笊
VisualAge for Basic includes a file, constant.bas that contains a large number
of public declarations. This file cannot be modified because it is read-only.
You can use this file in one of two ways:
Include the file as a module in your VisualAge for Basic project.
Copy and paste the public constants you need from the constant.bas file
to the Declarations section of a module in your application. Remove
constant.bas from your application.
笊絶武笊 14.8. Using Arrays of Variables 笊絶武笊
Arrays are data variables that follow standard VisualAge for Basic rules for
declaration and scope. Arrays allow you to store and reference a set of related
data elements under a single variable name. All of the elements in an array
must be of the same type. (This restriction can be overcome by using the
Variant type.) VisualAge for Basic lets you create single and multiple
dimension arrays, and specify their lower and upper boundaries.
Tip: Arrays of variables should not be confused with component arrays.
笊絶武笊 14.8.1. Creating Arrays 笊絶武笊
To create an array, declare the array variable by name, upper bound, and type.
For example, this code creates an array that holds names:
Dim NameList(39) As String
Since the lower bound (lowest possible data element) defaults to 0, the total
number of data elements in the NameList array is 40. You can specify the lower
bound as well as the upper bound (highest possible data element), using this
syntax:
Dim ArrayName(LowerBound To UpperBound)
You should define the bounds if you use the element number as an index in a
For...Next operation. For example, the following code creates the NameList
array with elements numbered from 1 to 40:
Dim NameList(1 To 40) As String
笊絶武笊 14.8.2. Accessing Array Elements 笊絶武笊
To access an array element, specify its element number using this syntax:
Variable = ArrayName(ElementNumber)
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7ariable 笏 variable that contains the value of the array 笏
笏 笏Flement. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rrayName 笏5he name of the array being accessed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lementNumber 笏5he number corresponding to the array element 笏
笏 笏Ceing accessed. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
To access the 13th entry in the NameList array (since the lower bound defaults
to 0) use this code:
Dim NameList(39) As String
IndividualName = NameList(12)
笊絶武笊 14.8.3. Creating Multidimensional Arrays 笊絶武笊
Create a multidimensional array by specifying multiple lower and upper bounds
as the array is declared:
Dim GridArray(0 to 9, 0 to 99) as Double
or
Dim GridArray(9, 99) as Double
The code creates a two-dimensional array, 10 elements long by 100 elements
wide. To access a data element from within a multidimensional array, provide a
coordinate corresponding to each dimension. For example, to access the contents
of the 20th cell in the 9th array line, enter this code:
ThisCell = GridArray(8,19)
笊絶武笊 14.8.4. Dynamic Arrays 笊絶武笊
To set or change the dimensions of an array at run time, declare the array as a
dynamic array. Declare an array as dynamic by omitting its dimensions at
declaration time. For example:
Dim FlexibleArray()
To set the dimensions of a dynamic array use the ReDim statement. This example
uses variables to set the lower and upper bounds of FlexibleArray at run time:
ReDim FlexibleArray(1 to NumberRows, 1 to NumberColumns)
笊絶武笊 14.8.5. Storing Objects in Arrays 笊絶武笊
You can store form and component variables within arrays. Arrays let you
automate certain tasks and streamline the procedures required for group
operations on similar forms or controls.
笊絶武笊 14.8.5.1. Creating Arrays of Forms 笊絶武笊
You can create an array containing specific or generic form variables. You
declare form variables in the same way you declare other variable arrays:
Generic
Dim FormGroup(20) as Form
Specific
Dim FormGroup(20) as frmPayroll
To make the array elements self-instantiating, use the New keyword.
Dim New FormGroup(20) as frmPayroll
笊絶武笊 14.8.5.2. Creating Arrays of Components 笊絶武笊
You can create an array of generic or specific component objects. The Control
keyword specifies a generic array. Create specific component objects by
referring to one of the specific component types available within VisualAge for
Basic.
Dim CmpGroup(15) as Control
Dim CmpGroup(15) as TextBox
You cannot make the elements of an array of components self-instantiating.
笊絶武笊 14.9. Creating User-Defined Types 笊絶武笊
A user-defined type describes the structure of a variable that holds several
related data elements within a single reference. After you define a
user-defined type, it is available for use as a template for the creation of
new variables with the same structure.
See also: Chapter 12, Object-Oriented Programming.
User-defined types let you group simple data variables, such as strings,
numbers, and dates, within a single reference. A variable of user-defined type
is analogous to a variable structured like a database record.
A user-defined type is not a variable-it is a custom template that dictates the
structure of new variables.
Important: The definitions of user-defined types are always public and must be
declared in the Declarations section of a code module.
To declare variables of a user-defined type, use the same syntax as the data
types they represent. The scope of user-defined variables is identical to the
base data type.
See also: Refer to VisualAge for Basic Language Reference Online Help,
Appendix B, Data Types for the range of each data type.
Type SalesRep
FamilyName As String
FirstName As String
EmployeeCode As String
Territory As String
CommissionRate As Single
TotalSales As Currency
End Type
Dim PharmRep As SalesRep
To access a data element in a variable of user-defined type use the convention
variable.element:
Print PharmRep.TotalSales
To copy the contents of a variable of user-defined type to another variable:
NewVariable = PharmRep
笊絶武笊 14.9.1. Comparing User-Defined Types to Arrays of Variants 笊絶武笊
Like user-defined types, arrays can store several related data elements.
Although elements within an array must all be of the same variable type, you
can effectively overcome this restriction by using the Variant type. An array
of Variants can provide the same functionality as a user-defined type.
Unlike arrays, user-defined types allow you to assign meaningful names to each
element. User-defined types also let you assign fundamental data types to the
individual data elements.
User-defined types generally result in source code that is easier to read and
debug.
笊絶武笊 14.9.2. Object Variables as User-Defined Types 笊絶武笊
Object variable types let you specify the structure of a new object based on
the structure of an existing object in your application. In effect, when you
create a form in your application, its structure is automatically accessible
within VisualAge for Basic as a user-defined type.
Using object variables, you can create additional instances of existing forms
within your application. Additional instances simplify your task as a
programmer, allowing you to create the necessary copies of common interface
forms.
笊絶武笊 14.10. Using and Testing Object Variables 笊絶武笊
VisualAge for Basic contains several keywords you can use to test object
variables for their contents. These keywords are typically used in If...Then
structures where you need to verify the contents or nature of an object
variable prior to performing one or more operations.
笊絶武笊 14.10.1. Is 笊絶武笊
The Is operator allows you to compare two object variable pointers to find out
if they refer to the same object within the application. Normally, object
variable assignment and instance creation are carefully controlled by your
procedural code. For example, you must determine the status of your pointer
associations and instances at run time when using components that perform drag
and drop operations. If both object variables refer to the same object
instance, a non-zero True is returned. For example:
LogicalVariable = ObjectVariable1 Is ObjectVariable2
or
If ObjectVariable1 is TextBox Then
[...]
笊絶武笊 14.10.2. Nothing 笊絶武笊
You can declare an object variable declared without the New keyword. If there
is no instance of the object, the variable might point to an object that does
not exist. You can test for this condition by using the Is operator to
determine if the object variable has the special Nothing value:
If ObjVariable3 Is Nothing
[statements]
End If
If you declare an object variable using the New keyword, you cannot test it for
the Nothing value. Accessing an auto-instantiating object variable causes
VisualAge for Basic to create a new instance of the object if one does not
already exist.
Tip: You can free memory resources by assigning the Nothing value to an object
variable.
笊絶武笊 14.10.3. Me 笊絶武笊
The Me keyword serves as an identifier that always refers to the current form.
If you are controlling batch operations on form variables within a procedure in
a form, you address certain instructions to the current form by using the Me
keyword. For example, an event procedure activated by a button on a form
instance. If the procedure needs to access that form's Hide method, it can
always refer to its own instance with the Me keyword:
Sub cmdHide_Click()
Hide Me
End Sub
笊絶武笊 14.11. Passing Objects to Procedures 笊絶武笊
You can pass specific or generic object variables as arguments to procedures.
Pass object variables as arguments to procedures in exactly the same way as
other variables.
Make sure the argument is properly matched to the type of the object variable's
contents. For example, if the argument is typed as generic form on the
procedure definition line, it can receive generic or specific form object
variables as arguments. However, if a specific Form type is declared, you must
pass an object of that type.
笊絶武笊 14.12. Using Permanent Objects 笊絶武笊
VisualAge for Basic includes read-only object names that allow you to control
key system resources within procedures.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0bject Name 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏pp 笏1rovides application-specific information. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lipboard 笏ccesses operating environment's clipboard. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ebug 笏irects output to the Debug window. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rinter 笏irects output to the default system printer. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4creen 笏1rovides diagnostic information about the current 笏
笏 笏Gorm and current component. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
You cannot modify these object names or declare variables referring to these
objects.
笊絶武笊 15. Chapter 10 Controlling Program Flow 笊絶武笊
Decision and loop structures control the execution sequence of blocks of
instructions. Decision structures such as If... and Select Case allow you to
specify the execution circumstances for specific statements. In addition to
decision structures, VisualAge for Basic contains looping structures that
repeat blocks of statements a specified number of times or to satisfy logical
conditions. Using decision and loop structures, you can create procedures to
execute instructions nonsequentially.
笊絶武笊 15.1. Making Decisions 笊絶武笊
Decision structures control whether or not certain instructions are executed,
based on specified logical tests. Use the If... and Select Case decision
structures to make decisions in VisualAge for Basic.
Decision structures rely on logical expressions. Logical expressions return the
value True or False. For example, if the following values are assigned:
Apples = 24
Oranges = 12
the logical expression;
Apples = Oranges
evaluates to False. If you use this logical expression with these values to
control a decision structure such as If..., the statements contained within the
structure are not executed. In a real application, these values are based on
user input, calculations, or data read from external files. Using decision
structures within an application allows a dynamic response to changing data.
笊絶武笊 15.1.1. If... 笊絶武笊
The If... structure is the simplest decision structure in VisualAge for Basic.
Use If... to execute code only when a condition is satisfied. The If...
structure syntax is as follows:
If Expression Then
[statements]
[ElseIf Expression2 Then
[statements]]
[ElseIf Expression3 Then
[statements]]
[...]
[Else
[statements]]
End If
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xpression 笏 logical expression that determines whether the 笏
笏 笏Ttatements are executed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xpression2 笏 logical expression that determines whether the 笏
笏 笏Ttatements in the ElseIf block are executed. This 笏
笏 笏Mogical expression is evaluated only if Expression笏
笏 笏Fvaluates to False. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lseIf 笏f Expression evaluates to False, Expression2 is 笏
笏 笏Fvaluated. If Expression2 evaluates to True, 笏
笏 笏Ttatements in this section are executed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lse 笏nstructions that follow this keyword are executed笏
笏 笏Jf Expression and (if applicable) Expression2 笏
笏 笏Fvaluate to False. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
In the following example, examine a routine client's account that generates
"past due" notices. Instructions within the If... structure execute only when
the expression evaluates to True:
If ((AmountOwing > 0) And ((Now - LastPaymentDate) > 30)) Then
Result = SendNotice(ClientNumber)
End If
笊絶武笊 15.1.1.1. Else (optional) 笊絶武笊
A set of instructions, identified with the Else keyword, executes if the
expression controlling the structure evaluates to False.
If ((AmountOwing > 0) And ((Now - LastPaymentDate) > 30)) Then
Result = SendNotice(ClientNumber)
Else
Result = SendThankYouNote(ClientNumber)
End If
笊絶武笊 15.1.1.2. ElseIf (optional) 笊絶武笊
The ElseIf keyword is similar to the Else keyword, except that it uses its own
logical expression to control the processing of statements. The statements in
the ElseIf section process only if the logical expression controlling the If...
structure is False, and the logical expression controlling the ElseIf section
is True.
If ((AmountOwing > 0) And ((Now - LastPaymentDate) > 30)) Then
Result = SendNotice(ClientNumber)
ElseIf ((AmountOwing <= 0) And ((Now - LastPaymentDate) > 30)) Then
Result = SendWeMissYouLetter(ClientNumber)
Else
Result = SendThankYouNote(ClientNumber)
End If
笊絶武笊 15.1.2. Select Case 笊絶武笊
The Select Case decision structure compares a Select expression against a list
of possible matching Case expressions. The Select Case structure evaluates the
Select expression and executes the block of statements associated with the
first matching Case expression in a list. If a Case expression matches a Select
expression, evaluation of the Case expressions stops. If none of the Case
expressions match the Select expression, the execution of statements contained
in the Case Else section occurs. If there is no match, and the Select Case
structure does not contain a Case Else section, there is no resulting action.
You can specify an unlimited number of Case expressions.
The value of the Select expression for a Select Case structure can be of any
VisualAge for Basic basic data type. You cannot use a user-defined type as a
Select expression in a Select Case structure.
The syntax for a Select Case structure is:
Select Case SelectExpression
[Case CaseExpression1
[statements]]
[Case CaseExpression2
[statements]]
[Case CaseExpression3
[statements]]
[...]
[Case Else
[statements]]
End Select
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4electExpression 笏5he expression compared against the Case 笏
笏 笏Fxpressions in the structure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏aseExpression 笏0ne or more expressions compared against 笏
笏 笏4electExpression. If the comparison between the 笏
笏 笏Fvaluated master expression and evaluated text 笏
笏 笏Fxpression returns True, execute the statements 笏
笏 笏Bssociated with the matching expression. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ase Else 笏xecute statements in this section if 笏
笏 笏4electExpression does not match any of the Case 笏
笏 笏Fxpressions in the Select Case structure. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 15.1.2.1. Using Select Case to Match Expressions 笊絶武笊
The Select Case structure is different from other decision structures in that
it is triggered by exact matches between the Select and Case expressions (which
can be of any type.) This is in contrast to If... structures.
Consider the following example:
Select Case VacationBudget
Case 500
Message = "You should look at our weekend getaway
packages!"
Case 1000
Message = "Have you thought about a cruise?"
Case 1500
Message = "You will love our Far Off Places package!"
Case 2000
Message = "Do you want something exotic or luxurious?"
End Select
In this example, the Select Case structure is successful only if the dollar
amount in the VacationBudget variable exactly matches one of the Case
expressions. Because the structure is only sensitive to exact matches, nothing
happens if a value entered by the user does not match a Case expression. To
perform a default action, use a Case Else section. However, this section is
inadequate for most situations, because it relies on exact matches.
笊絶武笊 15.1.2.2. Using Select Case to Match Logical Criteria 笊絶武笊
Using a Select expression of True and Case expressions that evaluate to True or
False allows you to perform branching based on logical criteria.
Select Case True
Case VacationBudget < 500
Message = "Sorry, we do not have any packages in that range."
Case VacationBudget < 1000
Message = "You should look at our weekend getaway packages!"
Case VacationBudget < 1500
Message = "Have you thought about a cruise?"
Case VacationBudget < 2000
Message = "You will love our Far Off Places package!"
Case VacationBudget >= 2000
Message = "Do you want something exotic or luxurious?"
End Select
笊絶武笊 15.2. Looping 笊絶武笊
Use loop structures to perform repetitive tasks. Loop structures execute
embedded instructions a specific number of times or while a condition is True.
You can exit a loop structure using an explicit control statement. The
following table describes the looping control mechanisms available in VisualAge
for Basic.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ontrol Mechanism 笏xamples 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ogical expression 笏o While True 笏ontinue executing 笏
笏 笏o While Variable1 <笏Jnstructions as long as 笏
笏 笏7ariable2 笏Fxpression remains True. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ogical expression 笏o Until 笏ontinue executing 笏
笏 笏o While Not 笏Jnstructions until condition 笏
笏 笏 笏Js satisfied. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏umerical limit 笏or Counter = 1 to 笏ontinue executing 笏
笏 笏10 笏Jnstructions until.brCounter 笏
笏 笏Y 笏>= Limit. 笏
笏 笏or Counter = 1 to 笏 笏
笏 笏imit 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xplicit control 笏xit Do 笏xit a loop structure and 笏
笏Ttatement 笏xit For 笏Dontinue execution at the next笏
笏 笏 笏Ttatement. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 15.2.1. Do...Loop 笊絶武笊
VisualAge for Basic contains several variations of the Do...Loop structure,
including Do Until and Loop While. There are two ways to use the Do...Loop
structure. The first checks a condition before performing any actions:
Do [{While | Until} Expression]
[statements]
[Exit Do]
[statements]
Loop
The second syntax checks the condition after performing any actions:
Do
[statements]
[Exit Do]
[statements]
Loop [{While | Until} Expression}
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xpression 笏valuates to True or False. The Not operator can 笏
笏 笏Ce used to reverse the logical value of Expression笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏8hile 笏2ualifies the Do or Loop keyword. This keyword 笏
笏 笏Jndicates that statements in the loop should be 笏
笏 笏Qrocessed as long as Expression evaluates to True.笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6ntil 笏2ualifies the Do or Loop keyword. Indicates that 笏
笏 笏Ttatements in the loop should be processed as long笏
笏 笏Bs Expression evaluates to False. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏xit Do 笏xits the Do...While structure and continues 笏
笏 笏Fxecution at the next statement. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
The following example shows how instructions contained in a Do...Loop statement
continuously execute as long as the Do While expression evaluates to True.
ArrayElement = 0
Do While ArrayElement > 10
EntryForm(ArrayElement).PrintForm
ArrayElement = ArrayElement + 1
Loop
笊絶武笊 15.2.2. For...Next 笊絶武笊
The For...Next loop structure executes a series of instructions a preset number
of times. The syntax for the For...Next structure is as follows:
For LoopCounter = Begin to End [Step Increment]
[statements]
[Exit For]
Next [LoopCounter[, LoopCounter2] [, LoopCounter3] [,...]]
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oopCounter 笏4erves as the counter for the For...Next structure. This 笏
笏 笏Walue can be used in instructions within the For...Next 笏
笏 笏Moop. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏egin 笏ndicates the starting value for LoopCounter. This is 笏
笏 笏Oormally 1. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nd 笏ndicates the ending value for LoopCounter. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ncrement 笏4pecifies the value that LoopCounter should increment each 笏
笏 笏Uime. If this value is not specified, the Increment defaults笏
笏 笏Uo 1. A negative Increment value decrements the For...Next 笏
笏 笏Moop. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
For...Next structures are useful when you need to repeat a series of
instructions a given number of times. The following example sends a
questionnaire letter to 10 customers on a merchant's client list:
For ArrayElement = 0 to 9
EntryForm(ArrayElement).PrintForm
Next ArrayElement
It is good programming practice to repeat the name of the counter variable
after the Next keyword. This is especially true in nested code, where several
Next statements may appear within a procedure.
笊絶武笊 15.2.3. While...Wend 笊絶武笊
The While...Wend structure is similar to the Do...Loop structure. This
structure is retained for compatibility with source code created for other
compilers. When you create a new application, use the Do...While structure
instead.
See also: The VisualAge for Basic Language Reference Online Help for more
information about the While...Wend decision structure.
笊絶武笊 15.3. Nesting Control Structures 笊絶武笊
To create nested control structures, place structures within each other. You
can nest any combination of VisualAge for Basic decision and loop structures.
For example, you can place an If... structure within a For...Next structure.
The following example has an array of forms called EntryForm.
For ArrayElement = 1 to 10
If EntryForm(ArrayElement).Visible Then
EntryForm(ArrayElement).PrintForm
End If
Next ArrayElement
Tip: Multiple indentation levels indicate multiple levels of nesting. To make
code easier to read and maintain, indent the instructions within decision and
loop structures to reflect their nesting. Indentation showing nesting levels
has no effect on program execution.
笊絶武笊 16. Chapter 11 Organizing Code 笊絶武笊
The VisualAge for Basic statements that provide behavior for your application
are referred to collectively as source code. This chapter describes the
different language structures and organizational techniques you can use to
organize your source code to perform operations within an easy-to-maintain
application.
At the highest level, you can organize your VisualAge for Basic source code by
placing it in one of these project objects:
Forms - A form is a visual object that contains a number of graphical
components that the user interacts with. The form and each of its
components can contain your source statements, and a project can have
multiple forms.
Modules - A module can contain declarations, functions, sub procedures,
and class definitions.
笊絶武笊 16.1. Planning Your Application 笊絶武笊
The following issues influence how easily you and other programmers can fully
understand, maintain, and debug your application. These issues may also affect
the ease with which users can control your application.
Whether to place the components of your user interface on a single form
or on multiple forms. For many applications, a single form is adequate.
If your application supports several distinct activities, you could
simplify life for your users by placing each activity on a different
form. To draw an analogy with VisualAge for Basic itself, the Code Editor
and the Menu Editor are activities that would be candidates for different
forms-they perform different functions and have different menus.
Whether to group a set of statements as a sub procedure, or as a function
procedure, as described later in this chapter.
Whether you should move a certain function or sub procedure from a
particular form to a code module, where it could also be used in another
form. Procedures in code modules can be called from source code anywhere
in the application.
Whether operations on certain data could be organized as a class. The
class lets you reuse the code in this class in another application.
笊絶武笊 16.2. Choosing a Code Structure 笊絶武笊
VisualAge for Basic offers the following basic structures to organize your
statements:
Sub procedures.
Function procedures.
Classes.
Classes are a means of grouping related procedures, called methods, and the
data that they work with. Because you can acess only part of the data and some
of the methods outside the class, code in classes is generally easier to debug
and maintain.
See also: Chapter 12, Object-Oriented Programming
笊絶武笊 16.3. Scope of Procedures 笊絶武笊
By default, procedures in a code module are public in scope. This means you can
access them from anywhere in the application.
Two procedures of the same name stored in code modules in the same application
cause a conflict that cannot be resolved. To prevent this, you can explicitly
specify that a procedure in a code module be private (exclusive to the code
module) in scope. You do this by adding a special qualifier to the variable
declaration, as in the following example:
Private Sub HandleError(Code As String)
[statements]
End Sub
Procedures declared within a form module can be accessed by any other procedure
within that form.
笊絶武笊 16.4. Creating a Sub Procedure 笊絶武笊
A sub procedure is a set of statements that execute when the procedure is
invoked. Statements within the procedure are executed one at a time. You can
specify operations in VisualAge for Basic so that they are either performed
unconditionally, or when certain conditions have been met. These conditions can
be based on any information you choose and, in particular, on user actions.
The syntax for declaring a sub procedure in VisualAge for Basic is:
[Static] [Private] Sub ProcedureName_Event ([Argument1]
[,Argument2, ...])
[statements]
End Sub
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tatic 笏akes local variables used within the procedure 笏
笏 笏Setain their values between procedure calls. By 笏
笏 笏Eefault, VIsualAge for Basic discards the values 笏
笏 笏Pf local variables as soon as a procedure 笏
笏 笏Uerminates. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rivate 笏imits access to this procedure to the current 笏
笏 笏Nodule. By default, a procedure placed within a 笏
笏 笏Dode module is available from anywhere in the 笏
笏 笏Bpplication, regardless of where the procedure is 笏
笏 笏Eefined. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rocedureName 笏dentifies the sub procedure. If this is an event 笏
笏 笏Qrocedure, make sure that ProcedureName refers to 笏
笏 笏Uhe object where the event is located. Refer to 笏
笏 笏Uhe default template generated by the Code Window 笏
笏 笏Gor guidance. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏vent 笏5riggers the procedure. This is the name of an 笏
笏 笏Fvent recognized by VisualAge for Basic, such as 笏
笏 笏lick. Refer to the default generated by the Code 笏
笏 笏ditor. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rgument 笏1erforms calculations or identifies the objects 笏
笏 笏Xhen used or manipulated by the procedure. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 16.4.1. Creating an Event Procedure 笊絶武笊
An event procedure is a normal sub procedure that responds to a user action or
other event. Each event procedure is linked to its event by a VisualAge for
Basic naming convention, which derives the name of the event procedure from the
name of the object and the name of the event. For example, the Command1_Click
event procedure is called when a user clicks on the Command1 component.
The general form of an event procedure is:
Sub ComponentName_Event ()
[statements]
End Sub
VisualAge for Basic creates stubs (skeletal procedures) for all defined events.
You can locate these stubs using the Code Editor. You add statements between
the Sub and the End Sub statements to provide the programming logic.
When a user clicks on a form, VisualAge for Basic calls the Form_Click event
procedure. The following procedure uses the Print method to print the contents
of the form, and then uses the Cls method to clear the contents of the form.
The form retains graphics and components placed at design time.
Sub Form_Click
Form1.PrintForm
Form1.Cls
End Sub
笊絶武笊 16.4.2. Creating a General Procedure 笊絶武笊
You can also create general procedures, which are not associated with a
specific object or event. To add a general procedure, open the Code Editor and
choose a form or code module. Within a form, place a general procedure in the
General Class/Object category in the Code Editor.
You can include calls to a general procedure from any script in the same form.
You cannot call a general procedure from another form. To use a general
procedure in more than one form, place it in a module.bas file. You can call
procedures in .bas modules from anywhere in the application.
笊絶武笊 16.5. Creating Function Procedures 笊絶武笊
A function procedure, like a sub procedure, consists of a set of statements,
but a function also returns a value. You call a function by placing its name
(and its arguments in parentheses) in an expression, wherever you would place a
variable. For example, since (x + y) is an expression in VisualAge for Basic,
so is (x + f(y)), where f is the name of a function.
For example, you can create the function km2miles that converts Kilometers to
Miles. The function km2miles accepts the number of Kilometers as an argument
and returns the equivalent number of Miles. The following example calls a
function within an expression:
miles = km2miles(km)
The syntax for declaring a function procedure is:
[Static] [Private] Function FunctionName ([Argument] [, ...]) [As
ReturnType]
[statements]
End Sub
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lement 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tatic 笏akes local variables used within the procedure 笏
笏 笏Setain their values between procedure calls. By 笏
笏 笏Eefault, discards the values of local variables as笏
笏 笏Toon as a procedure terminates. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1rivate 笏imits access to this procedure to the current 笏
笏 笏Nodule. By default, a procedure placed within a 笏
笏 笏Dode module is available from anywhere in the 笏
笏 笏Bpplication, regardless of where the procedure is 笏
笏 笏Eefined. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏unctionName 笏dentifies the function procedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rgument 笏5he name and type of each argument passed to this 笏
笏 笏Qrocedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3eturnType 笏4pecifies the variable type of the value that is 笏
笏 笏Seturned. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
The following function procedure uses VisualAge for Basic's date functions to
calculate the number of days that a person has been alive. The function accepts
the person's birth date as an argument and returns the difference between the
birth date and the current date.
Function DaysAlive (BirthDate) as Integer
If IsDate(BirthDate) Then
DaysAlive = Int(Now - CVDate(BirthDate))
Else
DaysAlive = Null
End If
End Function
You assign the return value of the function by referring to the name of the
function procedure. This return value passes to the expression that invoked the
function procedure. Because the function procedure returns a value, you can
refer to it in an expression as if it were a variable:
BirthDate = InputBox ("Please enter your birth date: ")
MsgBox "You are " &Str(DaysAlive(BirthDate)) &" days old."
笊絶武笊 16.6. Accepting and Returning Values 笊絶武笊
VisualAge for Basic procedures can accept and return values in a number of
ways. Unless specifically noted, the following information applies equally to
sub and function procedures.
笊絶武笊 16.6.1. Accepting Arguments by Reference 笊絶武笊
By default, values passed to sub and function procedures as arguments are
passed by reference. This means that if you pass a variable as an argument,
VisualAge for Basic passes a pointer to that variable, rather than creating a
copy of the variable for argument passing.
Note that if the called procedure modifies a variable passed as an argument,
the original variable in the calling procedure is modified. You can avoid this
by passing arguments by value.
笊絶武笊 16.6.2. Accepting Arguments by Value 笊絶武笊
Use the ByVal keyword to force VisualAge for Basic to create a local variable
of the same name as a passed argument. You can then modify the value of the
argument within the procedure as a local variable without disrupting the
contents of the variable used to provide the argument.
The ByVal keyword creates a local variable of the same name. You can manipulate
the argument's contents without affecting the original variable. For example:
Sub SomeProcedure (ByVal Answer As String)
Answer = Answer &" This Answer was provided as part of a survey."
[statements]
End Sub
笊絶武笊 16.6.3. Accepting Arrays as Arguments 笊絶武笊
You can pass an array as an argument to a procedure. When you pass an array,
omit the array's size information in the Sub or Function statement; for
example:
Sub SomeProcedure (SomeArray() as Integer)
Private N as Integer
For N = 0 to 9
Print SomeArray(N)
Next N
End Sub
This technique lets you pass arrays of various sizes, as long as the
programming logic of your application also supports it.
笊絶武笊 16.6.4. Accepting Objects as Arguments 笊絶武笊
You can pass a form or any of its components to a procedure as an argument.
When you declare the argument in the Sub statement, specify form_name As Form.
When you pass a component, specify the object's name, As, and the appropriate
keyword in the Sub statement. The keyword can be Object, Control, or the class
name of the particular component; for example, TextBox.
Sub HideIt (Ctrl As Control)
Ctrl.Visible = FALSE
End Sub
笊絶武笊 16.6.5. Returning a Value (Function Procedures Only) 笊絶武笊
One of the defining characteristics of a function procedure is its ability to
return a value. The return value allows you to call a function from within
expressions. Consider the following example:
Function Pounds2Dollars (Pounds) As Currency
ConversionFactor = 1.5
Pounds2Dollars = Pounds * ConversionFactor
End Function
By assigning a value to the name of the function procedure, you specify the
value to return when the function procedure is called. The return value allows
you to use the function directly within an expression:
Print "Cost of the trip in Dollars: " &Str(Pounds2Dollars(TripCost))
笊絶武笊 16.7. Setting the Scope of a Procedure 笊絶武笊
The scope of a procedure depends on where the procedure is declared and the use
of the Private keyword:
A procedure declared within a form module is accessible only within that
form.
A procedure declared in a code module is accessible from anywhere within
the application. You can override this behavior by prefixing the
procedure declaration with the Private keyword.
笊絶武笊 16.8. Retaining Values (Static) 笊絶武笊
By default, the values of local variables within a procedure (or function) are
discarded as soon as the procedure is exited. If you declare a variable as
Static within a procedure, the variable retains its value from the last time
the procedure was called. In this function, the value of CountVariable is
retained from one call to the next:
Function CountIt ()
Static CountVariable
If IsEmpty(CountVariable) Then
CountVariable = 0
End If
CountVariable = CountVariable + 1
CountIt = CountVariable
End Function
If you place the Static keyword before a sub or function procedure definition,
all local variables within the procedure retain their values between calls.
笊絶武笊 16.9. Why Classes are Better 笊絶武笊
Although creating an application based on classes rather than procedures
requires a bit more study and time at the beginning, the benefits to you and
your organization are real and measurable.
A primary advantage of classes is that the implementation of methods can change
without affecting the objects of other classes. Other classes find such changes
invisible as long as the public interface of the class remains the same
An application based on classes is easier to understand, easier to maintain,
and easier to expand. After you have created and debugged a class in one
application, you can use the class in new applications, typically without
further modification.
See also: Chapter 12, Object-Oriented Programming.
笊絶武笊 17. Chapter 12 Object-Oriented Programming 笊絶武笊
VisualAge for Basic is a powerful object-oriented development environment. You
can use VisualAge for Basic statements to declare new classes. You can also
declare specialized subclasses of existing classes- including the built-in
components contained in the Toolbox, or external classes imported via the
Component Catalog. *.
笊絶武笊 17.1. Classes and the VisualAge for Basic Model 笊絶武笊
You use VisualAge for Basic to create applications by combining software
objects. VisualAge for Basic creates objects according to the specifications
contained in classes. For example, forms, which hold visual interfaces, are
actually objects of the Form class. The components on the Toolbox are also
classes. When you select SOM or OLE classes using the Component Catalog, you
are actually making external classes available to VisualAge for Basic.
A class is a specification for the construction of a software object. Classes
combine related data variables and the procedures that manipulate them. You can
create multiple objects according to the specifications in a class definition.
When you drag multiple copies of a component to a form, you are actually
creating several objects of the same class. After you create an object, it can
operate in a manner independent from other objects based on the same class.
Although the objects all have the same structure, the specific information
stored in each object can be different.
A powerful characteristic of classes is their ability to be subclasses. A
subclass is a class which is based on another class. Subclasses inherit all of
the characteristics of the classes upon which they are based. When you create a
subclass, it is identical to the class that you based it upon. However, you can
customize the subclass, by overriding existing behavior, or by adding special
behavior.
In addition to the component classes listed on the Toolbox and the external
classes you can load using the Component Catalog, there is a third kind of
class: the classes you declare using VisualAge for Basic statements.
You can declare new classes using VisualAge for Basic statements, using a
syntax similar to sub or function procedure syntax. You use classes as a way to
organize related procedures and data variables, making your application easier
to understand. You can also create a specialized subclass of an existing class,
and add procedures specific to the needs of your department or organization.
VisualAge for Basic treats forms, components, and external classes in the same
way: they are all classes. The subclasses you declare using VisualAge for Basic
inherit all the functionality of the classes upon which they are based, and can
contain additional behavior.
笊絶武笊 17.1.1. The Elements of a Class 笊絶武笊
When you declare a class, you are writing a template, similar to a user-defined
type definition, that guides VisualAge for Basic in the creation of
objects-specifying their methods, member data, and properties. The following
class elements are described in detail in later sections of this chapter:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏lass Element 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ata Member 笏 variable that stores part of the current state 笏
笏 笏Pf an object. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ethod 笏 sub or function procedure that implements part 笏
笏 笏Pf the services or behavior of an object. Special 笏
笏 笏Nethods are used to implement other parts of the 笏
笏 笏Dlass. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏onstructor Method 笏 sub procedure called New() that initializes new 笏
笏 笏Pbjects. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏estructor Method 笏 sub procedure called Delete() that performs 笏
笏 笏Dleanup operations before an object of the class 笏
笏 笏Js destroyed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1roperty 笏n attribute of the object, such as color or 笏
笏 笏Ieight. Properties are part of the interface 笏
笏 笏Qrocedures use to communicate with an object. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Restriction: Events can be inherited by subclasses. However, you cannot define
an event using VisualAge for Basic syntax.
笊絶武笊 17.1.2. Classes You Can Create 笊絶武笊
In the VisualAge for Basic language, you can create classes of these general
types:
Non-visual classes. You can add these classes to a graphical user
interface, but they are not visible to the user during run time. You can
write an original non-visual class or write a class as a subclass of
another non-visual class.
Visual classes. These classes do have a visual representation at run
time. You cannot write an original visual class in the VisualAge for
Basic language, but you can write a new subclass of an existing VisualAge
for Basic component class. For example, you can declare a subclass of the
TextBox class. When you subclass a visual component, the information you
add to the subclass does not appear until run time. For example, if you
add properties to a subclass using VisualAge for Basic statements, they
will not appear in the Property Editor.
笊絶武笊 17.2. Declaring a Non-Visual Class 笊絶武笊
You declare a non-visual class using VisualAge for Basic statements. Class
declarations should be placed in a code module (.bas) file. You can declare
multiple classes in the same code module file, or create a code module file for
each class declaration you create.
A class declaration identifies data members, the constructor and destructor
methods, methods of the class, and property assignments. The following example
declares a typical non-visual class:
Class EmployeePay
Private HourlyRateVar as Currency
Private VacationPay As Currency
Sub New()
HourlyRateVar = 0
End Sub
Sub Delete()
Form1.Print "Deleting EmployeePay object"
End Sub
Function CalculateVacationPay() As Currency
CalculateVacationPay = HourlyRateVar * 0.04
End Function
Property Get VacationPay() As Currency
VacationPay = CalculateVacationPay()
End Property
Property Get HourlyRate() As Currency
HourlyRate = HourlyRateVar
End Property
Property Let HourlyRate(HourlyRateArg As Currency)
If HourlyRateArg >= 0 Then
HourlyRateVar = HourlyRateArg
Else
HourlyRateVar = 0
End If
End Property
End Class
HourlyRateVar and VacationPay are data members. HourlyRateVar and VacationPay
are private, so they cannot be accessed outside this class.
The New method is called a constructor. When VisualAge for Basic creates an
object, it automatically executes the method called New. The Delete method is
called a destructor. It is for cleanup operations. VisualAge for Basic
automatically executes the Delete method when the last reference to an object
of this class is removed-just before it deletes the object.
CalculateVacationPay is a method implemented as a function procedure.
When you include an accessor method, using the Property Get keywords, VisualAge
for Basic declares a read-only property called VacationPay. When you include a
pair of accessor methods, using the Property Get and Property Let keywords,
VisualAge for Basic declares a read-write property called HourlyRate.
笊絶武笊 17.2.1. Data Members 笊絶武笊
An object's current state is stored in data members, which are data variables
declared within the class. In general, it is good programming practice to
declare each data member Private so it cannot be accessed outside the class. If
other objects need to manipulate the value stored in a data member, declare it
as a property. A private data member can still be accessed by other members of
the class in which it is declared.
Tip: Private data members are always protected in VisualAge for Basic.
Although data members cannot be accessed outside the class in which they are
declared, they are inherited by subclasses. Subclasses therefore have access to
data members declared in their base classes.
See also: Declaring Properties.
To declare a data member, use the same syntax you use to declare a variable
within a procedure. For example:
Private HourlyRateVar As Currency
Tip: Do not declare data members within the body of the New() constructor
method if they are needed by other members of the class. Instead, declare data
members outside the body of the New() method declaration, using the Private or
Public keywords. You can then set the initial values for the data members
within the constructor method. VisualAge for Basic initializes data members to
0 by default. It also erases the contents of a data member within an object of
a class when the last reference to the object of the class is removed.
笊絶武笊 17.2.2. Methods 笊絶武笊
A method is a procedure that performs an action in relation to an object of a
class. A method is a sub or function procedure that is declared within the body
of a class. A method implemented as a function procedure returns a value,
whereas a method implemented as a sub procedure does not return a value.
The following example declares a method called CalculateVacationPay:
Function CalculateVacationPay() As Currency
CalculateVacationPay = HourlyRateVar * 0.04
End Function
In the same way you invoke a method on a component, you can invoke a method on
an object of a class. For example, if you created an object of the class
EmployeePay as EmpPay1, you can invoke the CalculateVacationPay method in the
following manner:
VacPayVar = EmpPay1.CalculateVacationPay()
笊絶武笊 17.2.3. Constructor Method 笊絶武笊
The constructor method (Sub New) handles operations that are required when you
first create an object, for example, initializing data members. If you write a
New method for your class, VisualAge for Basic calls it automatically when it
creates a new object of that class. A New method can prevent programming
errors, because initialization is performed automatically. The following
example initializes the HourlyRateVar variable when the object is created:
Sub New()
HourlyRateVar = 0
End Sub
Tip: As with any sub procedure, variables declared within a method are private
to that method. If you need to declare a variable that must be available to all
members of the class, declare the variable as a separate member, outside the
body of a specific method. It is good programming practice to declare data
members with the Private keyword wherever possible. A Private data member is
available to other members of the same class and its subclasses, but is not
available outside the class.
笊絶武笊 17.2.4. Destructor Method 笊絶武笊
You can define a special method called Delete() that is automatically executed
when the last reference to the object is removed. In this method, include any
operations that must be performed just before the object is destroyed. For
example, relinking the remaining elements of a linked list when an element is
deleted. This method is referred to as the destructor method.
笊絶武笊 17.2.5. Declaring Properties 笊絶武笊
You declare properties to provide a means to control the state or behavior of
an object, such as its color or height. You declare a property by providing
methods that provide read and/or write access. These methods are called
accessor methods. You control a property using the same syntax you use to
control a variable. Properties are safer than variables because their accessor
functions can make decisions about whether a proposed value should be rejected.
If you specify a Get accessor method, VisualAge for Basic creates a read-only
property. If you specify a Get and Let or Set accessor method, VisualAge for
Basic creates a read-write property. If you only specify a Let or Set method,
VisualAge for Basic creates a write-only property.
A Get method retrieves the value of a property. A Let or Set method sets the
value of a property. Set accessor methods provide a means by which an object
can be stored as the value of a property. Use Let accessors to define access
for fundamental types such String or Currency. Use Set for object types.
笊絶武笊 17.2.5.1. Declaring a Get Accessor Method 笊絶武笊
If a procedure attempts to read the value of a property on an object, VisualAge
for Basic automatically invokes the appropriate Get accessor method. The Get
accessor method is simply a function procedure that returns a value. However,
from outside the class, the operation is analogous to retrieving the value of a
public data member. The following example shows a Get accessor method:
Property Get HourlyRate() As Currency
HourlyRate = HourlyRateVar
End Property
VisualAge for Basic automatically invokes this accessor method when it
encounters the following statement:
EmployeeHourlyRateVar = EmpPay1.HourlyRate
笊絶武笊 17.2.5.2. Declaring a Let Accessor Method 笊絶武笊
If a procedure attempts to write the value of a property on an object,
VisualAge for Basic automatically invokes the appropriate Let accessor method.
The Let accessor method is a sub procedure that implicitly accepts the value
written to the property as a parameter to the accessor method. The accessor
method can contain instructions that verify proposed property values, so that
illegal values are rejected without crashing the object. The following example
shows a Let accessor method with a single argument:
Property Let HourlyRate(HourlyRateArg As Currency)
If HourlyRateArg >= 0 Then
HourlyRateVar = HourlyRateArg
Else
HourlyRateVar = 0
End If
End Property
VisualAge for Basic automatically invokes this accessor method if it encounters
the following statement:
EmpPay1.HourlyRate = EmployeeHourlyRateVar
笊絶武笊 17.2.5.3. Declaring a Set Accessor Method for Properties Containing Objects 笊絶武笊
In addition to simple data types, you can store objects within properties. You
must use the Set keyword, rather than the Let keyword, to define a way of
storing object data in a property. The following example shows how the Set
keyword provides access to object data within properties:
Class TestClass
Private VarA As AnotherClass
Property Get AProperty() As AnotherClass
Set AProperty = VarA
End Property
Property Set AProperty(X As AnotherClass)
Set VarA = X
End Property
End Class
Class AnotherClass
Private VarB As Integer
Default Property Let TheDefProp(X As Integer)
VarB = X
End Property
Default Property Get TheDefProp() As Integer
TheDefProp = VarB
End Property
End Class
Sub Form_Click()
Dim Y As AnotherClass
Dim X As TestClass
Set Y = New AnotherClass
Set X = New TestClass
Y = 5
Set X.AProperty = Y
Form1.Print X.AProperty
End Sub
To assign the value to the property, use the following statement:
Y = 5
The previous expression assigns the value to the default property of the object
stored in the AProperty property. The Default keyword has designated TheDefProp
as the property to manipulate when an expression assigns a value to the object
directly. The expression is equivalent to:
Y.TheDefProp = 5
笊絶武笊 17.2.5.4. Designating a Default Property 笊絶武笊
VisualAge for Basic permits implicit property access. For example, if you are
assigning a value to an object Y, you can do so either explicitly:
Y.TheDefProp = 5
or implicitly:
Y = 5
Implicit property access requires that you designate a property as the default
property within the class declaration. You can designate a default property by
preceding the declaration of the Get and/or Let or Set accessor methods with
the Default keyword:
Class TestDefault
Private HourlyRateVar As Currency
Default Property Get HourlyRate() As Currency
HourlyRate = HourlyRateVar
End Property
Default Property Let HourlyRate(HourlyRateArg As Currency)
If HourlyRateArg >= 0 Then
HourlyRateVar = HourlyRateArg
Else
HourlyRateVar = 0
End If
End Property
End Class
Important: You can only designate one default set of accessor methods per
class. *.
笊絶武笊 17.2.5.5. Declaring Properties as Read or Write 笊絶武笊
If you implement a property with a Get accessor method, but you do not specify
a Let or Set accessor method, VisualAge for Basic declares the property is
read-only. Conversely, if you implement with a Let or Set accessor method, but
you do not specify a Get accessor method, VisualAge for Basic declares the
property as write-only. If you implement a property with both Get and Let or
Set accessor methods, VisualAge for Basic declares it as read-write.
笊絶武笊 17.3. Subclassing from a Non-Visual Class 笊絶武笊
In order to create a subclass of an existing non-visual class, use the same
syntax you would use to declare a new class, specifying the base class as the
type for the new class. For example:
Class ManagerPay As EmployeePay
Sub New() As EmployeePay()
[statements]
End Sub
End Class
Any new properties or methods you specify in the declaration of the subclass
are available to objects of the subclass, in addition to the functionality
inherited from the base class.
笊絶武笊 17.4. Subclassing from a Visual Class 笊絶武笊
In order to create a subclass of a visual class (a component from the Toolbox),
use the same syntax you would use to declare a new class, specifying the base
class as the type for the new class. For example:
Class ManagerPayForm As Form
Private ManagerDepartmentVar As Integer
Sub New() As Form(App, "MyForm", Nothing, 1000, 1000, 2000, 1000)
End Sub
Property Get ManagerDepartment() As Integer
ManagerDepartment = ManagerDepartmentVar
End Property
Property Let ManagerDepartment(ManagerDepartmentArg As Integer)
ManagerDepartmentVar = ManagerDepartmentArg
End Property
End Class
In addition to the functionality inherited from the Form component class,
objects of the ManagerPayForm subclass also have a property called
ManagerDepartment.
笊絶武笊 17.4.1. Invoking Base Class Constructor Arguments 笊絶武笊
You must invoke the constructor method of the visual base class in the
constructor of the subclass, passing the arguments required by the constructor
of the base class. You do this by specifying the name of the base class as a
type for the constructor of the subclass, passing the arguments required by the
constructor of the base class:
Sub New() As BaseClassName(Argument1, Argument2 [,...])
[statements]
End Sub
See also: Component Constructor Syntax, in theVisualAge for Basic Language
Reference Online Help for a complete listing of the constructor arguments for
the component classes shipped with VisualAge for Basic.
笊絶武笊 17.5. Inheritance 笊絶武笊
When you declare a subclass of an existing class, you are declaring a new class
that will inherit the features of the class upon which it is based. You can
also declare a subclass of a subclass, creating a class that can inherit the
features of two levels of classes. You can use inheritance to design a
hierarchy of classes in which you place features that are shared by all classes
in a common base class, while specialized behavior is placed in subclasses at
various levels of the hierarchy. In this way, you can greatly reduce redundancy
in your application, by placing shared behavior in a few classes. The following
diagram illustrates a hierarchy of specialized subclasses:
The Employee class contains properties and methods that are common to all
employees, such as EmployeeName and EmployeeNumber. However, there are
different kinds of employees within an organization. Specialized subclasses can
inherit the properties and methods common to all employees, while each provides
the specific attributes required to track a specific kind of employee.
In the example shown above, the HourlyEmployee subclass inherits the
EmployeeName and EmployeeNumber properties of the Employee class. In addition
to those inherited attributes, the HourlyEmployee subclass also contains the
additional property HourlyRate, as well as the properties HoursWorked and
VacationEarned.
The HEmpPerm and HEmpTemp subclasses of the HourlyEmployee class provide a
further level of specialization. The HEmpPerm inherits all the features of the
HourlyEmployee class as well as those of the Employee class. The HEmpPerm
subclass contains the property YearsOfService, while the HEmpTemp subclass
contains the property DaysOfService.
The VacationEarned property, which both HEmpPerm and HEmpTemp inherit,
calculates the value of VacationEarned by multiplying the number of hours
worked by 4%. While this approach is appropriate for permanent hourly
employees, who will collect their vacations as time off, it is not appropriate
for temporary employees, who will collect the amount as a cash lump sum. This
problem introduces the concepts of overriding methods and polymorphism.
笊絶武笊 17.5.1. Overriding Methods and Polymorphism 笊絶武笊
By providing a new implementation to override the inherited accessor method,
the VacationEarned property behaves in a completely different manner in objects
of the HEmpTemp class than it does in objects of the HourlyEmployee class. The
ability of different objects to respond to the same method call in different
ways is called inheritance-based polymorphism.
The act of replacing the implementation of a class with a different algorithm
in a subclass is called overriding. All methods of classes declared in
VisualAge for Basic can be overridden. Because properties are implemented by
pairs of accessor methods, you override properties by overriding the methods
that implement them.
When you override a method in a subclass, you are instructing VisualAge for
Basic to ignore the implementation for a method that was inherited from its
base class, and to use an alternative implementation instead.
The VacationEarned property contained in the HourlyEmployee class is
implemented by the following accessor method:
Property Get VacationEarned() As Currency
VacationEarned = HoursWorked * HourlyRate * 0.04
End Property
A call to this property would return a value in currency:
VacationVar = HourlyEmployeeObject.VacationEarned
However, temporary employees earn a higher vacation premium. In the declaration
of the HEmpTemp subclass, the implementation for the VacationEarned property is
overridden by the declaration of a new accessor method of the same name:
Class HEmpTemp As HourlyEmployee
Sub New() As HourlyEmployee()
Form1.Print "Startup of HEmpTemp Object"
End Sub
Property Get VacationEarned() As Currency
VacationEarned = HoursWorked * HourlyRate * 0.06
End Property
End Class
A call to this property would return a value in currency:
VacationVar = HEmpTempObject.VacationEarned
Important: You must specify the same argument list for the new property or
method implementation as exists in properties or methods of the same name in
the base class. Overriding an existing method or property with a different
argument list causes an error.
笊絶武笊 17.5.2. Inheritance and Scope 笊絶武笊
Subclasses inherit all methods and properties of all classes in the chain of
inheritance. Data members declared with the Private keyword are also inherited
by subclasses of the class in which they are declared. Private members are
analogous to protected members in C++.
笊絶武笊 17.5.3. Multiple Inheritance: Combining Base Classes 笊絶武笊
You can create a subclass that inherits the attributes of two or more base
classes. Instead of specifying a single base class from which the subclass
should inherit its attributes, specify multiple classes as the type for the new
class:
Class MultipleClass As BaseClass1 [,BaseClass2 [,...]]
Sub New() As BaseClass1() [, BaseClass2() [,...]]
End Sub
[statements]
End Class
笊絶武笊 17.5.3.1. An Example of Multiple Inheritance 笊絶武笊
The following example shows the declaration of a subclass called BothFruit,
which inherits from the base classes AppleClass and OrangeClass.
The following code declares a class called AppleClass:
Class AppleClass
Private AppleVar As Integer
Sub New()
AppleVar = 1
End Sub
Property Get Apples() As Integer
Apples = AppleVar
End Property
End Class
The following code declares a class called OrangeClass:
Class OrangeClass
Private OrangeVar As Integer
Sub New()
OrangeVar =1
End Sub
Property Get Oranges() As Integer
Oranges = OrangeVar
End Property
End Class
The following code declares a subclass called BothFruit which inherits from
both AppleClass and OrangeClass:
Class BothFruit As AppleClass, OrangeClass
Sub New() As AppleClass(), OrangeClass()
End Sub
Property Get TotalFruit() As Integer
TotalFruit = Apples() + Oranges()
End Property
The AppleClass class contains a property called Apples. The OrangeClass class
contains a property called Oranges. The BothFruit subclass inherits both the
Apples and Oranges properties. In addition, it contains a property called
TotalFruit, which contains the sum of the AppleClass and OrangeClass
properties, inherited from the two base classes.
You can test the inheritance of the properties from both base classes with the
following procedure:
Sub Form_Click
Dim X As BothFruit
Set X = New BothFruit
Form1.Print X.Apples
Form1.Print X.Oranges
Form1.Print X.TotalFruit
End Sub
VisualAge for Basic retrieves or calculates the values of the three properties
and prints them on the form:
1
1
2
笊絶武笊 17.5.3.2. Multiple Inheritance and Visual Base Classes 笊絶武笊
You can specify a visual component as one of the base classes when you declare
a subclass. Generally, you would do this if you wished to combine the
attributes of a visual component with the attributes of one or more non-visual
classes.
笊絶武笊 17.5.3.3. How Method and Property Name Conflicts Are Resolved 笊絶武笊
When you declare a subclass which inherits its attributes from multiple base
classes, conflicts between methods and properties of the same name in both base
classes may occur. VisualAge for Basic resolves method and property name
conflicts by applying two rules:
Where two or more base classes have a method or property of the same
name, the implementation contained in the left-most base class in the
subclass declaration is adopted for the subclass. For example, if a
subclass declaration has the following form:
Class NewClass As BaseClass1, BaseClass2, BaseClass3
Conflicts between properties, methods, or data members of the same name
are resolved by accepting the definitions found in BaseClass1 over those
found in BaseClass2 or BaseClass3, and the definitions found in
BaseClass2 over those found in BaseClass3.
The specification of a new implementation for a method or property
accessor overrides any previous implementation for that method or
property accessor, including the implementation contained in the left-
most base class of the subclass declaration.
笊絶武笊 17.5.3.4. Multiple Visual Base Classes and Name Conflicts 笊絶武笊
Although you can declare a subclass that specifies more than one visual
component as a base class, you should refrain from doing so. Subclassing from
multiple visual base classes can produce visual subclasses that are difficult
to to control. This is because visual components often have properties or
methods of the same name. If you specify two or more visual components as base
classes, VisualAge for Basic will resolve the name conflicts by ignoring the
properties or methods of all but the left-most visual base class listed in the
subclass declaration.
笊絶武笊 17.6. Using Classes 笊絶武笊
You can create and refer to objects of the classes you declare in VisualAge for
Basic using the same syntax you use to refer to component instances.
笊絶武笊 17.6.1. To Create an Object of a Class Within a Procedure 笊絶武笊
To create a new object variable, create an object variable referring to the
class name, preceded by the New keyword:
Dim ObjectName As ClassName
Set ObjectName = New ClassName
You can combine the Dim and Set keywords to create an object using a single
line of code:
Dim ObjectName As New ClassName
The New keyword forces the instantiation of a new object of your class. For
example, to create a new object of the HEmpPerm class, you would enter the
following line within a procedure:
Dim NewPermanentEmployee As HEmpPerm
Set NewPermanentEmployee = New HEmpPerm
You can also specify the name of the base class as the type for the object
variable that will hold an object of the subclass:
Dim NewPermanentEmployee As HourlyEmployee
Set NewPermanentEmployee = New HEmpPerm
Tip: If you type an object variable using the type of the base class, rather
than the type of the subclass, you are limited to the interface of the base
class (the methods and properties declared in the base class.) However, if one
of these methods or accessors references a method that you have overridden in
the subclass, that behavior will still apply for the subclass object.
笊絶武笊 17.6.2. To Destroy an Object Within a Procedure 笊絶武笊
You destroy an object within a procedure by setting its value to Nothing:
Set ObjectVariableName = Nothing
笊絶武笊 17.6.3. Declaring Object Variables of Type Object or Type Variant 笊絶武笊
Although it is good programming practice to specifically type object variables
to the class type of the object they will hold, you can also store objects in
variables of type Object or of type Variant. Storing objects in variables of
these types will result in slower execution of your application. This
performance decrease is due to late binding. Normally, VisualAge for Basic
analyzes all of the instructions in your program when you compile your program.
This is called early binding. However, if you use object variables of type
Object or of type Variant, VisualAge for Basic can only determine which
instructions are necessary at run time. This is called late binding, and is
slower than early binding.
笊絶武笊 17.6.3.1. Declaring Object Variables of Type Object 笊絶武笊
Dim NewPermanentEmployee As Object
Set NewPermanentEmployee = New HEmpPerm
笊絶武笊 17.6.3.2. Declaring Object Variables of Type Variant 笊絶武笊
Dim NewPermanentEmployee As Variant
Set NewPermanentEmployee = New HEmpPerm
笊絶武笊 17.6.4. Referring to Objects Using Object Variables 笊絶武笊
In order to access a method or property of an object, combine the name of the
object and the property or method you are accessing. For example:
EmployeeNumberVar = NewPermanentEmployee.EmployeeNumber
See also: Chapter 9, Working with Data and Object Variables.
笊絶武笊 18. Chapter 13 Writing an Error-Handling Routine 笊絶武笊
You can create custom error-handling code to override VisualAge for Basic's
default handling of run- time errors.
This chapter describes how to write an error-handling routine by showing you
how to:
Branch to the routine
Write the subroutine
Check the error code
Branch back to the application
When VisualAge for Basic encounters a run-time error, error-handling code is
executed. In some situations, error-handling code traps errors and takes
corrective action, allowing your application to continue executing. In other
situations, error-handling code may only be able to terminate your application
safely by closing all files and returning to the system.
笊絶武笊 18.1. Understanding Error Handling 笊絶武笊
Every software application experiences error conditions. Some of these errors
are caused by flaws in the original source code instructions. Source code
errors must be resolved by making the necessary corrections to the original
VisualAge for Basic code.
Many run-time error conditions are caused by unexpected conditions in the
computer's operating environment. These conditions include problems such as
lack of memory or disk space.
In addition to performing remedial actions, error-handling code can report
detailed diagnostic messages. Detailed error reporting can simplify
troubleshooting.
Error-handling code is a "last resort" measure. Try to prevent errors from
occurring at run time by validating data wherever there is a possibility that
an operation might result in an error condition, for example:
If Denominator <> 0 Then
Result = Numerator / Denominator
Else
Result = 0
End If
笊絶武笊 18.2. Step 1. Branching to the Routine 笊絶武笊
You use the On Error statement to branch program execution to an error-handling
routine. The On Error statement has the following switches:
On Error GoTo {Label | LineNumber | 0 | Resume Next}
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏abel 笏ndicates the beginning of the error-handling 笏
笏 笏Soutine using a tag or a label within the current 笏
笏 笏Qrocedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ineNumber 笏dentifies the line location in the procedure 笏
笏 笏Xhere the error-handling routine begins. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0 笏isables error handling in the current procedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3esume Next 笏ontinues execution at line following the error. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 18.2.1. Labels Versus Line Numbers 笊絶武笊
Avoid using line numbers to identify the location of error-handling routines.
This feature exists solely to retain compatibility with source code written for
other versions of Basic.
Tip: Use labels to identify the location of error-handling routines.
笊絶武笊 18.3. Step 2. Storing Error-Handling Instructions in a Subroutine 笊絶武笊
You store the error-handling routine in a subroutine identified by a label
within the current procedure. A subroutine is an informal section within a sub
or function procedure. You mark the beginning of a subroutine with a label
consisting of a string followed by a colon (:). You mark the end of the
subroutine with the Resume statement. The Resume statement directs procedural
execution back to the line where the error occurred, or to another location in
the procedure.
笊絶武笊 18.4. Step 3. Analyzing the Meaning of Standard Error Codes 笊絶武笊
VisualAge for Basic reports error conditions using a set of standard error
codes. The Err register returns the code corresponding to the most recent error
condition.. Use this value to control a decision structure containing
instructions to address individual problems.
See also: Trappable Errors of the VisualAge for Basic Language Reference
Online Help for a complete listing of the VisualAge for Basic error codes.
笊絶武笊 18.5. Step 4. Branching Back to the Application 笊絶武笊
You use the Resume statement:
To identify the end of an error-handling routine.
To branch program execution back to the calling procedure.
To branch program execution to another location identified by a label.
The Resume statement has the following syntax:
Resume [{0 | Next | Label}]
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3esume {0} 笏3esumes execution at the line where the original 笏
笏 笏Frror occurred. This branching statement should 笏
笏 笏Pnly be used with resource errors, as opposed to 笏
笏 笏Mogic errors. For example, this branching 笏
笏 笏Ttatement could be useful if the trapped error 笏
笏 笏Dode indicated a locked file. However, if the 笏
笏 笏Priginal error was due to a flaw in program logic,笏
笏 笏Uhis statement could cause an unending loop. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3esume Next 笏3esumes execution at the line following the 笏
笏 笏Mocation of the original error. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Y Resume Label 笏3esumes execution at the location indicated by 笏
笏 笏abel. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 18.6. An Example Error-Handling Routine 笊絶武笊
The following code example shows an error-handling routine that intercepts
error conditions during execution of a function procedure.
Function SuccessRate (MadeSale as Integer, TotalApproached as
Single)
On Error GoTo ErrorHandler
SuccessRate = (MadeSale / TotalApproached) * 100
Exit Function 'Error-handling routine
ErrorHandler:
If Err = 11 Then
SuccessRate = 0
Resume Next
Else
MsgBox Error(Err)
End
End If
End Function
The function returns the value of MadeSale divided by TotalApproached,
expressed as a percentage. If TotalApproached is equal to zero, a
division-by-zero error occurs. Normally, this would cause the application to
stop execution. In this case, however, the error condition is intercepted by
the On Error statement, which branches execution to the ErrorHandler
error-handling routine.
An If...Then structure within the ErrorHandler routine retrieves the value
returned by the Err function. If the error code corresponds to 11
(division-by-zero error), ErrorHandler assigns the value 0 to the function. The
Resume Next statement branches program execution back to the line following the
line that caused the original error.
If an error condition other than error code 11 is detected, ErrorHandler uses
the MsgBox statement and the Error function to display a detailed message
explaining the error. ErrorHandler then terminates program execution using the
End statement.
The line immediately preceding the ErrorHandler: label contains the Exit
Function statement, which bypasses execution of the routine's statements during
non-error conditions.
笊絶武笊 19. Part 3 Integrating with External Systems 笊絶武笊
笊絶武笊 20. Chapter 14 Integration Overview 笊絶武笊
VisualAge for Basic provides a myriad of tools to help you integrate your
programs with other programming systems. Part 3 Integrating with External
Systems, describes in detail how to integrate your programs with other
programs, object systems, databases, and communication protocols.
This chapter provides an overview of VisualAge for Basic's integration support.
It also describes how to use the Component Catalog to integrate non-visual,
external classes. You can use this catalog for SOM, OLE, and OCX classes. Of
course you can also integrate visual classes; for more information see Adding
Objects from Other Object Systems.
笊絶武笊 20.1. What Does VisualAge for Basic Support? 笊絶武笊
The following table lists the chapters in this part, and the supported
environments.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏hapter... 笏escribes 笏4upported 笏
笏 笏Jntegration with... 笏nvironment 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ntegrating System Object Model (SOM) 笏4ystem Object Model 笏0S/2, Windows 95, 笏
笏0bjects 笏 笏Bnd Windows NT 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏andling OLE in VisualAge for Basic 笏0bject Linking and 笏8indows NT and 笏
笏 笏mbedding 笏8indows 95 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tored Procedure OCX Component 笏B2 stored 笏8indows NT and 笏
笏 笏Qrocedures via an 笏8indows 95 笏
笏 笏0LE custom control 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏alling DLL Procedures 笏ny program saved as笏0S/2, Windows 95, 笏
笏 笏B DLL 笏Bnd Windows NT 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6sing OpenDoc Documents 笏0penDoc 笏0S/2 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 20.2. Integrating Non-Visual Classes 笊絶武笊
VisualAge for Basic supports the integration of SOM and OLE non-visual classes.
After integrating these classes, they can appear in the Toolbox, and you can
interactively use the classes as you would any other VisualAge for Basic
integrated class.
笊絶武笊 20.2.1. Customizing Integration with an Integration Data File 笊絶武笊
Non-visual classes use an integration file to provide information such as what
icon to use in the Toolbox, help context ID, or help file. The format of this
file is the same as a VisualAge for Basic form file (with an extension of .i).
Integration data files have file names corresponding to the names of the
classes they describe. You can customize certain aspects by creating or
modifying the integration data file.
When you save an integration file, you must set the directory path where the
integration files can be found. When you refer to a class, VisualAge for Basic
refers to the following to locate the corresponding integration file:
Current directory.
Directory environment variable in CLASSDATA.
VisualAge_dir/config directory.
笊絶武笊 20.2.1.1. Integration Data File Example 笊絶武笊
This section describes how to create an integration data file for the SOM
Calculator class.
1. Open a Command Prompt window.
2. Make the directory containing the SOM example part the current directory:
cd \visage\samples\integrat\somcalc1
3. Open the NotePad application with the argument "SomCalculator.int"
notepad SomCalculator1.int.
4. When presented with the following dialog, click on the "Yes" button:
5. Within NotePad, enter the following text:
*SomCalculator1.IconLabel: TestLabel
6. Save the file and exit NotePad. Exit and re-enter VisualAge for Basic so
the change can take effect.
笊絶武笊 20.2.1.2. Additional Parameters You Can Specify in an Integration Data File 笊絶武笊
You can control many aspects of how VisualAge for Basic handles a part by
specifying parameters in the integration data file. There are two groups of
parameters you can configure: .
Those that apply to the part as a whole.
Those that apply to individual properties of the part.
.
Tip: Each line in the integration data file describes one attribute of the
part. You do not have to describe every attribute-only those you wish to
customize for the integration. Each entry you specify in an integration data
file should have the following structure:
.
*PartName.Parameter: Value
For example, to specify that a help file called SOMCALC.HLP be used with the
example part, you would enter the following line in the integration data file:
.
*SomCalculator1.HelpFile: SOMCALC.HLP
笊絶武笊 20.2.1.3. Integration Properties for the Part as a Whole 笊絶武笊
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏1ossible Values 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏conLabel 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏conFilename 笏Gilename 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elpFile 笏Gilename 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ontextID 笏Mong 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ditorAccess 笏oAccess / ReadOnly / ReadWrite 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏efaultEvent 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ameProperty 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1arentProperty 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ndexProperty 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7isualClass 笏Ttring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏sManager 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏sDrawnOnParent 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏sResizable 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏sMoveable 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏efaultWidth 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏efaultHeight 笏nteger 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 20.2.1.4. Integration Properties that Apply to Individual Properties of a Part 笊絶武笊
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1arameter 笏1ossible Values 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ditorAccess 笏oAccess / ReadOnly / ReadWrite 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elayedSet 笏oAccess / ReadOnly / ReadWrite 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ultiEdit 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏annotBeExpression 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7olatile 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7aluesList 笏Jtem1 item2 item3... 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ixedList 笏5rue / False 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7aluesConstsList 笏Walue1 value2 value3 ... 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1ass 笏0 / 1 / 2 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ontextID 笏Mong 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏efaultValue 笏Ttring 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 20.2.2. Integrating SOM, OLE, and OCX 笊絶武笊
Any class referenced in a VisualAge for Basic project file (.prj) loads and
appears in the Toolbox at startup. After VisualAge for Basic is running, you
can integrate other classes using the Component Catalog. The Component Catalog
displays all available classes through the SOM and OLE object system adapters
(OSAs).
The SOM, or OLE Operating System Adapters (OSAs) appear in the project outline
under the Extensions category. The OCXs appear under the OLE OSA.
Important: If you want to use SOM objects, ensure that the VWADDSOM environment
variable is set to YES. You can either set the variable in your config.sys (for
OS/2) or autoexec.bat (for Windows NT and Windows 95) file, or you can set the
variable when you need it. If you added SOM after installing VisualAge for
Basic, you might need to update this environment variable.
To load a class:
1. Open the Component Catalog by highlighting the OSA and clicking on
Selected=>Open Component Catalog. You can also open the Component Catalog
by selecting the Window=>Component Catalog menu item. The Component
Catalog appears, displaying a list of all available classes, including
OCXs.
2. To load a class, click on the box to the left of the component name. The
selected class automatically appears in the Toolbox, and the Components
node listing in the Project window automatically updates, displaying the
new component.
You can remove a class by highlighting the class and selecting the
Selected=>Remove menu item. A message dialog appears asking you to confirm the
removal of the class.
Creating a new project or loading an existing project also removes all
integrated classes.
Important: You cannot remove the class from the project if an instance of the
component exists in your project.
笊絶武笊 20.2.3. Editing Properties of a Class 笊絶武笊
You can edit the properties of an instance of an integrated SOM or OLE class in
the Property Editor. Enumerated properties display allowable values in a combo
box. You can edit simple properties, such as integral type properties (int,
single, etc.) and enumerated properties, in constant or expression mode. The
initial value of more complex properties such as unions, structures, and
objects utilizing expressions can only be set in expression mode. Constant mode
is not available unless a quick selector or specialized editor exists for that
property.
You can edit properties of OCX instances, including:
Enumerated types
Blobs
Picture-like properties saved in .frx files
Properties providing quick selector, or type editor
笊絶武笊 20.2.4. Editing Code for a Class 笊絶武笊
Instances of classes that do not have events do not show up in the Code
Editor's middle combo box.
笊絶武笊 20.2.5. Generating an Executable 笊絶武笊
If you generate an executable for a project containing integrated OCX, SOM, or
OLE classes, the information required to find and create instances of the class
is built into the executable file.
If the classes cannot be found at run time, the executable gives an error
message and quits. The following rror situations can occur:
A form.i file that creates an instance of an OCX or SOM class loads
through the Project window File=>Add File menu item. VisualAge for Basic
loads the file, reports an error that it cannot create a class instance,
and continues loading the rest of the file.
A project that refers to an OCX or SOM class that is not available in the
system loads through the Project window File=>Open Project menu item.
VisualAge for Basic reports errors stating it cannot create the SOM
instances and continues loading the project.
In both cases, attempting to go to Test mode results in compilation errors or
run-time exceptions.
See also: Creating an Executable for more information on creating an
executable.
笊絶武笊 21. Chapter 15 Integrating System Object Model (SOM) Objects 笊絶武笊
In VisualAge for Basic, you can use System Object Model (SOM) classes in your
application. This chapter describes SOM, and how to make your SOM classes work
with VisualAge for Basic. The example in this section shows how to use the
SomCalculator object in VisualAge for Basicfor Basic. To use this object you
must:
Create your SOM IDL file.
Set the SOM environment variables.
Specify an initialization function.
Register the SOM object.
Load the object onto the Toolbox.
笊絶武笊 21.1. What is SOM? 笊絶武笊
SOM is an object-oriented programming technology for building, packaging, and
manipulating reusable binary class libraries. With SOM, you describe the
interface for a class of objects in a standard language, called the Interface
Definition Language (IDL). You then implement methods in your preferred
language, which can either be an object-oriented language, such as C++,
Object-Oriented COBOL, or a procedural language, such as C.
Unlike the object model found in formal object-oriented programming systems,
SOM is language neutral. It preserves the key object-oriented programming
characteristics of encapsulation, inheritance, and polymorphism without
requiring the implementor of a SOM class and user of a SOM class to use the
same programming language.
See also: SOM is an implementation of the Common Object Request Brokerage
Architecture (CORBA). CORBA objects and VisualAge for Basic Type Mapping lists
the type mapping between CORBA objects and VisualAge for Basic data types.
For more information on implementing SOM classes and methods, see the
SOMobjects Base Toolkit User's Guide, and the SOMobjects Base Toolkit
Programmer's Reference Manual.
笊絶武笊 21.2. Writing a SOM IDL file 笊絶武笊
When you create your SOM IDL file, you need to include a dllname='name.dll"
statement in the implementation section. For example, in the IDL for the
Calculator you must have the following statement:
dllname = "calc.dll";
笊絶武笊 21.3. Setting the SOM Environment Variables 笊絶武笊
The following environment variables specify information needed by the SOM
compiler, interface repository framework, and run time.
See also: For full details, see the SOMobjects Developer's Toolkit User Guide
Version 2.1
SMINCLUDE Specifies where to look for #include files included by the .idl file
being compiled.
set SMINCLUDE=.;c:\toolkt20\include;c:\som\include
SMTMP Specifies where to put intermediate output files. This directory
should not be the same as the ones where input and output files are
located.
set SMTMP=c:\tmp\garbage
SMEMIT Specifies which emitters the SOM compiler runs. The most frequent
emitters are: the .h emitter, which produces a header file for use
by a C client, the .c emitter, which produces C bindings, and the
.ih emitter, which produces the implementation header files.
set SMEMIT="h,ih,c"
For example, the following series of statements directs the SOM
Compiler to produce calculator class files and populate the IR from
the "calc.idl" input specifications:
set SMEMIT="h,ih,c"
sc -usir calc.idl
SOMIR Specifies the location of the interface repositories.
set SOMIR=c:\mydir\calc.ir
As with the SOMIR environment variable, you can type these environment
variables when you need them. However, it is easier to put the above
statements in your config.sys or autoexec.bat file.
Important: If you want to use SOM objects, ensure that the VWADDSOM
environment variable is set to YES. You can either set the variable in your
config.sys (for OS/2) or autoexec.bat (for Windows NT and Windows 95) file, or
you can set the variable when you need it. If you added SOM after installing
VisualAge for Basic, you might need to update this environment variable.
笊絶武笊 21.4. Specifying an Initialization Function 笊絶武笊
You must provide an initialization function for the class library to support
dynamic loading of the library by the SOM Class Manager. The SOM Class Manager
DLL expects that, whenever it loads a class library, the initialization
function will create and register class objects for all of the classes
contained in the library. These classes are then managed as a group.
The following example shows the initialization function for the Calculator:
void SOMLINK SOMInitModule(integer4 majorVersion, integer4
minorVersion)
printf("initializing\n");
SOM_TraceLevel = 1;
/* PrintStaticClassInfo(&SomCalculatorSCI); */
SomCalculatorNewClass(0,0);
/* PrintStaticClassInfo(&SomCalculatorSCI); */
fflush(stdout);
The class DLL must export the function name SomInitModule, and the standard
three externals for the class definitions:CalculatorNewClass,
CalculatorClassData, and CalculatorCClassData.
See also: For full details, see the SOMobjects Developer's Toolkit User Guide
Version 2.1.
笊絶武笊 21.5. Registering a SOM class 笊絶武笊
This section tells how to register the SomCalculator class and add it to your
Toobox at run time.
First, access the SomCalculator object files and copy the following files to
your directory.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ile 笏xtension Description 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.idl 笏efines the SOM object. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.dll 笏mplementation file shown in the Component Catalog笏
笏 笏4OM listing. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.h 笏anguage-dependent binding file. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.ih 笏anguage-dependent binding file. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.c 笏anguage-dependent binding file. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Dalc.mak 笏reates the .dll file. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Sules.mak 笏ontains path information. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Important: You need to ensure that your .idl file contains the DLL name in the
implementation section, by including the following statement:
dllname='calc.dll"
If the .dll file exists:
To register the SOM object, enter: sc -sir -u calc.idl (ir = interface
repository, u = update). You can access the registered .dll file using the
Component Catalog.
If the .dll file does not exist:
1. Access the directory where the calc.idl is stored.
2. Enter:
sc -sc;h;ih calc.idl.
This command creates or updates the .h, .ih, and .c files
(language-dependent binding files)..
3. To register the SOM object, enter:
sc -sir -u calc.idl
You can access the registered .dll file using the Component Catalog.
4. To confirm the proper registration of the SOM object, enter:
irdump SomCalculator
Tip: The name of the SOM Calculator can be viewed in the first few lines
of the calc.idl file. For example:
#include <somobj.idl>
#define StackSize 8
interface SomCalculator: SOMObject
5. Create the .dll file by entering:
nmake -f calc.mak
This creates the .dll file.
6. Windows NT and Windows 95: Specify the location of the .dll in the PATH
variable of autoexec.bat.
OS/2: Specify the location of the .dll in the LIBPATH variable of
config.sys. Specifying the path ensures that VisualAge for Basic will
locate the DLL in the proper directory at run time.
Tip: You could also copy the .dll file to a directory pointed to by the
PATH or LIBPATH variable.
7. Change the directory to /vwdir/config/.
8. Edit the somclses file, using a text editor, to include the
SomCalculator. If the file does not exist, create the file using a
standard text editor, and save it as plain text. The name of the SOM
object is case sensitive.
9. If the SomCalculator does not load into your application, ensure that the
path in the .mak file matches your installation. If it still doesn't
load, ensure that:
The DLL exports the SomInitModule function.
You have included the correct DLL name.
You have registered the class in the interface repository.
The DLL resides in a directory pointed to by the PATH (on Windows NT
and Windows 95) or the LIBPATH (on OS/2) variable.
笊絶武笊 21.6. Changing a Registered SOM DLL 笊絶武笊
If you make modifications or add features the calculator, you must recompile
your DLL.
1. Access the directory where the SOM Calculator files are stored.
2. At the prompt, enter
nmake clean
This command removes old .obj, .h, .o, .ih, .dll, and .lib files from the
previous version.
3. Re-register the SOM Calculator after removing all old files.
笊絶武笊 21.7. Loading the SomCalculator onto the ToolBox 笊絶武笊
1. Access the Component Catalog by highlighting Extensions in the Project
window.
2. Select Windows=>Component Catalog in the Project window.
The Component Catalog appears.
3. Select the SOM Object System using the drop-down selection box.
4. Select the Classes button. An outline of classes appears.
5. Select SomCalculator from the outline of classes.
The name that appears in the outline of classes matches the name
appearing in the .idl file. A check mark appears in the box.
6. The SomCalculator loads into the ToolBox.
You can load the SomCalculator on Form1. It appears as an icon. You can also
use code to reference the SomCalculator.
You use the attribute list in the .idl file to verify the methods. The
SomCalculator contains the mathematical methods Add, Subtract, Multiply, and
Divide. For example:
interface SomCalculator: SOMObject
{
attribute long Accum;
void Push();
long Pop();
void Plus();
void Minus();
void Divide();
void Multiply();
void Clear();
boolean Changed();
}
笊絶武笊 22. Chapter 16 Handling OLE in VisualAge for Basic 笊絶武笊
VisualAge for Basic lets you display editable data from external applications
within your application using Object Linking and Embedding (OLE). You can
configure the OLE object to edit data in its native application, which is the
source, or within a window in your VisualAge for Basic application, which is
the destination.
Definition: In the following discussion, the term source refers to the data's
original environment. The term destination refers to your VisualAge for Basic
application.
Platform-specific information: OLE support is only available on the Windows NT
and Windows 95 platforms.
In this chapter you will learn:
Why you use OLE.
How to create OLE objects at design time and run time.
How to manipulate OLE objects.
笊絶武笊 22.1. OLE components versus OLE objects 笊絶武笊
You can create an instance of the OLE component when you drag the OLE icon from
the Toolbox to a form or a frame. When you first create an OLE component it is
empty. You can create an OLE object in an OLE component at design time with the
Insert Object dialog, pop-up menus, or with the Paste Special dialog.
See also: Creating Linked Objects at Design Time.
笊絶武笊 22.2. Why Use Object Linking and Embedding? 笊絶武笊
OLE lets you use data from another application in its original format. It
inserts data into your application, along with its layout, features, and
functionality.
OLE provides the following benefits:
It displays and updates data from other applications.
It displays data identical to the source application.
Source applications do not have to be running simultaneously with your
application.
You can easily add OLE objects from other environments to your VisualAge
for Basic application without altering these objects.
You can modify OLE objects without leaving the VisualAge for Basic design
or run-time environment.
笊絶武笊 22.2.1. Understanding OLE 笊絶武笊
An OLE object is a collection of binary data. An application that is OLE-aware
provides transparent cooperation between applications. Activating an OLE object
applies some of the features and functionality from the source application to
your application. For example, if your OLE source application contains special
drawing features, these features are available through your application. You
can attach OLE data to your application in two ways-by linking or by embedding.
Both methods are available at run time and design time.
笊絶武笊 22.2.1.1. Objects That Are Linked 笊絶武笊
Linking data is useful when several applications must access a master data set.
A master data set is easier to maintain when identical information appears in
multiple external applications.
You maintain and store linked data using the source application. The OLE object
data is only a reference within your application-you do not edit it within your
VisualAge for Basic project. To edit linked data, you select the data stored in
the OLE object to activate the source application. In the open source
application, you can edit and save the linked data, exit, then return to your
VisualAge for Basic application. The linked data is automatically updated in
your application.
Using linked data frees you from the task of creating code to save any changes
the user may make. The source application manages all data manipulation-your
VisualAge for Basic application only displays the data.
Important: If another application modifies the data linked to your VisualAge
for Basic project, the OLE object might not display the most current
information. To ensure that your application's OLE object displays up-to-date
information, set the Action property to update linked data (OLE_UPDATE) each
time your application is run.
笊絶武笊 22.2.1.2. Objects That Are Embedded 笊絶武笊
You maintain embedded data using the destination application (your VisualAge
for Basic project). This means that the data is copied to your application's
OLE object. You can access an embedded object's data only from your
application. In essence, the embedded data is invisible to the outside
world-controlled only through your application. A user can modify an embedded
object by activating it. You set how the OLE object activates through the
AutoActivate property using the Property Editor at design time, or in VisualAge
for Basic code at run time.
The user edits the OLE-embedded object in the source application. However, all
data and any modifications are stored in your application in a separate file.
An embedded object's changed data is not yet a permanent part of your
application.
If you edit an embedded object's data at design time, you must save the project
and recompile your application to make the change permanent.
See also: Saving Changed Data .
笊絶武笊 22.3. Creating OLE Objects 笊絶武笊
The OLE object contains all path information to the source application. If the
end user's operating system does not have the source application, your
VisualAge for Basic application displays the latest snapshot taken when the
application's executable was generated. The data displays in the OLE component,
but the user cannot edit the linked or embedded information.
When you create an OLE component, you must set the component's properties. The
primary OLE properties you must set are those that indicate whether the
component contains linked or embedded data. In addition to the primary
properties, you must also consider how the OLE component appears on the screen,
how the data is manipulated, and how, in some cases, objects are resized.
To determine if an OLE object is displayed as an icon or as data, set the
DisplayType property. You can not change the display format after the OLE
object is created. Selecting DisplayType Icon automatically selects the Display
As Icon check box in the Insert Object dialog.
To determine if the imported data is clipped or stretched, or the object itself
is resized, use the SizeMode property.
The following table describes the SizeMode property settings:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏4izeMode Setting 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lip 笏5he OLE object is too large for the OLE component 笏
笏 笏Bnd the edges are cut. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tretch 笏5he OLE object is stretched to fit the size of the笏
笏 笏0LE component. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏utosize 笏5he OLE component changes its size at run time to 笏
笏 笏Bccommodate the size of the OLE object it 笏
笏 笏Dontains. At design time, the OLE component does 笏
笏 笏Oot change and remains at the default clip view. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
See also: VisualAge for Basic Language Reference Online Help, OLE object for a
complete list of supported properties, methods, and events.
笊絶武笊 22.4. Creating Linked Objects at Design Time 笊絶武笊
The OLE-object data in a linked OLE component exists and is maintained in a
separate file. Your application only contains a reference to the data. To
create a reference to the data, you must know the complete path and file name
of the linked data. You can create a linked object either by using the Insert
Object or Paste Special dialogs.
笊絶武笊 22.4.1. Using the Insert Object dialog 笊絶武笊
When you create an OLE object on your form, VisualAge for Basic immediately
displays the Insert Object dialog.
1. Click the Create From File option.
VisualAge for Basic prompts you to select an existing file.
2. Select a file, type the path and the file name directly, or click the
Browse button to locate the desired file.
3. Select the Link check box to create the link between the source
application and your OLE object. VisualAge for Basic automatically
updates the SourceDoc property in the Property Editor. The linked file,
with its application, starts and displays on your screen. The OLE object
displays the linked data.
4. Click on the Display As Icon check box to display the OLE object as an
icon within your application. VisualAge for Basic displays the source
application's icon by default. Select a different icon using the Change
Icon button.
Tip: If you only want to link a portion of the linked data, use the
SourceItem property to specify data within the source document. The content of
the SourceItem synopsis depends on the source application.
Another way to import portions of existing data is to copy data to the
Clipboard and paste it into the OLE object using the Paste Special dialog box.
笊絶武笊 22.4.2. Using the Pop-up Menu 笊絶武笊
The pop-up menu is available when your cursor is over the OLE component. The
pop-up menu divides into two parts. The first section provides design-time
actions, cut, paste, and create object. The second section lists all OLE object
verbs. The verbs are retrieved from the source application's list of available
verbs.
Tip: The first section of the pop-up menu is available only at design-time.
The second section, the list of OLE verbs, is only available if the OLE
component contains an OLE object.
To activate the pop-up menu by clicking the right mouse button, set the Class,
SourceDoc, and OLETypeAllowed properties using the Property Editor. (Set the
SourceItem property to select a portion of the data.)
The menu items of the first part of the pop-up menu depend on the context of
the OLE object. The following list itemizes possible menu items and when they
are visible.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏enu Item 笏s Visible... 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nsert Object... 笏ll the time. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1aste Special... 笏8hen the clipboard contains an OLE object. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete Embedded 笏8hen OLE component contains an embedded object. 笏
笏0bject 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elete Linked Object笏8hen the OLE component contains a linked object. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reate Embedded 笏8hen the Class property is set to a valid OLE 笏
笏0bject 笏Dlass. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reate Linked Object笏8hen the SourceItem and the SourceDoc properties 笏
笏 笏Bre set to valid values. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 22.4.3. Using the Paste Special dialog 笊絶武笊
When you create an OLE object on your form, VisualAge for Basic immediately
displays the Insert Object dialog. However, to include a specific piece of
data, artwork, or section of a chart, use the Paste Special dialog.
To access the Paste Special dialog:
1. Click the Cancel button to close the Insert Object dialog.
2. Launch the application that contains the data you want to copy to your
application and open the file.
3. Select the data to be transferred to your application and copy the data
to the Clipboard by choosing Edit=> Copy (or the native editing commands)
in the source application.
4. In your VisualAge for Basic project, select the OLE object outline and
click the right mouse button to display a pop-up menu. Your cursor must
remain over the OLE object.
5. After you choose Paste Special from the pop-up menu, the Paste Special
dialog appears displaying the source file and path.
6. Click the Paste Link option to link the data from the Clipboard to your
application.
Important: If you click the the Paste option, VisualAge for Basic embeds
the data in your project.
The Paste Special dialog can display the data as content or as an icon.
VisualAge for Basic displays the source application's icon by default.
7. Click on the Change Icon button to select a different icon for the OLE
object.
笊絶武笊 22.5. Creating Embedded Objects at Design Time 笊絶武笊
You can copy existing file to create an embedded object or you can create a new
embedded object at run time. The new embedded object allows the user to enter
the data using the source application.
Embedded objects display existing data at design time. The visibility of the
data helps you determine how to display the information at run time. However,
embedded OLE objects have a few drawbacks:
They increase the size of an application.
The changes might not be automatically updated. Data contained in an
embedded object is non- persistent-not saved when the parent form is
closed. If the data is modified at run-time and you want to show the
changed data the next time your VisualAge for Basic application opens,
you must program a Save procedure.
See also: Saving Changed Data
Tip: You can also create an embedded OLE object by accessing the Paste
Special dialog with the pop-up menu. Using the Property Editor set the Class,
SourceDoc, and OLETypeAllowed properties. After these properties are set, you
can click the right mouse button to activate the pop-up menu and select Create
Embedded Object.
When you create an OLE object on your form, VisualAge for Basic immediately
displays the Insert Object dialog.
1. Click the Create From File option to insert an existing file.
2. Either type the path and the file name directly, or click the Browse
button to locate the desired file.
3. Set and accept all the parameters to display the embedded data in the OLE
object.
The embedded file, with its source application, displays on your screen.
4. To create an empty embedded object, select the Create New menu option.
VisualAge for Basic creates an empty embedded object containing a
reference to the source application format.
Some source applications insert default data when an object is created or are
not OLE-aware. The pop-up menu reflects the list of verbs available from the
source application. If the OLE object is not OLE-aware, the OLE object
packages the information.
To launch the source application, select the Activate Contents Package
command. Select Edit Package() to activate a package-editing application to
edit the embedded objects information.
笊絶武笊 22.6. Creating OLE Objects at Run Time 笊絶武笊
You can use code to create linked or embedded OLE objects. You can create an
OLE object at run time by setting the following properties using VisualAge for
Basic code: Class, OLETypeAllowed, SourceDoc, SourceItem, and Action.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lass 笏dentifies the source application. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0LETypeAllowed 笏4ets the type of object. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ourceDoc 笏dentifies the name of the file to link to or the 笏
笏 笏Oame of the data you want copied into an embedded 笏
笏 笏Pbject. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ourceItem 笏4pecifies the data to be linked from the source 笏
笏 笏Eocument. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ction 笏etermines the actions for the object: delete, 笏
笏 笏Vpdate, edit, create, or paste from the Clipboard.笏
笏 笏5he Action property also determines which preset 笏
笏 笏Eialog box to display, for example, the Paste 笏
笏 笏4pecial, or Insert Object dialogs. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
See also: VisualAge for Basic Language Reference Online Help for further
information on these property elements.
Tip: For run-time activation using VisualAge for Basic code, set the Action
property to paste an OLE object from the Clipboard, or to use the Insert Object
and Paste Special dialogs.
笊絶武笊 22.7. Creating Linked Objects At Run Time 笊絶武笊
Before you link an object at run time, the data to be linked must exist.
VisualAge for Basic generates an error if the data does not exist.
To link an object at run time, in your code set the SourceDoc property to
include the complete name and the path to the data. To include only a portion
of the data, set the SourceItem property. To display the linked data in the OLE
object, set the Action property to 1, OLE_CREATE_LINK.
You can access to the source document either by setting the AutoActivate
property or by using the pop-up verb menu.
笊絶武笊 22.8. Creating Embedded Objects At Run Time 笊絶武笊
You can create embedded objects at run time. The objects can either contain
data or be empty objects to be filled in by the user.
Before you create an embedded object, first decide whether you want an empty
OLE object or one containing data.
For an empty embedded object, set the Class property and specify the
source application. Empty objects are useful if you want the user to
import data from different sources.
To include data, set the SourceDoc property. You must include the name
and the path to the data. (VisualAge for Basic ignores the Class property
setting if you use the SourceDoc property.)
After the source application has been selected, set the Action property to
OLE_CREATE_EMBED.
笊絶武笊 22.9. Activating and Editing Objects 笊絶武笊
Both the Action property and the AutoActivate property activate an OLE object.
You can set the AutoActivate property to activate an embedded OLE object
whenever it gets the focus (only for objects that support in-place activation).
Set the AutoActivate property to determine how to activate the OLE object at
run time, for example, double-click or focus. This activates the source
application and allows you to enter the data into your own application. You
display new or changed data in your application by clicking File=>Update in the
source application. The source application is not activated at run time, only
at design time.
See also: VisualAge for Basic Language Reference Online Help for more
information on how to use these properties.
笊絶武笊 22.9.1. Using the Verbs Pop-Up Menu 笊絶武笊
Whenever you create an OLE object, whether embedded or linked, the source
application assigns its action verbs. These action verbs allow you to perform
certain tasks.
To edit an OLE object:
1. Select the OLE object and press the right mouse button.
At design time, the pop-up menu always appears. At run time, the
AutoVerbMenu property controls the visibility of the pop-up menu. The
pop-up menu is a list of action verbs provided by the source application.
2. Select the Edit action verb to edit the OLE object from within your
application.
This is in-place editing.
3. Select the Open action verb to activate the source application activates.
You can edit the OLE object data from the source application.
To allow users to edit and save changed data in an embedded object, you must
write a save procedure.
笊絶武笊 22.10. Saving Changed Data 笊絶武笊
If data contained in an OLE object changes, how it is saved depends on whether
the OLE object is linked or embedded.
If the data is linked, the source application is responsible for the save
procedure. For example, if you select File=> Save As, the source application
creates a new file. The header information linking the OLE object to the source
application remains intact.
An embedded OLE object's changed data is normally lost when the user exits your
application, unless you write a save procedure.
For example, to save data to a binary file you use the FreeFile function to get
a file number. Open a new file in binary mode using the file number. Set the
FileNumber property and set the Action property to save the file. Closing the
file creates a new binary file that you can program to reload and display in
the embedded OLE object.
Sub Form_Load
Dim FileNum
FileNum = FreeFile
Open "UserData.dat" for Binary As FileNum
Ole1.FileNumber = FileNum
Ole1.Action = 11
Close #FileNum
End Sub
笊絶武笊 22.11. Retrieving Saved Data 笊絶武笊
In order for an embedded OLE object to read from a file, you must first create
the file using a save-to-file procedure.
After you have saved to a file, you can display the changed data file in an OLE
object. For example, in a click event procedure you can load a saved file by
coding a load procedure.
For example, to read changed data into an embedded OLE object, get a file
number using the FreeFile function. Open the saved file in binary mode using
the file number. First you set the FileNumber property, and then you set the
Action property to read the file. When you set the Action property, the updated
file data appears.
Sub Form_Load
Dim FileNum
FileNum = FreeFile
Open "UserData.dat" for Binary As FileNum
Ole1.FileNumber = FileNum
Ole1.Action = 12
Close #FileNum
End Sub
笊絶武笊 23. Chapter 17 Stored Procedure OCX Component 笊絶武笊
With VisualAge for Basic you can integrate your programs with other object
systems. This chapter describes:
What is the Stored Procedure OCX component?
What can you do with the Stored Procedure OCX component?
How do you use the Stored Procedure OCX component?
Platform-specific information:
The Stored Procedure OCX component is only available for Windows 95 and
Windows NT.
笊絶武笊 23.1. What Is the Stored Procedure OCX Component? 笊絶武笊
VisualAge for Basic provides the stored procedure OCX component (SP OCX) to
make it easy for you to call stored procedures that you develop and register
with VisualAge for Basic on DB2 servers on OS/2, AIX/6000, Windows 95, and
Windows NT. You can use this component in applications developed with either
VisualAge for Basic or Microsoft Visual Basic 4.0.
The SP OCX component has both properties and methods. Methods are built-in
functions that let you manipulate the SP OCX component and its properties
through code in your application. Properties are values or characteristics that
hold information such as the database alias, database password, and database
user ID.
笊絶武笊 23.2. What Can You Do with the Stored Procedure OCX Component? 笊絶武笊
The Property Page and the Property Editor let you set properties to customize
the SP OCX component at design time. Changes that you make at design time are
saved with your application and are used at run time. At run time, your code
can test and set the properties and call the methods of the component.
The SP OCX provides the following database-related properties that are
available both at design time and run time:
DatabaseAlias
DatabaseUserID
DatabasePassword
DatabaseSPInfo
Use the DatabaseUserID and DatabasePassword to connect to the database
specified in the DatabaseAlias property. At run time, your code can pass
arguments to the stored procedure specified in the DatabaseSPInfo property.
Your application can then use any information returned from the stored
procedure.
See also: How Do You Use the Stored Procedure OCX Component? for a complete
list and an example of each property.
笊絶武笊 23.2.1. Passing Scalar Values to a Stored Procedure 笊絶武笊
The following example calls a scalar stored procedure that returns two
parameters.
1. Build the Salary stored procedure. See the Visual Age for Basic Data
Access Guide.
2. Create a form with two text boxes named TopSalary and Employee, and a
command button named Command1.
3. Drag the SP OCX from the Toolbox to the form and set the database
properties in the Property Editor as follows:
Click on the DatabaseAlias property and select the alias of your
stored procedure. You must select a database alias before you can
specify the DatabaseSPInfo property.
Click on the DatabaseUserID and DatabasePassword properties and
enter your database user ID and password.
Click on the DatabaseSPInfo property and select your stored
procedure from the list. The list includes one line for each stored
procedure specifying the schema, entry point, and parameter data
types.
4. Paste the following code into the declarations section of your new form:
Sub Command1_Click() Dim Salary As Double ' Declare the
first stored ' procedure argument. Dim Employee As String
' Declare the second stored ' procedure argument.
Sp1.Opendb ' Connect to the database.
Sp1.RunTimeTypeCheck=false ' No need to check data types
' for the stored procedure argument. Sp1.Adapter.Call Salary,
Employee ' Call the stored procedure ' and pass
arguments. TopSalary.Text = Salary ' Display the returned value
' of the Salary argument. Employee.Text = Employee '
Display the returned value ' of the Employee argument.
Sp1.Closedb ' Disconnect from the database. End Sub
笊絶武笊 23.2.2. Passing an Array to a Stored Procedure 笊絶武笊
The following example illustrates how to use the SP OCX to call the spstafft
stored procedure, which receives an array, list(), of user-defined data types,
empData.
1. Build the spstafft stored procedure. See the Visual Age for Basic Data
Access Guide.
2. Create a form with a textbox with the name "Rows" and a grid with three
columns with the name "GridList."
3. Drag the SP OCX from the Toolbox to the form and set the database
properties in the Property Editor as follows:
Click on the DatabaseAlias property and select the alias of your
stored procedure. You must select a database alias before you can
specify the DatabaseSPInfo property.
Click on the DatabaseUserID and DatabasePassword properties and
enter your database user ID and password.
Click on the DatabaseSPInfo property and select your stored
procedure from the list. The list includes one line for each stored
procedure specifying the schema, entry point, and parameter data
types.
4. Add a new module, and paste the following spstafft code into the
declarations section:
Type EmpData
eSalary As Double
eId As Integer
eName As String *20
End Type
Declare Function SPArrayEmpData Lib "db2spl.dll" Alias "addr"_
(p() As EmpData) As Long
5. In your client program, code the following:
Sub Command1_Click()
Dim i As Integer
Dim Rows As Long
Dim list() As empData
ReDim list(50)
Sp1.OpenDb
Sp1.NullIndicator(0) = 0 'input/output.
Sp1.NullIndicator (1) = 0 'input/output.
Sp1.RunTimeTypeCheck = True
'Check the data types of arguments.
'Do not pass null indicators
'and sqlca as arguments, since
'the SP OCX handles this automatically.
Sp1.Call SPArrayEmpData(list), rows
Rows.Text = Rows
For i = 0 to Rows -1
GridList.AddItem_
CStr(list(i).eSalary) &Chr$(9) &CStr(list(i).eld)_
&Chr$(9) &(list(i).eName
Next
Sp1.Closedb
End Sub
Include the Declare Function statement in the client program so that you
can use the addr function to return the address of the array of empData.
After the call, you can reference the returned values in both list and
rows.
笊絶武笊 23.3. How Do You Use the Stored Procedure OCX Component? 笊絶武笊
1. First, you must install and configure the SP OCX component. See VisualAge
for Basic Install Information.
2. Add the SP OCX component to your project.
3. To add the SP OCX component to a project in VisualAge for Basic:
a. Select the Extensions category to see the SP OCX Operating System
Adapter (OSA).
b. Select the SP OCX OSA.
c. Select Selected=>Open Component Catalog menu item to open the
Component Catalog.
d. Load the SP OCX class by clicking on the box labeled Stored
Procedure SP OCX to the left of the SP OCX component name and
clicking on the OK button.
4. To add the SP OCX component to a project in Microsoft Visual Basic:
a. Select Tools=>Custom Controls... in the Project Window to display
the Custom Controls window.
b. Scroll down in the list to find a checkbox with the label sp OLE
Control module. Click on this checkbox and then click on the OK
button.
The SP OCX component icon is added to the Toolbox. In VisualAge for
Basic, the Project window component listing automatically displays the SP
OCX component.
5. Select the SP OCX component icon on the Toolbox and drag it onto your
form.
See also: Chapter 3, Using the Toolbox and Visual Objects.
6. Customize the Sp1 component instance by setting properties in the
Property Page or Property Editor.
Select the Windows=>Property Editor menu item from the Project
window.
Click the Property Editor button in the Project window.
Press F4. The Property Editor appears with the Sp1 component
instance properties listed.
7. In the Property Editor, specify the information to call your stored
procedure from the list.
Click on the DatabaseAlias property and select the alias of your
stored procedure. You must select a database alias before you can
specify the DatabaseSPInfo property.
Click on the DatabaseUserID and DatabasePassword properties and
enter your database user ID and database password.
Click on the DatabaseSPInfo property and select your stored
procedure from the list. The list includes one line for each stored
procedure specifying the schema, entry point, and parameter data
types.
8. Call the stored procedure that you selected by setting properties and
calling the methods of Sp1 in an event handler of your form, such as the
click event handler of a command button, as follows:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty or Method 笏xample 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏atabaseAlias 笏4p1.DatabaseAlias = "Sample" 笏4ets the alias of the 笏
笏Qroperty 笏 笏Eatabase where the stored笏
笏 笏 笏Qrocedure has been built.笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏atabaseSPInfo 笏4p1.DatabaseSPInfo = 笏4pecifies the schema, 笏
笏Qroperty 笏"USERID.SPSALARY(DOUBLE,STRING)" 笏Oame, and argument data 笏
笏 笏 笏Uypes of your stored 笏
笏 笏 笏Qrocedure. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏atabaseUserID 笏4p1.DatabaseUserID = "myname" 笏4pecifies a DB2 user ID 笏
笏Qroperty 笏 笏Buthorized to connect to 笏
笏 笏 笏Uhe database. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏atabasePassword 笏4p1.DatabasePassword = "mypassword"笏4pecifies the password 笏
笏Qroperty 笏 笏Gor the user ID in the 笏
笏 笏 笏atabaseUserID. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0penDb method 笏4p1.DatabaseAlias = "sample" 笏onnect to a database. 笏
笏 笏4p1.OpenDb 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3untimeTypeCheck 笏4p1.RuntimeTypeCheck = False 笏o not check the data 笏
笏Qroperty 笏 笏Uypes of the stored 笏
笏 笏 笏Qrocedure arguments. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏IEnv and hDbc 笏4p1.OpenDb Sp2.henv = Sp1.henv 笏onnects to multiple 笏
笏Qroperties 笏4p2.hdbc = Sp1.hdbc 笏Eatabases by copying the 笏
笏 笏 笏IEnv environment handle 笏
笏 笏 笏Bnd the hDbc connection 笏
笏 笏 笏Iandle. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏all method 笏4p1.Adapter.Call num, array 笏4pecifies arrays of 笏
笏 笏4p1.Adapter.Call num, addr 笏Eefault type and 笏
笏 笏(arrayEmp) 笏Vser-defined type. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏bCommit method 笏4p1.DbCommit 笏uarantees completion of 笏
笏 笏 笏Bn entire transaction. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏bRollback method 笏4p1.DbRollback 笏ancels changes to the 笏
笏 笏 笏Eatabase. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏loseDb method 笏4p1.CloseDb 笏isconnects from the 笏
笏 笏 笏Eatabase. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
7. Run your project by pressing the Run button on the Project window, or by
selecting Run from the Run menu.
笊絶武笊 23.4. Sample Stored Procedure OCX project 笊絶武笊
VisualAge for Basic supplies a sample project to demonstrate how to call a
stored procedure using the Stored Procedure OCX (SP OCX). You can modify this
project to call a stored procedure you have built and registered with VisualAge
for Basic.
This sample is in the VisualAge for Basic samples subdirectory under:
samples\sproc\firstapp\firstocx\ocsalary.prj
This sample project assumes you have already built and registered a stored
procedure by the name of spsalary, which works with the STAFF table of the DB2
SAMPLE database.
See also: Visual Age for Basic Data Access Guide to learn how to create the
spsalary stored procedure.
1. In the Project Window, select File=>Open Project and specify the
ocsalary.prj project.
2. Open ocsalary.i and notice the instance of the SP OCX control on the form
named Sp1.
3. Select the Sp1 component instance on the form.
4. Press F4, in the Properties window:
Choose DatabaseAlias and select the database alias where you
registered the spsalary stored procedure.
Choose DatabaseUserID and DatabasePassword to specify your user ID
and password for the database.
5. Open ocsalary.i in the Code Editor and look at the code for the
Command1_Click procedure. This code shows how to call the stored
procedure:
Sub Command1_Click () Dim Salary As Double ' Declare the
first stored ' procedure argument. Dim Employee As
String ' Declare the second stored ' procedure
argument. Sp1.Opendb ' Connect to the database.
Sp1.RunTimeTypeCheck=False ' No need to check data types
' for the stored procedure argument. Sp1.Adapter.Call Salary,
Employee ' Call the stored procedure and ' pass
arguments. TopSalary.Text = Salary ' Display the returned value
of ' the Salary 'argument. Employee.Text =
Employee ' Display the returned value of ' the Employee
argument. Sp1.CloseDB ' Disconnect from the database. End
Sub
This code calls the spsalary stored procedure, which returns two values:
Salary, a variable of Double type, and Employee, a variable of String
type. These values are assigned to the Text properties of text boxes on
the form.
6. Run the project and click on the Run button (Command1). The application
calls the spsalary stored procedure on your server and returns the name
and salary of the highest paid employee in the STAFF table of the SAMPLE
database.
笊絶武笊 24. Chapter 18 Using OpenDoc Documents 笊絶武笊
VisualAge for Basic lets you link to OpenDoc documents, which can contain one
or more OpenDoc parts. This section describes:
What is OpenDoc?
What you can do with OpenDoc in VisualAge for Basic
How to acquire the prerequisite OpenDoc software
Important: OpenDoc support is included in the VisualAge for Basic for OS/2
client only.
笊絶武笊 24.1. What is OpenDoc? 笊絶武笊
OpenDoc is an architecture and a set of technologies that let you develop
applications or objects by assembling pluggable software components. Just like
you can assemble a stereo by combining a speaker from one vendor, CD player
from another, and an amplifier from a third vendor, with OpenDoc you can
assemble a software construct, called a compound document, by combining parts
from multiple vendors.
An OpenDoc part consists of data and one or more part editors. OpenDoc parts
are stored in OpenDoc documents. A part editor manipulates the data. A clock
part might have one editor that lets you change the time on the clock and the
background clock face. Another clock part editor might let you set the clock's
overall shape to round or square.
You could think of a compound document as a container of "live" (active and
editable) parts. For example, let's look at an application that includes a
page layout feature, which in turn contains some text and a running stock
market ticker tape.
Now imagine that each of these "features" can be edited in place with its own
custom menus. Each of the features is really a "live" OpenDoc part that can be
edited with its own part editor.
The OpenDoc architecture describes the rules that let parts interoperate and
even collaborate in compound documents. OpenDoc also defines a way to work
cooperatively with Microsoft's OLE, through a part of the architecture called
Open Link and Embedding of Objects (OLEO).
OpenDoc and OLE both define compound document architectures. However, OLE is
defined and implemented by a single vendor (Microsoft) and OpenDoc is developed
by a consortium of vendors called Component Integration Laboratories, Inc. (CI
Labs).
CI Labs provides a standard that shows all software vendors how to develop
distributed objects that will "play" nicely together. CI Labs was founded in
1993 by IBM, Apple, Novell, Oracle, Taligent, SunSoft, WordPerfect, and Xerox.
OpenDoc is being implemented for the various Windows platforms, OS/2, AIX, and
Mac OS.
Last but not least, the OpenDoc technologies are implemented on the CORBA
compliant Object Request Broker, SOM. Therefore OpenDoc is based on an open,
industrial-strength architecture.
See also: Chapter 15, Integrating System Object Model (SOM) Objects.
笊絶武笊 24.2. What You Can Do with OpenDoc in VisualAge for Basic 笊絶武笊
Although VisualAge for Basic Release 1 is not an implementation of a compound
document, you can incorporate OpenDoc documents in your VisualAge for Basic
applications using the OpenDoc container component
in the Toolbox.
You drag the OpenDoc icon to a form and then specify the OpenDoc document you
want to link to. The document is active and you can edit it. Let's see how
this works.
笊絶武笊 24.2.1. Using OpenDoc: A Scenario 笊絶武笊
Important: You must have the OpenDoc Runtime installed on your OS/2 client to
complete this scenario. See Acquiring the OpenDoc Software. After you have
installed the the OpenDoc Runtime, you will see three new folders added to your
desktop:
OpenDoc for OS/2
OpenDoc Templates
Shell Plug Ins
The parts you use in this scenario are in the OpenDoc Templates folder. In
this scenario, you:
1. Create an OpenDoc document, outside of the VisualAge for Basic
environment.
2. Link to the document from a VisualAge for Basic form.
3. While still in a VisualAge for Basic session, you open the document into
the OpenDoc environment for editing.
4. Do some editing in the OpenDoc environment to get the feel for the
OpenDoc session.
5. Go back to VisualAge for Basic to resume designing your form.
笊絶武笊 24.2.1.1. Creating an OpenDoc Document 笊絶武笊
1. Open the OpenDoc Templates folder.
2. Click with the right mouse button on the Page Layout part. Hold the
button and drag the Page Layout part to the desktop. This creates a
instance of the Page Layout part you can use for creating your document.
3. Double-click on the Page Layout part that you placed on your desktop. The
part is opened in an OpenDoc document in the OpenDoc environment. We
will explore this environment further below, but for now, let's continue
to build the OpenDoc document.
4. From the OpenDoc Templates folder, drag a Text part and drop it onto the
OpenDoc document. Now your OpenDoc document has a root part, the Page
Layout part, which in turn contains one additional one part, the Text
part.
5. Click in the area where you dropped the Text part to make it the active
part.
6. Type some text into the Text part. For example, type OpenDoc is Fun!
7. Select Document=>Save a copy. The Save A Copy dialog appears.
Specify a file name and path and click on OK.
8. Double-click on the system icon in the upper left corner of the menu bar
to close the OpenDoc environment.
Now you have an OpenDoc document you can use to add to a VisualAge for Basic
form.
笊絶武笊 24.2.1.2. Adding an OpenDoc document to a VisualAge for Basic Application 笊絶武笊
1. In VisualAge for Basic, create a new form.
2. Drag the OpenDoc Container icon from the Toolbox to the form. The OpenDoc
Document Selection dialog appears.
3. Select the name of the OpenDoc document you created earlier and click on
OK.
4. Click with the right mouse button on the OpenDoc Container on your form.
A pop-up menu appears.
5. Click on Open. The page layout document opens in the OpenDoc environment.
You can now edit it.
笊絶武笊 24.2.1.3. Editing in the OpenDoc Environment 笊絶武笊
Important: The terms and behavior described in this section apply while you
are in the OpenDoc environment only--not in VisualAge for Basic. For more
information on working in the OpenDoc environment click on Using OpenDoc in the
OpenDoc for OS/2 folder.
To move the Text Part in OpenDoc:
1. Click with the left mouse button on the Text part. A hashed border
appears. The Text part is said to be activated. The border is called the
activation border. Notice also that the menu has changed to the Text
part's part editor menu.
2. Click on the activation border. The Text part background turns black.
The part is said to be selected and you can now move it and size it.
3. Click with the right mouse button on the Text part. Hold the button and
drag the part to some empty place on the the Page Layout part. Notice
that if you attempt to move the text part to the extreme left edge of the
Page Layout part, that the Page Layout part forces the text back inside
the margin.
To size the Text Part part in OpenDoc:
4. Click with the left mouse button on the Text part.
5. Click on the activation border.
6. Grab one of the sizing handles and stretch or shrink the text part.
Notice that the part editor will not allow you to shrink the part smaller than
the actual size of the text. That is the defined behavior for this part
editor.
To add more parts to the OpenDoc document:
1. From the OpenDoc Templates folder, drag a second Text part to the page
layout document.
2. Type some text into the second part. For example, type
We've only just begun to see the power of OpenDoc!
3. Double-click on the system icon in the upper left corner of the menu bar
to close the OpenDoc edit session.
Now you are back in the VisualAge for Basic environment.
笊絶武笊 24.2.1.4. Resuming Your Work in VisualAge for Basic 笊絶武笊
Add a command button to the form called Push Me. Add a label under the OpenDoc
Container. Your form should look similar to this.
Tip: The sizing handles for the OpenDoc document may not be visible but they
are still active. Just click on the OpenDoc object and stretch it as you
normally would. You have completed the simple scenario for using OpenDoc in
VisualAge for Basic applications. See the OS/2 Warp Toolkit and Club OpenDoc
on the World Wide Web for additional parts you can use to create your own
OpenDoc documents.
For additional VisualAge for Basic samples, see \samples in the directory in
which you installed VisualAge for Basic.
Finally, for more information on specific OpenDoc tasks in VisualAge for
Basic, see the VisualAge for Basic online task help.
笊絶武笊 24.3. Acquiring the OpenDoc Software 笊絶武笊
To use the VisualAge for Basic OpenDoc support, you must have OpenDoc Runtime
for OS/2 Warp installed on your system. The Runtime is free and is available
through the World Wide Web or the IBM Developer Connection for OS/2 CD ROM.
After you install the OpenDoc Runtime, restart VisualAge for Basic for OS/2.
Important: For release 1, OpenDoc support is included in the VisualAge for
Basic for OS/2 client only.
To download the OpenDoc software:
1. Point your World Wide Web browser to the Club OpenDoc homepage:
http://www.software.ibm.com/clubopendoc/
2. Download the OpenDoc Runtime.
3. Follow the instructions that come with the package.
For more information on OpenDoc see: The Club OpenDoc homepage:
http://www.software.ibm.com/clubopendoc/
The CI Labs home page:
http://www.cil.org/
The IBM Object Technology home page:
http://www.torolab.ibm.com/objects/
The Essential Distributed Objects Survival Guide, by Orfali, Harkey, and
Edwards, 1996, John Wiley & Sons, Inc.
IBM International Technical Support Centers (Redbook) OpenDoc: An
Introduction to Part Development, SG24-4673-00. Call 1-800-445-9269 or
e-mail:
bookshop at dk.ibm.com.
Personal Systems Magazine, March/April 1996 issue on SOM Technology: Making
the Pieces Fit. Free to IBM customers. Fax your request to (817) 962-7218 or
request it from the World Wide Web
http://pscc.dfw.ibm.com/psmag/
The IBM Developer Connection Volume 10, OpenDoc Developer Toolkit for OS/2,
which includes the OpenDoc Programming Guide, Programming Reference, User
Interface Guidelines, and Open Scripting Architecture and Reference.
笊絶武笊 24.3.1. Usage Tips 笊絶武笊
This section provides tips on how to use Opendoc.
笊絶武笊 24.3.1.1. Rexx Version 笊絶武笊
The OpenDoc Runtime includes a new version of Rexx. If you have Rexx execs on
your system, they may behave differently after you install the OpenDoc Runtime.
You can easily revert to your earlier version of Rexx by disabling the new
version.
1. Edit your config.sys file, using the OS/2 system editor.
2. Delete the references to OREXX from the PATH, LIBPATH, and DPATH
statements. For example, if your PATH statement looks like this:
SET PATH=C:\IBMCOM;C:\OREXX:D:\OTHER
Change it to:
SET PATH=C:\IBMCOM;D:\OTHER
3. Reboot your system.
笊絶武笊 24.3.1.2. OpenDoc Parts 笊絶武笊
The VisualAge for Basic OpenDoc Component does not directly support the Open
Scripting Arhitecture. OpenDoc parts written to exploit Open Scripting
Architecture, as well as some other parts, may not work well as root parts of
documents linked to VisualAge for Basic. You may still be able to use the part
by using the following technique:
1. Create an OpenDoc document whose root part is an OpenDoc container part.
Options include the Page Layout part used in the scenario above, or the
Container part, available as part of the Warp Toolkit.
2. Place the part you want to use in this OpenDoc document.
3. Link the document to your VisualAge for Basic form.
Usually this technique is sufficient to enable the part for usage with
VisualAge for Basic.
笊絶武笊 25. Chapter 19 Calling DLL Procedures 笊絶武笊
DLLs are libraries of procedures that applications can link to and use at run
time rather than embedding multiple procedures at compile time. You can specify
a DLL in the Property Editor or in the Code Editor to link procedures to your
application at run time. This chapter describes how to call procedures stored
in dynamic link libraries (DLLs) from VisualAge for Basic.
You should use DLLs to:
Take advantage of commercial libraries.
Increase performance on time-consuming algorithms.
Access system resources.
In this chapter you will learn how to:
Access and use DLLs.
Call DLLs from the Code Editor.
Call DLLs from the Property Editor.
笊絶武笊 25.1. Why Use DLLs? 笊絶武笊
You use DLLs to increase your application's performance. Using an existing DLL
from within VisualAge for Basic requires less programming experience than
creating a new DLL. You use DLLs to access features not available within
VisualAge for Basic, to control low-level aspects of the operating system, to
internationalize your application, or to improve performance.
笊絶武笊 25.1.1. Accessing Commercial Libraries 笊絶武笊
If you were designing a tax form application with the ability to file the tax
return electronically, you would need procedures to control a modem. You could
write these procedures yourself, or you could access an existing third-party
DLL. This not only saves you programming time, but should speed your testing
and debugging time as well.
For your tax form application you might access the following:
A DLL to control a modem.
A DLL with specialized fonts.
A DLL with tax-specific math calculations.
笊絶武笊 25.1.2. Controlling the Operating System 笊絶武笊
In order to use some aspects of your operating system, you must invoke
procedures within DLLs shipped with the operating system (for example,
kernel95.dll for Windows NT and Windows 95 and doscalls.dll for OS/2.).
笊絶武笊 25.1.3. Internationalizing your Application 笊絶武笊
You can internationalize your application by creating resource files compiled
into a DLL. These resource files can contain translatable error message
strings, menu names, and any other end-user information.
笊絶武笊 25.1.4. Improving Performance 笊絶武笊
If your application contains algorithms that are extremely
computation-intensive, you can improve the speed of your application. You can
rewrite the algorithms in another language and compile them into a DLL.
笊絶武笊 25.2. Where Do You Find DLLs? 笊絶武笊
A DLL must be in a directory accessible to your VisualAge for Basic application
at run time.
In a Windows NT or Windows 95 operating environment: DLLs must be in one of the
following locations:
In the current working directory.
In the installation_drive\installation_directory\bin directory.
In a directory listed in the PATH environment variable.
In the system directory.
In an OS/2 operating environment: DLLs must be in one of the following
locations:
In the current working directory.
In a directory listed in the LIBPATH environment variable set in the
config.sys file
Tip: Every DLL has its own set of requirements. Before referencing an
external DLL, refer to its documentation.
笊絶武笊 25.3. How Do You Use DLLs? 笊絶武笊
You can use the Property Editor or the Code Editor to access a DLL. You use DLL
procedures in your VisualAge for Basic application by declaring the procedure
and augmenting it with the DLL name. The DLL loads when you first reference it
at run time.
When you declare a DLL, you are telling your application that you need the
DLL's information. When your application refers to the DLL at run time, active
memory stores a copy of the DLL for future use with your application. The
memory clears itself after your application exits.
Tip: An error is generated if you try to access an undeclared procedure. When
you declare your DLL, you must decide whether it should be public or private,
and whether it should be a sub or function procedure.
Where you declare the DLL procedure in your application determines whether it
is private or public. Declaring a DLL procedure in a form module makes it
private to that form. Declaring a DLL procedure in a code module makes it
public to your entire application.
A sub procedure declares a procedure that does not return a value:
A function procedure declares a procedure that returns a value. You can specify
the data type returned by the function using a type-declaration character, or
with a final As type clause.
笊絶武笊 25.4. Declaring a DLL Procedure in the Code Editor 笊絶武笊
To declare a DLL procedure, go to the Declarations section of the Code Editor.
Use the Declare statement to call DLL as sub or function procedures.
Declare Function ProcedureName Lib "LibraryName" (Arg1 As
Type) As Type
See also: VisualAge for Basic Language Reference Online Help, Declare
Statement.
Tip: Enter the DLL procedure as a single logical line in the Code window
[General] [Declarations] sections.
笊絶武笊 25.4.1. Specifying the Library 笊絶武笊
To specify the location of the DLL procedure, use the Lib LibraryName
attribute.
Declare Function ProcedureName Lib "LibraryName" (Arg1 As
Type) As Type
You define the variables as follows:
Lib is a VisualAge for Basic keyword and identifies that the next
argument is the name of the DLL.
LibraryName is the string argument specifying the path to the DLL
containing the procedure. The full path is essential if the DLL does not
reside in your operating system's default path or the current directory.
In Windows NT and Windows 95: You must specify the full path if the DLL
does not reside in the current directory of a directory listed in the
PATH enviroment variable.
In OS/2: You do not need to specify the full path, but the DLL must be
located in the current directory, or one listed in the LIBPATH
environment variable.
笊絶武笊 25.4.2. Passing Arguments 笊絶武笊
The data types can either be expressed with a type-declaration character (%, &,
!, #, @, $), or by using the As type clause. Valid data types are: Integer,
Long, Single, Double, Currency, String (variable-length only), Variant, Any,
User-Defined Type, and Class Type. You must delimit multiple arguments with
commas. For example:
Declare Function ProcedureName Lib "LibraryName" FirstVariable As
Long,_
SecondVariable%, ThirdVariable As Any
See also: VisualAge for Basic Language Reference Online Help, Data Types
Tip: Arguments are passed by reference or by value. When you pass a variable
by reference, you pass a pointer to that variable. When you pass a variable by
value, you pass the actual current value of that variable, as stored in the DLL
procedure. The following table shows the data types and whether they can pass
by reference or by value.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ata Type 笏1assed by Reference 笏1assed by Value 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nteger 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ong 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ingle 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ouble 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏urrency 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tring 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rray 笏Y 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ull Pointers 笏Y 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6ser-Defined 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7ariant 笏Y 笏Y 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ny 笏Y 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lass 笏Y 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
By default, VisualAge for Basic passes arguments by reference. However, some
routines expect the value of an argument instead of a reference. To pass an
argument to the called procedure by value, use the ByVal keyword, with the
following syntax:
Declare Function ProcedureName Lib "LibraryName" (ByVal FirstArg1
As Long)_
(ByVal As SecondArg%) As Type
If the procedure passes the numeric argument by value, it converts the argument
to the data type indicated in the Declare statement. For example, if a Declare
statement argument declares a Long data type, an Integer automatically converts
to a Long data format before it is passed.
Not all DLL procedures support all the different VisualAge for Basic data
types. When passing arguments to a DLL, some of the data types are not
compatible. The ByVal keyword converts between the VisualAge for Basic data
type and the DLL procedure data type. Depending on the DLL specifications, the
DLL could accept strings, arrays, user-defined data types, and null pointers.
The individual elements of a user-defined data type pass by value like any
other variable. However, to pass an entire user-defined data type as an
argument, you must pass it by reference.
笊絶武笊 25.4.3. Overriding Type Checking 笊絶武笊
You can use the As Any parameter to override data type checking for an
argument. The Any data type is useful for procedures that accept more than one
type for the same argument. It has the following syntax:
Declare Function ProcedureName Lib "LibraryName" FirstVariable As
Long,_
SecondVariable%, ThirdVariable As Any
When you use the Any data type, the argument passes only by reference.
笊絶武笊 25.4.4. Defining an Alias for a Procedure 笊絶武笊
Procedure names must follow VisualAge for Basic naming conventions. If the DLL
procedure has names with illegal characters or reserved words, you can use the
Alias keyword.
You use the Alias keyword after the Lib keyword. It indicates that the
procedure goes by another name in the DLL, for example:
Declare Sub Transportation Lib "Police " Alias "RCMP"
'Transportation is also referred to as
'RCMP in the Police.DLL.
Some DLLs identify procedures by an ordinal position-some DLLs only have
ordinal numbers. Using ordinal numbers saves memory in your application and is
faster than referencing the DLL's procedures by name. You obtain ordinal
numbers by consulting the DLL's documentation. To specify the ordinal number,
place it after the Alias keyword, and always put a pound sign (#) before the
number.
Declare Sub Transportation Lib "Police " Alias "#10"
'Transportation is labeled or has an
'identification number of 10 in Police.DLL.
笊絶武笊 25.5. Example of Declaring an External Function 笊絶武笊
The following example works in Windows 95, Windows NT, and OS/2. It uses a DB2
Call Level Interface (CLI) DLL to set an environment variable. For OS/2, set
CLILIB = db2cli.dll, and for Windows NT and Windows 95, set CLILIB=db2cliw.dll.
Important: To run this example, you must have the DB2 Client Application
Enabler (CAE) installed.
' This example assumes you have installed the DB2 Client Application
' Enabler (CAE)
Const CLILIB = "db2cli.lib" ' For OS/2:
db2cli.dll
' For Windows NT and Windows 95: db2cliw.dll
Declare Function SQLAllocEnv Lib CLILIB (ByVal henv As Long,_
phdbc As Long) As Integer
Declare Function SQLSetEnvAttr Lib CLILIB (ByVal henv As Long,_
ByVal Attribute As Long, ByVal Value As Any,_
ByVal StringLength As Long)As Integer
Declare Function SQLFreeEnv Lib CLILIB(ByVal henv As Long) As Integer
Sub main()
On Error Goto smainErr
Dim henv As Long ' Environment handle
Dim rc As Integer ' Return codes
Dim output_nts As Long
output_nts = SQL_FALSE
rc = SQLAllocEnv(henv) ' Allocate an environment handle
If (rc = SQL_SUCCESS) Then
SQLSetEnvAttr(henv, SQL_ATTR_OUTPUT_NTS, output_nts, 0)
If (rc = SQL_SUCCESS) Then
MsgBox "Environment attribute successfully set"
Else
MsgBox "Environment attribute not set"
End If
Else
MsgBox "Environment not allocated"
End If
rc = SQLFreeEnv(henv)
Exit Sub
smainErr:
MsgBox "Error " & Err & ": " & Error$(Err) & " in seteattr"
Resume Next
End Sub
笊絶武笊 25.6. Windows NT and Windows 95: Example of Declaring an External Function 笊絶武笊
The following example declares an external function in the Windows Kernel DLL
to obtain a string value corresponding to the name of the Windows directory.
The As Integer portion of the function declaration refers to the return format
for error codes.
Declare Function GetWindowsDirectoryA Lib "Kernel32" (ByVal WDir$,_.br
ByVal Size&) As Long
Sub Form_Click ()
Private OK 'Declare Variables
Private Msg
Private WDir$, Size%
WDir$ = String$(255, 0) 'Initialize
Windows Directory String
OK = GetWindowsDirectory(WDir$, Len(WDir$))
If OK Then 'No Error occurred
Msg = "The Windows Directory is: " & WDir$
Else 'If Error occurred
Msg = "Error. Failed to get the Windows Directory."
End If
MsgBox Msg 'Pop up Message
End Sub
笊絶武笊 25.7. Calling a DLL Procedure in the Code Editor 笊絶武笊
You call a DLL procedure in the same manner as any other statement or function.
You can use the Call statement to switch to a DLL procedure.
See also: VisualAge for Basic Language Reference Online Help, Call Statement.
Tip: Values exchanged between VisualAge for Basic and DLL procedures are not
verified. The data passed to a DLL is not protected and could cause undefined
behavior.
You can pass Call statement arguments by reference or by value. A DLL procedure
can alter the value of arguments passed by reference but does not alter
arguments passed by value. The value arguments are assigned a temporary
address. To pass arguments by value, enclose them in brackets or declare them
using the ByVal keyword.
笊絶武笊 25.8. Example of Using the Call Statement with a DLL Function 笊絶武笊
The following example declares a DLL sub procedure. It demonstrates two ways to
call the SetDoubleClickTime in the DLL library User DLL to set the double-click
interval.
Declare Function SetDoubleClickTime Lib "User32" (ByVal N As Long) As
Integer
Return "Error Message" `If not compatible.
Private Flag 'Declare global interval
Sub Command1_Click ()
Private Msg
If Not Flag Then 'Set DblClick interval by call
'statement
Call SetDoubleClickTime(2000)
Msg = "The double-click interval is 2000 msec now"
Flag = True
Else
SetDoubleClickTime 500 'Set DblClick interval without call
Msg = "The double-click interval is 500 msec now"
Flag = False
End If
MsgBox Msg & Chr(10) & "Double-click on Form1 to test"
'Display Message
End Sub
Sub Form_DblClick ()
MsgBox "Double Click" 'Pop Up Message Dialog
End Sub
Sub Form_Load ()
Command1.Caption = "Change Interval"
Flag = False
End Sub
Sub Form_Unload (Cancel As Integer)
Call SetDoubleClickTime(0) 'Reset to the normal time
End Sub
笊絶武笊 25.9. Calling a DLL Procedure in the Property Editor 笊絶武笊
This example uses the Property Editor to access the first variable, called
String, for a custom DLL named GetMessageString:
1. Declare GetMessageString in the Code Editor declaration section.
Declare Function GetMessageString As String
2. Change Label1's Caption property to Expression mode. Highlight the
Caption property, and choose Selected=> Expression.
An E (for Expression) is displayed to the left of the word Caption.
3. Type GetMessageString(1) in the Caption's text area.
The string in GetMessageString, String1 variable loads.
See also: Chapter 4, Using the Property Editor, Displaying Property Values by
Constant or Expression.
笊絶武笊 25.10. Passing Data Between a DLL and Your Application 笊絶武笊
Some data types require special handling when passing data between your
application and a DLL. This section describes the special handling for Strings,
Arrays, Array Elements, User-Defined Types, Null Pointers, Properties, and
Function results.
笊絶武笊 25.10.1. Passing and Receiving String Arguments (Null-Terminated) 笊絶武笊
String data types are always passed by reference. Most DLL procedures expect
standard C-language strings ending with a null character. To convert a
VisualAge for Basic string, use the ByVal keyword. This keyword does not pass
the string by value, but converts it to a null-terminated string and passes the
address.
If the DLL modifies the string, the modified string is converted back into
VisualAge for Basic format before writing to the original location (where it
was called in your application).
Some DLL procedures take a string buffer as an argument and use it to return a
string. When you pass a string buffer, make sure there is sufficient buffer
space allocated for insertion of returned data. If you do not allocate
sufficient space the behavior is undefined.
Use one of the following methods to make sure that sufficient space is
available:
Set the length of the string using the Str or Space function. When the
DLL returns the string argument, the null-terminated string replaces the
filler characters, for example:
S$ = Space$(25)
Passing S$ as a parameter passes the address of a string containing 25
characters plus one for the ASCII Null character.
Define the string as fixed length using the Private statement, for
example:
Private FixedString As String*50
This example defines FixedString as private to that module and returns it
as a string containing 50 characters plus one for the ASCII Null
character.
笊絶武笊 25.10.2. Passing Arrays and Array Elements 笊絶武笊
A procedure passes an array by passing the first element by reference. Some
arrays have specific data structures that are not compatible with certain DLL
procedures. For example, the handling of multi-dimensional arrays depends on
the DLL.
Consult the DLL's documentation to verify acceptable data structures and the
maximum size of an array for each DLL.
笊絶武笊 25.10.3. Passing User-Defined Types 笊絶武笊
A procedure passes the address of the user-defined type argument when passing
by references. Pass the individual elements of a user-defined type in the same
way you would pass ordinary variables.
Consult the DLL's documentation to verify acceptable data types when passing
user-defined types.
See also: Chapter 9, Working with Data and Object Variables for more
information on user-defined types.
笊絶武笊 25.10.4. Passing Null Pointers 笊絶武笊
Use the null pointer format when you want to pass the address zero (0). For
example, if you declare the arguments As String, passing a zero-length string
("") indicates a pointer to a null string, not a null pointer.
To pass a null pointer as an argument, declare the argument As Any and pass the
expression using ByVal 0
The ByVal keyword ensures that the routine gets a null pointer instead of
a pointer to zero.
The type-declaration character (&) after the zero (0) specifies the bit
size of the null pointer (Long).
See also: VisualAge for Basic Language Reference Online Help, Appendix B,
Data Types.
笊絶武笊 25.10.5. Passing Properties 笊絶武笊
You can use a property argument as a variable, to set or get a single value.
You pass a property using the ByVal keyword.
Tip: You can pass function results in the same manner as you pass property
values. The following example uses the hWnd property. By declaring a handle
argument (window identification number) with ByVal Integer in the Declare
statement, you can pass it directly to a DLL procedure.
Declare Function ProcedureName Lib "LibraryName"
(ByVal hWnd As Integer)_ As Integer
Usually you do not pass properties by reference but it can be done with a bit
of data manipulation. First you assign the property to a variable, and then
pass the variable by reference.
The following example assigns the value of the window handle (window
identification number) to a variable. You can then use the variable in an event
procedure to manipulate the window:
Dim variablex 'Define the variable.
variablex = hWnd 'Assign the value of the hWnd (window
'handle) property to the variable.
Declare Function ProcedureName Lib "LibraryName"
(variablex As Integer)_ As Integer
笊絶武笊 25.11. Building Your Own DLLs 笊絶武笊
You can build DLLs several ways. For example, you can hard-code messages in the
DLL or use the Windows NT or Windows 95 resource support function and link a
resource file (.rc) to your DLL.
笊絶武笊 25.11.1. Creating a Hardcoded DLL 笊絶武笊
This example shows a hard-coded GetMessageString procedure in a DLL:
_ _declspec(dllexport) char * GetMessageString (Int msgID)
{
Switch(msgID){
Case 1:
Return "String1"; 'First variation of String.
Case 2:
Return "String2"; 'Second variation of String.
Case 3:
Return "String3"; 'Third variation of String.
Default:
Break
}
Return "ErrorMsg1"; 'If none of the above works,
'return an Error Message.
}
笊絶武笊 25.11.2. Creating a DLL Using a Linked Resource File 笊絶武笊
This example shows a GetMessageString procedure in a DLL using a linked
resource file:
_ _declspec(dllexport) char * GetMessageString (Int msgID)
{
Return GetStringTable(msgID).br
'Calls your custom resource file, .br
'GetStringTable pointing to a specific.br
'data message, msgID.
}
Windows NT and Windows 95: To compile your file contain your C source code
using the Visual C++, the command line to build the DLL is as follows:
cl /LD yourSourceFilename.c
OS/2: To compile the file containing your C source code using IBM VisualAge
C++, use the following command lines to build the DLL:
icc -Ge -c switch.c
ilink /nofree /PM:VIO /STACK:64400
switch.obj,switch.dll,switch.map,switch.def
The contents of switch.def, which is needed for the link step, should be:
LIBRARY SWITCH
EXPORTS
funcname
where funcname is the function name defined in switch.c. This name is also the
function name used in the Declare statement in VisualAge for Basic.
笊絶武笊 26. Part 4 Advanced Techniques 笊絶武笊
笊絶武笊 27. Chapter 20 Improving Performance 笊絶武笊
In this chapter you will learn techniques to make your application smaller and
to run faster. When reading this chapter remember: compact, fast applications
may take up less memory but there are some draw backs. A compact application
could be harder to maintain and debug. Also, some modes of compacting the
application could cause your application to run slower. This chapter provides
you with information on how to produce an application with the proper balance
of compactness and speed. It contains the following sections:
Starting your application
Using data types and variables
Using language elements
Using objects
Using constants
Using DLLs
Using SOM objects
This chapter does not attempt to recommend any one technique or method as each
application is different. The following discussion describes alternatives and
tradeoffs.
笊絶武笊 27.1. Starting Your Application 笊絶武笊
The way your application first appears to the user must be interactive, fast,
and professional. The easiest way for user interaction is to provide a status
indicator. This is a simple method showing the user that your application is in
the loading process.
You can create a simple status indicator using a splash screen (a form with a
graphic), or a simple dialog (an About screen). By assigning the mousepointer
in the startup form's Form_Load event, you call the operating system's busy
indicator. Each operating system automatically uses its custom Busy
mousepointer.
Your first form should contain a minimal amount of components. The more
components on a form, the longer the display time.
How you load your forms also affects the visual impact of your application.
Preloading and then hiding the forms at startup increases the form's display
during run time. This however, slows the installation speed. Not loading the
forms until the user invokes them increases the installation time but slows the
user interaction process.
笊絶武笊 27.2. Using Data Types and Variables 笊絶武笊
The VisualAge for Basic data types perform calculations and translations at
different speeds. Integer and Long data types are the fastest data types best
used for representing Boolean values and storing whole numbers.
Tip: On Windows NT, Windows 95, and OS/2, the Long data type is faster than
the Integer data type. On AIX, the Integer data type is faster than the Long
data type.
The Currency data type is the slowest data type, excluding Variant, for
performing mathematical calculations. However, the Variant data type, though
slow, has the greatest flexibility. Limit the use of the Variant data type as
it uses more stack space than other data types.
In your code, if you refer to the value of a property or a function, it is
faster to assign the value to a variable and refer to the variable. It is even
faster if the variable is defined as an Integer or Long data type, for example:
Dim PropertyValue As Integer
Dim FunctionReturnValue As Long
笊絶武笊 27.3. Using Language Elements 笊絶武笊
Different language elements affect either the run-time memory or the start up
time of your application. The is a quick look at how some elements affect your
application.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏anguage Elements 笏4et to... 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏lipControls 笏alse 笏3educes the amount of work and time to 笏
笏Qroperty 笏 笏Sepaint controls. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏utoRedraw property 笏alse 笏6se the Paint event instead to refresh 笏
笏 笏 笏Hraphics that change frequently. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏5rue 笏6se only for graphics that do not need 笏
笏 笏 笏Donstant updating. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4how and Hide 笏 笏4how a basic startup form in the Load 笏
笏Nethods 笏 笏Fvent while other forms are loading. Set笏
笏 笏 笏Uhe other forms to Hide until the user 笏
笏 笏 笏Oeeds them. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6nload event 笏 笏6nload forms when no longer needed to 笏
笏 笏 笏Gree memory. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏mage property 笏 笏6se the Cls method and set AutoRedraw to笏
笏 笏 笏alse to free memory when graphicis no 笏
笏 笏 笏Monger needed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1icture property 笏 笏f the graphic is not longer required 笏
笏 笏 笏Tet the property to Nothing to remove 笏
笏 笏 笏Hraphic and free memory. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏orm objects 笏 笏oad only if needed or frequently 笏
笏 笏 笏Dalled. Unload if no longer needed. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommon Components 笏 笏6se arrays instead of many individual 笏
笏 笏 笏Domponents. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4hapes and Lines 笏 笏6se only with simple graphics. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏mage and Picture 笏 笏6se Image to display simple 笏
笏ox 笏 笏Oon-interactive graphics that do not 笏
笏 笏 笏Sequire the resources of a picture box. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏abels and Text 笏 笏abels use less memory than text boxes. 笏
笏oxes 笏 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 27.4. Using Objects 笊絶武笊
When you use OLE objects, you enhance the look and feel of your application
without excessive programming effort on your part. However, how and when you
use an OLE object does affect the speed and size of your finished application.
Your application's executable file contains all data, including data contained
within an OLE object. The executable file size depends on when you create the
OLE object. If you insert the OLE object at design time, the executable file is
larger than if you create the OLE object at run time.
When you include an OLE object in your application, you slow down the processor
regardless of when you create the OLE object. For example, if you create an OLE
object in the Form_Load event procedure, all processing suspends to create the
OLE object. Processing speed reduces because the object must exist before the
form displays.
Refer to objects as specific objects rather than as generic objects. Specific
objects resolve references to the properties and methods at compilation time
instead of run time. To ensure recognition of specific object types, declare
objects as they appear in the Project window.
笊絶武笊 27.5. Using Constants 笊絶武笊
Using constants listed in the constant.bas file allows your application to run
faster and makes it easier to maintain. You can refer to the constants by
number or by a corresponding name.
Tip: To improve your code's readability, refer to an OLE object's action by
name or symbolic constant.
笊絶武笊 27.6. Using DLLs 笊絶武笊
You use DLLs to increase your application's performance. Using an existing DLL
from within VisualAge for Basic requires less programming experience than
creating a new DLL. If your application contains algorithms that are extremely
computation-intensive, you can improve the speed of your application. You can
rewrite the algorithms in another language and compile them into a DLL.
笊絶武笊 27.7. Using SOM objects 笊絶武笊
The VWADDSOM environment variable specifies that VisualAge for Basic loads the
SOM OSA at startup. If you do not plan to use SOM objects, you can improve the
performance of both VisualAge for Basic and of your generated executables by
removing the VWADDSOM environment variable.
笊絶武笊 28. Chapter 21 Cross-Platform Development 笊絶武笊
When building applications for cross-platform environments your goal is to
build a Graphical User Interface (GUI) that is polished, style-guide compliant,
and tightly integrated with the native environment.
You application should:
Have a style, look, and feel that matches users' expectations.
Comply with style guides. Consistent GUIs make users more productive and
reduce training and support costs.
Use the facilities provided by the native platform to interact both with
the environment and with other applications.
How can you do this without compromising your requirements or sacrificing
features? You have to choose the right approach to cross-platform development.
笊絶武笊 28.1. Naming Conventions 笊絶武笊
One of the cross-platform development issues is the naming of your files. Each
platform has its own set of rules. Some of the cross-platform file constraints
are:
Length of the file name
Length and format of the file extension
Case sensitivity
Use of special characters or wildcards
笊絶武笊 28.2. Cross-Platform Issues 笊絶武笊
You need to consider how you will move your project between platforms and keep
the interface consistent with both the original project interface and the
native platform interface:
Convert features that are obvious and standard per platform. For example,
some platforms use File=>Quit, and some use File=>Exit to end their
applications.
Match the general look and feel for each platform. Command buttons and
option buttons should look like the target platforms; however, sizes
should match those of the original application.
When you import a project created on Windows to OS/2, the Windows fonts
might not map to a usable font on OS/2. You should change the name of
the fonts to those available on OS/2. VisualAge for Basic accesses the
current operating system fonts when you create an application. You set
VisualAge for Basic fonts using the instpref.ini file.
See also: Modifying the instpref.ini File. For more information on fonts, see
Font Restrictions on OS/2
Do not assume more than one mouse button when mapping mouse buttons.
Each operating system has their own native File List, Drive, and
Directory List Boxes. References to these components give focus to the
platform's native dialog box.
Reference graphics in your application, do not embed them. Each operating
system supports a specific set of graphic formats.
笊絶武笊 28.2.1. Platform-Specific Elements 笊絶武笊
The VisualAge for Basic Language Reference describes all elements of the
VisualAge for Basic language. Some of the elements contain features, such as
file name format or wildcard behavior, that are specific to certain platforms.
Platform-specific features are listed under the heading Platform Specific under
applicable language elements. Supported platforms are AIX, OS/2, and Microsoft
Windows NT and Windows 95.
Use only those language elements and features supported on the operating system
on which your VisualAge for Basic application will run. For example, use drive
letters in your program only if it will run on OS/2, Windows 95, and Windows
NT, not if it will run on AIX.
Each language element summary lists the components applicable to that element.
The following components are specific to the Microsoft Windows NT and Windows
95 platforms:
Data
OLE
Restriction: References to these components are ignored if the project is
compiled for a platform other than Microsoft Windows NT or Windows 95.
笊絶武笊 28.2.1.1. Font Restrictions on OS/2 笊絶武笊
The following restrictions apply to fonts on VisualAge for Basic on OS/2:
Mnemonics that you entere via the Caption property for certain components
(for example the Check Box, Command Button, Option Button, and Label
components) do not appear underlined if you do not have Fixpack 17
installed on OS/2 Warp. If you do not have Fixpack 17 installed, choose
a font such as Helv (not Helvetica) and ensure that the FontBold property
is set to False.
If you use a bitmapped font (for example System Proportional) as the
FontName for components, other properties such as FoldBold, FontItalic,
FontStrikethru, FontUnderline, and different font sizes only work if that
bitmapped font is available with the selected attributes. For example,
selecting a 48.00 point size for a System Proportional font might not
give you the desired font if a 48.00 point version of this font is not
available.
笊絶武笊 28.2.1.2. Caption Property Restriction on OS/2 笊絶武笊
In VisualAge for Basic for Windows NT and Windows 95, you can assign mnemonics
to the Frame or Label component via the Caption property, to give focus to the
next component in the tab order. This function is not available in OS/2.
笊絶武笊 28.3. Taking an Application-Oriented Approach 笊絶武笊
VisualAge for Basic takes an application-oriented approach to cross-platform
development. It starts at the top, with the applications' GUI, not at the
bottom with the native user interface features.
In VisualAge for Basic you decompose an application by identifying the key
abstractions in its GUI, such as a financial stock-trading object. The goal is
to identify and define the application-level or reusable objects that make up
an application's GUI.
By taking an application-oriented approach, you put off having the decide on
how to implement a portable GUI. You tackle this question only when you have
identified the reusable classes of GUI objects in your application. The
advantage is that you start by focusing on reusability, not on the
implementation details.
The following list summarizes the VisualAge for Basic approach to
cross-platform development:
Identify and define the classes of GUI objects in your application.
Implement the GUI objects on the target operating systems.
Integrate the GUI objects with VisualAge for Basic.
Build your GUI in VisualAge for Basic.
Use VisualAge for Basic to generate the portable interface code.
Move the generated code to the target operating system.
Compile and link the generated code with the platform-specific
implementation of the GUI objects.
Test the final product on all supported operating systems.
笊絶武笊 28.4. Defining Classes of GUI Objects 笊絶武笊
In VisualAge for Basic, when you define classes of GUI objects, and use them to
build your GUIs, you separate interface code from implementation code. The
interface code uses only the public interface of a GUI object. VisualAge for
Basic encapsulates (hides) the implementation details within the GUI object.
This means you can build portable GUIs and still use native controls.
Application-level GUI objects can have different implementations on different
operating systems. You can have OS/2- style interfaces on OS/2 platforms and
Windows-style interfaces on Windows platforms.
Building on native controls makes it easy to follow the native style guides.
Not only do your interfaces have the right look and feel on each operating
system, but they integrate well with the native environment:
The user gets the proper visual feedback when performing drag-and-drop
operations, because GUI objects use the native drag-and-drop mechanism.
When the user changes the overall color scheme, it applies to the GUI
objects.
Internationalization is handled properly. Because GUI objects are based
on the native operating system, they can use the input mechanism provided
by a system (for example, Japanese systems provide a Kanji input
mechanism).
笊絶武笊 28.5. Fine-Tuning Cross-Platform GUIs 笊絶武笊
Different operating systems have different characteristics, so it does not
always make sense to implement a GUI object in exactly the same way. One of the
benefits of the cross-platform approach is that you can change the
implementation to suit the operating system.
The level of abstraction is a measure of how the GUI object corresponds to
actual environment elements. On one operating system you might implement a GUI
objects as a combination of environment elements, while on another you might
use a single environment element.
For example, suppose you want to build a large, portable dialog that contains a
file selection area. Each operating system has a unique style for accessing
files. Windows NT, Windows 95, and OS/2 platforms have a file list box, but
you cannot use it as part of another dialog. You have to build the file
selection area out of individual controls (a file list box, a directory list
box, and a text box).
Because its implementation is hidden, you can fine-tune the dialog to the
capabilities of the target operating system. This allows you to provide the
behavior expected by the user. For example, the Windows NT, Windows 95, and
OS/2 operating systems support the DOS wildcards.
笊絶武笊 28.6. Adding Third-Party Objects 笊絶武笊
Few applications consist solely of the components that come with a platform's
native environment. Many use third-party objects and Windows controls as an
important part of the GUIs.
VisualAge for Basic was designed with this in mind. Unlike emulation features
and least-common denominator approaches, VisualAge for Basic makes it easy to
build portable GUIs using third-party objects.
Both third-party objects and class libraries can be integrated and encapsulated
in GUI object classes. After you have a GUI object class for a third-party
object, you can put an instance of the class (the GUI object) in the Toolbox
and start using it. Your generated interface code will be portable, as long as
the implementation of the object on the target operating system offers the same
interface.
笊絶武笊 29. Chapter 22 Preparing Your Application for Release 笊絶武笊
This chapter describes how to prepare your application for distribution to its
end-users, as follows:
Create an executable file from your project window.
Identify files your end-users will need in addition to the executable
files and DLLs.
Attach a help file to your application.
In addition, a section describes the files and products that are required in
the end-user's environment.
笊絶武笊 29.1. Creating an Executable 笊絶武笊
You create an application executable from the project window, which displays
the forms, modules, and any VisualAge for Basic custom components in its
outline area. The outline area provides a good overall description of the
elements of your application.
Create the executable on the platform you want your application to run on; the
stand-alone executable file is not portable. To create multiple-platform
applications, build each executable on its native platform.
To create an executable file:
In the Project window, follow these steps:
1. Select File=>Build Executable from Project window.
2. Enter any legal file name.
3. Select OK.
VisualAge for Basic creates the executable file with an .exe extension.
笊絶武笊 29.2. Identifying Additional Files 笊絶武笊
This section helps you identify certain files-files that your end-users need in
addition to the executable file and the standard set of DLLs for your platform.
If your application refers to external DLLs or custom controls, you must
distribute them to your users.
笊絶武笊 29.2.1. Including Graphics 笊絶武笊
If your application contains graphics loaded at design time, save and load the
graphics with the form. Such graphics are included in the executable.
If you use the LoadPicture function to load graphics in your application,
however, they are not included in your executable. Distribute these graphics
files to your users.
笊絶武笊 29.2.2. Using OpenDoc Documents 笊絶武笊
If your application contains OpenDoc documents, the executable file does not
incorporate those documents. Distribute these OpenDoc documents to your users.
笊絶武笊 29.2.3. Using OLE Objects 笊絶武笊
If your application contains OLE objects, the executable file incorporates the
associated data. If your application links to OLE objects, however, you need to
distribute those objects to your users.
笊絶武笊 29.3. Attaching Help to Your Executable 笊絶武笊
VisualAge for Basic provides an easy way to attach help to your applications.
Besides simply attaching a help file (.hlp) to your application as a whole, you
can point to specific help topics to provide context- sensitive help to your
users.
You request context-sensitive help by pressing F1 when a particular component
or menu item has focus. This type of help makes your application more user
friendly and enables a user to find exactly the type of information they need.
For example, if a user requested help while an entry field has focus, they
probably want information on the possible values they could enter. They
wouldn't want to be given a table of contents to search for this information.
This section covers the following topics:
Creating the help file
Attaching the help file to your application
Creating context-sensitive help links to specific help topics
笊絶武笊 29.3.1. Creating the Help file 笊絶武笊
There are many factors to take into consideration when you are planning your
help system, such as identifying your audience, the type of information you
need to provide, etc. However, this chapter only addresses what you need to do
in order to build a help file that works with an application created with
VisualAge for Basic.
笊絶武笊 29.3.1.1. Windows NT and Windows 95 Considerations 笊絶武笊
Typically, a Windows help file defines each topic with a unique context string.
You then map this string to a numerical constant that the application code uses
to identify a help topic. Thus, when you build your help system, you need to
identify each topic with a context string, such as IDH_CONTENTS.
After you have defined all the topics within the help system with a unique
context string, you should define numerical constants that correspond to each
context string. You can choose these numbers arbitrarily, but after you select
them, they should not be changed.
The best place to include these mappings is in the Form.Load event for the
startup form. For example, to define a constant for IDH_CONTENTS, code the
following:
Sub Form_Load ()
Const IDH_CONTENTS = 1000
...
End Sub
For Windows NT and Windows 95 applications, you also need to create header
files that contain the mapping for each context string. You include these files
in the help build by specifying them in the [MAP] section of the help project
file (.hpj).
For example, to map the context string IDH_CONTENTS to the constant 1000, put
the following line in a header file that is specified in the [MAP] section:
#define IDH_CONTENTS 1000
When you create a help file for OS/2 using IPF, you identify each topic with a
unique resource ID (res attribute) that must be numeric (1-64000). It helps to
create some kind of numbering sequence to help you identify the various
sections of your help file.
Tip: You cannot use the name or id attributes of a heading tag to identify a
topic in a help file.
You do not need to create a header file that maps these resource IDs to context
strings like you would in Windows. However, it can be helpful to define a
string constant for each resource ID and use this constant to refer to a help
topic from within the application. This technique lets you change the numeric
order of your help file without needing to change the code.
The best place to define these string constants is in the Form.Load event for
the startup form. For example, if you have a help topic with 1000 as its
resource ID, you could define the constant IDH_CONTENTS to equal 1000:
Sub Form_Load ()
Const IDH_CONTENTS = 1000
...
End Sub
笊絶武笊 29.3.2. Attaching the Help File 笊絶武笊
The first step to attach context-sensitive help to your application is to
specify the name of the associated help file. The name of the help file is
stored in the options file and is used every time the application is run.
笊絶武笊 29.3.2.1. To specify the name of the application help file: 笊絶武笊
1. Select Options=>Project from the Project window menu. The Project options
window appears.
2. Enter the name of your help file (with .hlp extension) in the Application
Help File entry field.
3. Click on OK.
The help file is now associated with your application. All of the help topics
within the help file can be referenced directly from your application.
Tip: Only one help file can be active at a time. However, you can override
the default application help file using the HelpFile property of the App
object. When you specify a new application help file, it remains active until
you reset the HelpFile property or quit the application.
笊絶武笊 29.3.3. Creating a Context-Sensitive Help Link 笊絶武笊
After you have built your help file and associated it with your application,
all that is left is to create context-sensitive links to your application. You
create a context-sensitive link by setting the HelpContextId property for an
object.
笊絶武笊 29.3.3.1. To associate a help topic with an object: 笊絶武笊
1. Select the component that you want to associate with a help topic.
2. Select Windows=>Property Editor from the Project window menu. The
Property Editor appears.
3. Set the HelpContextID property to the context string or numerical
constant for the desired help topic.
4. Close the Property Editor.
笊絶武笊 30. Part 5. Appendixes 笊絶武笊
笊絶武笊 31. Appendix A Customizing VisualAge for Basic 笊絶武笊
You can install the VisualAge for Basic client on Windows NT, Windows 95, and
OS/2 and install the VisualAge for Basic server on Windows NT,Windows 95, OS/2,
and AIX/6000. You can run the VisualAge for Basic client and VisualAge for
Basic server on different platforms or on the same machine.
In this chapter you will learn how to configure VisualAge for Basic for both
clients and servers.
笊絶武笊 31.1. Customizing VisualAge for Basic Interfaces 笊絶武笊
This section describes how VisualAge for Basic interfaces can be tailored to
your needs. You can customize the Toolbox, Project window, Property Editor, and
Code Editor.
VisualAge for Basic installs with preset settings that you cannot change. It
also has installation settings that you can modify, which are identified in the
instpref.ini file.
Important: Any change to the .ini file requires that you restart VisualAge for
Basic to invoke the changes.
You set the installation configuration toggles in the instpref.ini file to
control color, font display, and visibility. VisualAge for Basic searches for
the instpref.ini file in the following directories and in the following order:
1. Current directory - the directory where you start VisualAge for Basic.
2. Windows NT and Windows 95 only: $HOME or root directory ().
3. $VWDIR variable to point to the location of the .ini file.
You should make a copy of the instpref.ini file, so that you can edit and save
your version locally. This is especially true for VisualAge for Basic
installed on a network where each workstation can run a customized version of
VisualAge for Basic.
VisualAge for Basic looks for interface attribute settings first in the .ini
file by interface, then by system setting. If the attribute is not set in the
.ini file, VisualAge for Basic then defaults to the operating system setting.
笊絶武笊 31.1.1. Modifying the instpref.ini File 笊絶武笊
\config\instpref.ini file using any text editor.
Tip: You must make changes exactly as shown. VisualAge for Basic ignores an
incorrect setting in the .ini file and does not generate an error message.
There are three types of settings:
Boolean - requiring a True or False value
String - requiring a character-string
Int - requiring an integer value
Separate compound attribute names with a dot (.) operator. For example:
Size.Width=1595
MaxSize.Size.Height=2010
Color.Red=132
Background.Color.Blue=255
SelectedForeground.Color.Green=196
EditComponents.Font.FontName=helvetica
CommandComponents.Font.Italic=FALSE
Each attribute setting has its own list of possible values. For example:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ttribute 笏eywords 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7iew (Toolbox, 笏7isible 笏1osition 笏
笏1roject window, 笏 笏 笏
笏1roperty Editor, 笏 笏 笏
笏ode Editor) 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ize 笏inSize 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏axSize 笏ackground 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oreground 笏ont 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏enu 笏5oolbar 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ustomization 笏4tatusText=String 笏elpContext=Integer 笏
笏(MenuItem, Toolbar 笏 笏 笏
笏tem) 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏elpFile=String 笏rayed=Boolean 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nabled=Boolean 笏nvokedFile=String 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏nvokedFunction=String 笏1osition.Size.[Height | 笏
笏 笏 笏8idth].[X | Y]=Integer 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏enu Editor 笏5oolBar.[EnabledPicture=Integer | 笏 笏
笏 笏nabledPictureFile=String | 笏 笏
笏 笏rayedPicture=Integer | 笏 笏
笏 笏rayedPictureFile=String] 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏enuItem 笏aption=String 笏nemonic=String 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏ccelerator=String 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏pplication 笏itmapsDir=String 笏ackground.Color.[RGB] = 笏
笏 笏 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏allStackSize=Integer 笏oreground.Color.[RGB] = 笏
笏 笏 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏reationMode=String 笏ibraryName=String 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏ir=String 笏oadLibrary=Boolean 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏elpDir=String 笏essCatalog=String 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏elpFile=String 笏4ystemConfiguration=String 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 笏 笏6ndoStackSize=Integer 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 31.1.1.1. Customizing the Interface View 笊絶武笊
You can customize the Background, Foreground, FontSize, FontName, and the style
of the font for areas of the Toolbox, Project window, Property Editor, and Code
Editor.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0ption 笏4election 笏ata Type 笏efault 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ackground / 笏0 to 255 笏nteger 笏4ystem 笏
笏oreground 笏 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont selection - 笏5rue or False 笏oolean 笏4ystem 笏
笏old, Italic, 笏 笏 笏 笏
笏4trikeThru, 笏 笏 笏 笏
笏6nderline 笏 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont selection - 笏ny font style 笏4tring 笏4ystem 笏
笏ontName 笏Durrently available 笏 笏 笏
笏 笏Pn the operating 笏 笏 笏
笏 笏Tystem. 笏 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont selection - 笏1 to 2048 笏nteger 笏4ystem 笏
笏4ize 笏 笏 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: When checking attributes, VisualAge for Basic first checks the.ini file
under the [Interface] heading, then the [Application] heading, and last the
operating system setting.
VisualAge for Basic's interfaces are divided into function groups to help you
globally set the font and background colors.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏roup 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ditComponents 笏ncludes all editable components. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4electComponents 笏ncludes all selectable components. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ommandComponents 笏ncludes all action buttons. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏llComponents 笏llows you to globally set all interfaces. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
This example shows the instpref.ini Global Application view settings.
[Application]
EditComponents.Background.Red=196
EditComponents.Background.Green=196
EditComponents.Background.Blue=196
EditComponents.Font.Size=12 'Font attributes that are not
EditComponents.Font.FontName=Courier 'set in the .ini reference the
EditComponents.Font.Bold=TRUE 'factory settings for a value.
EditComponents.Font.Italic=TRUE
EditComponents.Font.StrikeThru=FALSE
The Background and Foreground values set the foreground and background colors.
The colors are set using a Red, Green, and Blue (RGB) value. Omitting one of
the colors does not cause an error; however it does create a different color.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏xamples 笏escription 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ackground.Red=# 笏# = Integer value, containing no spaces between 0 笏
笏 笏Bnd 255. If the numbers for Red, Green, Blue are 笏
笏 笏Tet to 255, 0, 0 respectively, so that the 笏
笏 笏Cackground is pure red. A combination of different笏
笏 笏Oumbers for each # gives various colors. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ackground.Green=# 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ackground.Blue=# 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.Bold=boolean 笏abels appear bold. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.Italics=boolean 笏abels appear italic. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.StrikeThru=boolean 笏abels appear with a line drawn through them. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.Underline=boolean 笏abels appear with an underline. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.FontName=string 笏ame of a fontstyle, for example, Arial, Script, 笏
笏 笏5imesNewRoman, Courier 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ont.Size=# 笏7alue between 1 and 2048 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
This example shows the instpref.ini Interface view settings.
[ToolPalette]
Background.Red=196
Background.Green=196
Background.Blue=196
Foreground.Red=0
Foreground.Green=198
Foreground.Blue=225
Font.Size=12
Font.FontName=Courier
Font.Bold=TRUE
Font.Italic=TRUE
Font.StrikeThru=FALSE
Font.Underline=FALSE
You can use the attributes in [ToolPalette] for the [ApplicationWindow],
[PropertyEditor], and [CodeWindow].
笊絶武笊 31.1.1.2. Code Editor Customization 笊絶武笊
In the .ini file, a section for the Code Editor appears as [CodeWindow]. You
can use the same View Customization font and color characteristics for
VisualAge for Basic keywords. You assign the font and color properties as
follows:
FullKeywordName.Font.Italic=True
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏eyword Name 笏xample 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏enericIdentifier 笏rackets placed after a subroutine name, such as 笏
笏 笏4ub Command1_Click(). 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tandardKeyword 笏4um, Dim, End Sub. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dvancedKeyword 笏lass, Property, read-only, write-only, Public, 笏
笏 笏1rivate. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tring 笏haracters or words appearing between " " such as 笏
笏 笏sgBox "This is a string." 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nteger 笏ny integer value. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏loat 笏ny floating point value. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0ctal 笏ny octal value. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ex 笏ny hexadecimal value 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏dentifier 笏ain, all subroutine names, all Object names, all 笏
笏 笏vent names, and all Method names 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0perator 笏ll mathematical symbols such as =, *, /, +, -, 笏
笏 笏Bnd all logical symbols such as & 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
To set the highlight colors, change the SelectedBackground and
SelectedForeground values. When you highlight a section of code the foreground
(the characters) or the background changes color to the set color. The values
are the same as for the ForeGround and BackGround.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0ption 笏4election 笏efault 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4electedBackground / 笏nteger between 0 and 255笏4ystem 笏
笏4electedForeground 笏 笏 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: Specific settings take precedence over general settings. For example, if
the Code Window Background is white, and the StandardKeyword Background is red,
the background area surrounding the StandardKeyword is red.
This example shows the instpref.ini Code Editor keyword settings.
[CodeWindow]
GenericIdentifier.Font.Italic=TRUE
StandardKeyword.Background.Color.Blue=196
AdvancedKeyword.FontName=Courier
String.Font.Bold=TRUE
Integer.Foreground.Green=255
Float.Font.Italic=FALSE
Octal.Font.Size=12
Hex.Font.Size=9
Identifier.Font.FontName=Helvetica
Operator.Font.StrikThru=TRUE
笊絶武笊 31.1.1.3. Toolbox Customization 笊絶武笊
In the .ini file, a section for the Toolbox appears as [ToolPalette]. You can
customize how the Toolbox appears when starting VisualAge for Basic.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0ption 笏4elections 笏omments 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0rientation 笏4tring 笏0rientation=Vertical makes the Toolbox 笏
笏 笏 笏Bppear vertically. 笏
笏 笏 笏0rientation=Horizontal makes the Toolbox笏
笏 笏 笏Bppear horizontally. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7iewMode 笏4tring 笏7iewMode=IconAndLabel makes the toolbox 笏
笏 笏 笏Bppear with icons and labels. 笏
笏 笏 笏7iewMode=IconOnly makes the toolbox 笏
笏 笏 笏Bppear with icons only. 笏
笏 笏 笏7iewMode=LabelOnly makes the toolbox 笏
笏 笏 笏Bppear with labels only. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
You can modify Toolbox settings at run time using the Project window
View=>Toolbox menu. Exiting VisualAge for Basic destroys all run-time settings.
This example shows the instpref.ini Toolbox settings:
[ToolPalette]
Orientation=Vertical
ViewMode=IconOnly
笊絶武笊 31.1.1.4. Application Customization 笊絶武笊
The Undo/Redo stack depth sets the number of times actions can be undone or
redone in a project. Set the stack size under [Application] in the .ini file.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0ption 笏ata Type 笏efault 笏omments 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6ndoStackSize 笏nteger 笏10 笏6ndoStackSize=# For example, a value of笏
笏 笏 笏 笏5 limits Edit=>Undo to five actions and 笏
笏 笏 笏 笏dit=>Redo. to five actions. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏allStackSize 笏nteger 笏10 笏allStackSize=15 Sets the number of 笏
笏 笏 笏 笏Eisplayable items in the Inspector Call 笏
笏 笏 笏 笏4tack combo box. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏reationMode 笏4tring 笏ontrolArray笏reationMode=AskUser - User 笏
笏 笏 笏 笏Donfirmation. CreationMode=ControlArray 笏
笏 笏 笏 笏- No warning. 笏
笏 笏 笏 笏reationMode=IndividualControl - Group 笏
笏 笏 笏 笏Dreated from Toolbox. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
This example shows the instpref.ini Application settings.
[Application]
UndoStackSize=5
CallStackSize=8
CreationMode=AskUser
CreationMode=ControlArray
CreationMode=IndividualControl
笊絶武笊 31.1.1.5. Interpreter Customization 笊絶武笊
In the .ini file, a section for the Interpreter appears as [Interpreter]. You
can customize the Variable Declaration, Compatibility, String Comparison, Array
Base, and Type Check options.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏0ption 笏ata Type 笏omments 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7ariableDeclaration 笏4tring 笏"Explicit" includes an Option Explicit 笏
笏 笏 笏Ttatement at the beginning of every 笏
笏 笏 笏Gorm..br"Implicit" does not include an 笏
笏 笏 笏0ption Explicit statement. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ompatibility 笏4tring 笏"Strict" applies strict compatibility 笏
笏 笏 笏Xith Visual Basic rules when loading a 笏
笏 笏 笏7isual Basic** application. "Relax" does笏
笏 笏 笏Oot apply strict compatibility rules. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tringComparison 笏4tring 笏ompare=Text compares only text strings.笏
笏 笏 笏ompare=Binary compares only binary 笏
笏 笏 笏Ttrings. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rrayBase 笏4tring 笏ase=1 starts array counting at 1. 笏
笏 笏 笏ase=0 starts array counting at 0. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5ypeCheck 笏4tring 笏5ypeCheck=Strict checks the syntax as 笏
笏 笏 笏Fach line of code is entered. 笏
笏 笏 笏5ypeCheck=Relax checks the syntax only 笏
笏 笏 笏Xhen asked. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
This example shows the instpref.ini Interpreter settings.
[Interpreter]
VariableDeclaration=Explicit
Compatibility=Relax
StringComparison=Text
ArrayBase.Base=0
TypeCheck=Relax
笊絶武笊 31.1.1.6. Grid Customization 笊絶武笊
In the .ini file, a section for the Grid appears as [Grid]. The Grid refers to
an array of dots that appear on VisualAge for Basic forms. The Grid is only
visible when selecting an object from the Toolbox and placing it on the form,
or when dragging objects on a form.
You can display a visible Grid on forms to assist in the placement of
components. You can control the size and visibility of these gridlines. The
grid is useful in drawing and placing components as they are created, and in
moving and resizing them afterwards.
If you want the horizontal and vertical grid lines to be visible, set the
Visible property to True. To change the grid size, type new values in the
Height and Width text fields. These values measure the distance in twips
between the grid lines.
笏娯楳笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏1roperty 笏4elections笏ata Type 笏efault 笏omments 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏Y Active 笏5rue/False笏oolean 笏4ystem 笏ctive=TRUE makes the object align with 笏
笏 笏 笏 笏 笏Uhe dots when placing new objects on the笏
笏 笏 笏 笏 笏Gorm or when moving the object around. 笏
笏 笏 笏 笏 笏ctive=FALSE allows the placement of an 笏
笏 笏 笏 笏 笏Pbject anywhere on the form. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4ize 笏45 to 1485笏nteger 笏5 pixels 笏4ize.Width=Int and Size.Height=Int set 笏
笏 笏5wips 笏 笏 笏Uhe vertical and horizontal spacing 笏
笏 笏 笏 笏 笏Cetween the dots. 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏7isible 笏5rue/False笏oolean 笏5rue 笏7isible=TRUE makes the Grid visible. 笏
笏 笏 笏 笏 笏7isible=FALSE makes the Grid invisible. 笏
笏披楳笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 31.1.1.6.1. Definition: A Twip is a unit of measure that represents 1/20th of a point (derived from the phrase 笊絶武笊
TWentieth of an Inch Point). There are 72 points in an inch, 1440 twips in an
inch, or 567 twips in a centimeter. Twips are used as a measurement system
which is independent of screen resolution.
This example shows the instpref.ini Grid settings.
[Grid]
Active=TRUE
Size.Width=80
Size.Height=80
Visible=FALSE
笊絶武笊 32. Appendix B Migrating Microsoft Visual Basic**Programs 笊絶武笊
This section contains information to help you understand VisualAge for Basic if
you are a Microsoft Visual Basic** (VB) user. It provides help to migrate your
code from VB to VisualAge for Basic.
What are the Differences? begins with an overall look at the differences in
capabilities.
Differences in the Interfaces lists the differences between the two interfaces.
Loading Visual Basic Projects into VisualAge for Basic describes how to load,
convert, and save existing .MAK files.
笊絶武笊 32.1. What are the Differences? 笊絶武笊
This section provides an overview of the differences between VisualAge for
Basic and Microsoft Visual Basic. They include:
Visual Basic is only available for the Microsoft Windows operating
system. Versions of VisualAge for Basic exist for several operating
systems, including Microsoft Windows, OS/2, and AIX.
The VisualAge for Basic language is compatible with Visual Basic.
However, VisualAge for Basic contains a number of unique statements and
functions as well.
Visual Basic uses proprietary "custom controls" as application elements.
VisualAge for Basic's components are classes from which you can derive
subclasses.
Visual Basic does not allow you to define or derive classes. VisualAge
for Basic lets you define new non-visual classes. In addition, you can
use VisualAge for Basic to derive from existing visual component classes.
Derivation can be done interactively or using VisualAge for Basic
statements.
VisualAge for Basic assigns the extension .i to new forms. VisualAge for
Basic also recognizes forms assigned the extension .frm by Visual Basic.
Visual Basic assigns the extension .mak to project files. VisualAge for
Basic assigns the extension .prj to project files.
VisualAge for Basic's debugging facilities are contained in the Inspector
and the Watchpoints and Breakpoints window. You use these tools to set
breakpoints and watchpoints, examine the call stack, and change the
values of variables using the Immediate window.
VisualAge for Basic lets you incorporate the following into your
applications:
- Visual or non-visual C++ objects
- SOM objects
- OLE objects
- Native GUI controls
- OpenDoc components and OCXs
笊絶武笊 32.2. Differences in the Interfaces 笊絶武笊
The Project Window
Allows you to view your complete project outline.
The Component Catalog
Allows you to add new objects to your project.
Provides developers a wide choice of enterprise object systems they want
to include objects from: OLE; SOM; or others through third-party
add-ons. This capability, unique to Visual Age for Basic, means that you
can integrate and reuse virtually any enterprise object in your Visual
Age for Basic applications.
The Toolbox
Can be reshaped to suit your preference.
The Toolbox provides some additional convenient ways to create objects
beyond what VB provides.
Interactive Operations
Provide a full multi-level UNDO/REDO capability for all operations,
including graphical moving and resizing.
Provide the ability to resize more than one object at a time.
Provide the ability to drag objects to change their parent.
The Property Editor provides a menu of options to choose from when
editing properties.
The View menu on Visual Age for Basic's property editor lets you specify
which properties you want to display.
Provide a drop-down combo box that appears on each Property Editor row
when you have selected more than one control, and the value of the
particular property is different for each control. VB simply shows an
empty row.
Provide the ability to put a Basic language expression directly in the
Property Editor row. Think of it as object.property = {whatever you
type}. Visual Age for Basic allows dynamic initial values. These
expressions get evaluated only when you run the program.
Provide the ability to create a control array from the Property Editor by
selecting a number of the same type controls, and then changing their
names to all be the same.
The Code and Debug Windows
Provides multiple views of your code using a split window feature.
Provides bookmarking features to stop and view your code for debugging.
The VisualAge for Basic Language
VisualAge for Basic is very similar to VB's Basic language, with some notable
extensions. The most important is the Object data type.
The Object data type can store instances (objects) of classes imported from
external systems such as SOM and OLE. An API allows you to package C++ classes
for use within VisualAge for Basic, allowing them to be manipulated using the
Object data type as well. You can use VisualAge for Basic statements to
declare subclasses of existing visual or non-visual classes, regardless of
their source. You can also use VisualAge for Basic to declare non-visual
classes.
You see any enterprise object (VisualAge for Basic, SOM, OLE, C++, etc.) as a
Basic object, and you can create new classes of objects that reuse existing
implementations through a feature called inheritance. VisualAge for Basic
supports a powerful version of inheritance called multiple inheritance, whose
prime benefit is that you can reuse and combine the broadest range of
implementations. With multiple inheritance you gain all the properties and
methods of the objects without having to rewrite any code, while changing
whatever you need.
笊絶武笊 32.3. Loading Visual Basic Projects into VisualAge for Basic 笊絶武笊
Tip: If you are porting a project to a different operating system, ensure that
the rules for file and directory names reflect those on the new operating
system.
1. Open Visual Basic and load your .MAK project.
2. Select File=> Save File As menu option to save the forms as text files.
3. When the Save File As dialog box appears, select the Save As Text
selection box. An X appears in the box as confirmation of text selection.
4. Ensure all the project files are saved in a directory available to
VisualAge for Basic.
5. Open VisualAge for Basic.
6. Select File=> Open Project menu option to load the Visual Basic .MAK
project file.
A warning appears.
7. Select OK.
If the project contains VBXs, another warning appears. The VBX's are
ignored by VisualAge for Basic and are automatically replaced by native
components. For example, the OLE and the Grid VBX are replaced by the OLE
and the Grid components.
8. Select OK.
Where there is no native VBX replacement, follow the VBX manufacturer's
instructions for migrating from VBX to OCX.
9. Select File=>Save Project As and rename your .prj file.
After an .MAK is saved to .prj file, the project format is no longer
recognized by Visual Basic.
笊絶武笊 33. Appendix C Internationalization 笊絶武笊
One of the first things to ask yourself as you design your application is
"Where is this application going to be used?" If your application is not
intended for global use, you do not have to consider internationalization.
However, to make your application available to the global market-you must
design with internationalization in mind.
Internationalization is the process of generalizing programs for a variety of
languages, layouts, and character sets. An international application:
Displays labels and messages in a different language for each locale.
Adapts to locales and easily translates without loss of content or
meaning.
Ports between languages or locales with respect to window design, code,
and error messages.
Definition: A locale is a place or locality with its own language, idioms, and
window design.
Important: You must think in terms of internationalization at the onset of
application development.
To develop an international application, you can either build separate
executables for each locale, or you can use the same executable and use
message catalogs to store internationalized messages.
Tip: A modular approach facilitates the addition of new languages and locales
at a later date.
This chapter provides tips on:
How to design an international application.
How to create an international message catalog.
International language elements.
What to watch out for when internationalizing your application.
笊絶武笊 33.1. Designing an International Application 笊絶武笊
Designing an international application requires a bit of planning. How are you
going to internationalize your application? How are you going to split up the
modules?
Your application needs to determine the locale by querying the user or the
operating system using the operating system's setlocal API. Your application
uses the returned value to set the path to the correct language DLLs or message
catalogs.
See also: The SDK setlocal API for each operating system.
Important: If your application uses the Like operator with strings or regular
expressions, you must include instrng.dll. If your application contains
references to run-time error messages, you must include the appropriate
VisualAge for Basic language DLL containing the error messages.
Design your application to provide for size and layout changes of data for
different locales. You can design complete form modules for each locale and
save each form as a project. This has its advantages in that all labels and
text fields will be the exact size and position that you specify. However, the
size of your code will increase.
Alternatively, you can program your labels and text areas to access their
properties at installation, depending on a locale selection switch (determined
by the setlocale API returned value). This technique requires only one form,
but increases installation time.
Tip: Create different modules of text that need translation and save them
separate from your application. These modules could include such information as
locale-specific menu names, mnemonics, or error messages.
As you see, designing an international application requires a bit of planning.
Some other points to consider when designing your international application are:
Making your text easy to translate.
Accessing locale-specific formats.
Using pictures instead of words.
笊絶武笊 33.1.1. Making Your Text Easy To Translate 笊絶武笊
For your user messages:
Use brief, simple sentences.
Use affirmative statements-they are easier to translate.
Use active voice.
Use simple vocabulary-no idioms or jargon.
Allow for expansion space-translated text tends to grow in size.
Tip: Remember scanning directions when designing your dialog boxes and the
order of your menu selections. The scanning or tabbing direction should match
the input direction.
笊絶武笊 33.1.2. Locale-Specific Formats 笊絶武笊
You do not have to code data formats in your applications, because many
locale-specific formatting applications display the correct format at
installation. An example of a locale-specific format application is the Windows
NT or Windows 95 operating system, Control Panel, Internationalization
application.
The following table shows how data display differs between locales. You must
address these differences when designing the behavior and size of your
components.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ata 笏4pecial Formats 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5housands separators 笏ommas, periods, quotations, or spaces 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ecimal separators 笏ommas, periods, spaces, or brackets 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rouping separators 笏ommas, semicolons, colons, or periods 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1ositive and negative Values 笏1ositive(+) and negative(-) signs can appear 笏
笏 笏Cefore or after the number 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏urrency separators 笏ommas, periods, colons, spaces, or nothing 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏urrency symbols 笏7ary in size and position, with spaces or not 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ate separators 笏one, dashes, periods, spaces, or slashes(/ or \) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5ime formats 笏ased on 12- or 24-hour clocks 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5ime separators 笏othing, spaces, colons, or periods 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏5elephone numbers 笏7ary in size and mixture of numbers and symbols 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1roper Names and Address 笏7ary in size and mixture of numbers and characters笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: Different currencies require different space and may also include
alphanumerics.
笊絶武笊 33.1.3. Using Pictures Instead of Words 笊絶武笊
Graphical symbols should be locale independent. Graphics can represent
non-translatable terms and have a greater impact than text alone.
If you are going to incorporate a graphic to represent something in your
application:
Use an existing international icon, if possible.
Make icons depict basic functions.
Do not use text in the icon.
笊絶武笊 33.2. Creating An International Message Catalog 笊絶武笊
Tip: It is good programming practice to separate all the message strings to
the user from the application. You can type the message calls into the Property
Editor and never touch the generated code.
For example, if you call message 133, the called message returns a string from
the message catalog. The returned string depends on the translation of that
string in the message catalog.
You can build a DLL in several ways. For example, you can create DLLs with
hard-coded messages or you can use the Windows NT or Windows 95 resource
support function and link a resource file (.rc) to your DLL.
笊絶武笊 33.2.1. Creating a Hard-Coded DLL 笊絶武笊
The following examples show a hard-coded GetMessageString procedure in a DLL:
Windows NT and Windows 95 Example:
_ _declspec(dllexport) char * GetMessageString (Int msgID)
{
Switch(msgID){
Case 1:
Return "String1"; 'First variation of String.
Case 2:
Return "String2"; 'Second variation of String.
Case 3:
Return "String3"; 'Third variation of String.
Default:
Break
}
Return "ErrorMsg1"; 'If none of the above works,
'return an Error Message.
OS/2 Example:
__export char * GetMessageString (Int msgID){
Switch(msgID){
Case 1:
Return "String1"; 'First variation of String.
Case 2:
Return "String2"; 'Second variation of String.
Case 3:
Return "String3"; 'Third variation of String.
Default:
Break
}
Return "ErrorMsg1"; 'If none of the above works,
'return an Error Message.
}
笊絶武笊 33.2.2. Creating a DLL Using a Linked Resource File 笊絶武笊
The following examples show the GetMessageString procedure in a DLL using a
linked resource file:
Windows NT and Windows 95 Example:
_ _declspec(dllexport) char * GetMessageString (Int msgID)
{
Return GetStringTable(msgID).br
'Calls your custom resource file, .br
'GetStringTable pointing to a specific.br
'data message, msgID.
}
For example, if you use Visual C++ to compile the file containing your C source
code, use the following command line to build the DLL:
cl /LD yourSourceFilename.c
OS/2 Example:
__export char * GetMessageString (Int msgID){
{
Return GetStringTable(msgID).br
'Calls your custom resource file, .br
'GetStringTable pointing to a specific.br
'data message, msgID.
}
For example, if you use VisualAge C++ for OS/2 to compile the file containing
your C source code, use the following command line to build the DLL:
icc /Ge- yourSourceFilename.c
ilink /nofree /ST:32000 yourSourceFilename.obj, yourSourceFilename.dll,,,
You also need to create a definition file (yourSourceFilename.def), containing:
LIBRARY yourSourceFilename
EXPORTS GetMessageString
笊絶武笊 33.2.3. Using a Custom Message Catalog in Your Application 笊絶武笊
You access the messages in the DLL using the Property Editor or the Code
Editor. This example uses the Property Editor to access the first variable,
called String, for a custom DLL named GetMessageString:
1. Declare GetMessageString in the Code Editor declaration section. Declare
Function GetMessageString As String
2. Change Label1's Caption property to Expression mode. Highlight the
Caption property, and choose Selected=> Expression.
An E (for Expression) is displayed to the left of the word Caption.
3. Type GetMessageString(1) in the Caption's text area.
The string in the GetMessageString, String1 variable loads.
See also: Chapter 4, Using the Property Editor, Displaying Property Values by
Constant or Expression.
笊絶武笊 33.3. Internationalized Language Elements 笊絶武笊
VisualAge for Basic contains a fully internationalized run-time library. All
functions that input, display, or use date, time, currency, or numbers are
internationalized, as are VisualAge for Basic string manipulation and file
input and output.
See also: VisualAge for Basic Language Reference for more information on the
language elements.
笊絶武笊 33.3.1. Basic Support 笊絶武笊
The VisualAge for Basic language supports the MBCS literals ("....."), comments
('....), and anonymous character string data. However, MBCS formatting must
follow Basic syntax rules. For example, a character preceded with a formatting
character for a Format[$] function can be an MBCS character.
Important: The UCase and LCase functions are reserved for Single Byte
Character Set (SBCS) characters in a mixed string. This avoids any
misinterpretation of the MBCS second byte as an SBCS character.
You can use special characters to match strings. To support
internationalization, VisualAge for Basic enhanced the syntax options for
regular expressions using the Find/Replace dialog as follows:
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏3eg.Exp. Mode Syntax Options 笏atches 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏? 笏1 Single-Byte 笏
笏 笏haracter Set (SBCS)笏
笏 笏Pr 1 Multi-Byte 笏
笏 笏haracter Set (MBCS)笏
笏 笏Dharacter 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏* 笏ny number of SBCS 笏
笏 笏Pr MBCS characters 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏# 笏1 SBCS numeric 笏
笏 笏Dharacter only 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏charlist} 笏1 SBCS or MBCS 笏
笏 笏Dharacter in the 笏
笏 笏Dharlist 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏!charlist} 笏1 SBCS or MBCS 笏
笏 笏Dharacter other than笏
笏 笏Jn the list 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笊絶武笊 33.3.2. Internationalized Functions and Localized Behavior 笊絶武笊
The Asc, Chr, and String($) functions are extended for MBCS code. The Len
option used in VisualAge for Basic functions handles logical character counting
operations in an MBCS environment.
The Len function returns the number of characters in an argument and the LenB
function returns the number of bytes. For example, consider an MBCS character
named astr that consists of two bytes. Len(astr) returns 1, and LenB(astr)
returns 2.
The following table lists byte-based functions and their corresponding
character-based functions.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏haracter-Based 笏yte-Based Functions笏
笏unctions 笏 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nput($) 笏nputB($) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏nStr 笏nStrB 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏eft($) 笏eftB($) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏en 笏enB 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏id($) 笏idB($) 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏3ight($) 笏3ightB($) 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Tip: For functions that return values, a single-byte function returns only the
ASCII code. A multi-byte function returns either ASCII, EUC, or Shift-JIS code.
笊絶武笊 33.3.3. Comparing Text 笊絶武笊
Different locales have specific rules regarding sort parameters. Any operations
using the Option Compare or the StrComp statements sort to the parameters for
that locale. The operators <, <=, >, >=, =, <>, and Like depend on the setting
of the Option Compare statement.
To control how string data is compared, use the Option Compare statement in the
declarations section of the module. It has two comparison modes: binary and
text. The comparison defaults to the binary mode. Select the text mode to sort
using the locale-specific ordering.
笊絶武笊 33.4. Internationalization Do's and Don'ts 笊絶武笊
To internationalize your application, DO:
Design with attention to language and cultural conventions.
Avoid hard-coded character ranges. Define uppercase and lowercase
letters, numeric digits, punctuation markers, and spaces rather than
using hard-coded character ranges.
Allow for existing applications to format date and time for each area.
Allow for multiple currency formats.
Plan for size changes in user messages after translation. Different
languages reproduce the same message in differing length and height.
Use explicit functions to center and align text.
Allow punctuation characters within words.
Provide translation notes to translators, where possible (as in code
comments). This ensures correct translation of your user messages.
Make software 8-bit clean by not altering the most significant bit of a
character.
To internationalize your application, DO NOT:
Split user message strings. Write out whole messages instead. For
example, grammatical word order varies between languages.
Assume that the number of bytes is the same as the number of characters.
Embed graphics in code.
Use idioms or jargon.
Make assumptions about word order in strings. Grammatical word order
varies between languages.
Test for alphabetic characters by comparing specific characters, for
example, "A" and "Z".
Hard-code the numeric decimal separator in parsing, arithmetic
calculations, or currency characters.
Hard-code or limit the size of currency fields.
Assume the size of paper on which application output will print.
Use single-letter commands to represent the first letter of commands
(such as "p" for "print").
Make assumptions about what might be in particular byte locations within
message strings.
笊絶武笊 34. Appendix D CORBA objects and VisualAge for Basic Type Mapping 笊絶武笊
The following table shows the type mapping between Common Object Request
Brokerage Architecture (CORBA) objects and VisualAge for Basic data types.
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏ORBA 笏7isualAge for Basic 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ny 笏7ariant 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏rrays 笏rray 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oolean 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏har 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ouble 笏ouble 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏numerated 笏ong 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏loat 笏4ingle 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏oreign 笏ot supported 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏ong 笏ong 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0ctet 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏0bject Reference 笏0bject Reference 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏1ointer 笏ot supported 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4equence<type, max> 笏rray() as Integer 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4equence<type> 笏rray() as Integer 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4hort 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4tring 笏4tring 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏4truct 笏5ype... EndType 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6nsigned Short 笏nteger 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6nsigned Long 笏ong 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏6nion 笏7ariant 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Important: Convert any VisualAge for Basic data to the expected data type
before passing it to an external object as a property data value.
Restriction: VisualAge for Basic does not support the Pointer and Foreign data
types, which are IBM SOM extensions to CORBA. .*
笊絶武笊 35. Glossary 笊絶武笊
This glossary defines important terms and abbreviations used in this book. It
includes terms and definitions from the IBM Dictionary of Computing, 10th
Edition (New York: McGraw-Hill, 1993). The glossary uses the following terms
for cross-reference:
see Refers you to the spelled-out form and definition of an acronym, or
to a term that is preferred in place of the term you are looking at.
see also Refers you to a related term with a related or similar (but not
synonymous) meaning.
contrast with Refers you to a term with an opposite or substantially different
meaning.
笊絶武笊 35.1. A 笊絶武笊
absolute value. The unsigned value of a number. For example, the absolute
value of -5 is 5.
abstract class. A class that cannot be used to create objects, but is used to
organize a class hierarchy, or to define properties, methods, and
variables that apply to its subclasses. See also class and subclass.
action choice. In VisualAge for Basic, a choice that immediately begins to
perform an action, such as the Close or Copy selection.
action query. A database operation that manipulates one or more records, but
does not return data. Examples of action queries are: Update,
Delete, and Insert.
active window. In a Graphical User Interface (GUI) application, several
windows can be on the screen at the same time. However, only one of
those windows can receive input at a time. On OS/2 and Microsoft
Windows**, you select the active window by clicking it with the
mouse. For information about window behavior on AIX, see the AIX
window manager software documentation.
advanced program-to-program communication (APPC). IBM's architected solution
for program-to-program communication, distributed transaction
processing, and remote database access.
aggregating function. See column function.
alphabetic character. One of the 26 uppercase or 26 lowercase letters of the
alphabet.
alphanumeric character. An uppercase or lowercase letter of the alphabet, a
digit between 0 and 9 inclusive, or the underscore (_).
American National Standards Institute (ANSI). A standards organization that
creates and maintains voluntary industry standards in the United
States. ANSI standards include a specification for the digital
representation of characters, which is a superset of the ASCII
specification. The term ANSI is used by Microsoft Windows to
identify special characters, and is often used interchangeably with
ASCII, although this is not technically correct. See also ASCII.
American Standard Code for Information Interchange (ASCII). ASCII is a
specification for the digital representation of characters. ASCII
files are supported by most computer systems, making them ideal for
the exchange of information between different kinds of computers.
ASCII is known as International Alphabet 5 (IA5) in some European
countries. See also ANSI.
ANSI. See American National Standards Institute.
API. See application programming interface.
APPC. See advanced program-to-program communication.
application. A software component or collection of software components used to
perform specific types of user- oriented work on a computer.
application programming interface (API). An architected functional interface
supplied by an operating system or other software system. The
interface allows an application program to use specific data or
functions of the underlying system.
argument. A value passed to or returned from a function or procedure at run
time.
array. A set of related data items stored under a single variable name. All
of the elements in an array must be of the same type, although this
restriction can be overcome by using the Variant type.
array element. A data item in an array.
ASCII. See American Standard Code for Information Interchange.
attribute A member of a class that contains data for the class or for an
instance of the class. In VisualAge for Basic, an attribute contains
data that represents a property of a part.
笊絶武笊 35.2. B 笊絶武笊
base class. A class from which the given class inherits properties, variables,
and methods. When you create a class, you specify the base classes
from which your new class inherits. See also abstract class,
inherit, and subclass.
base classes. In VisualAge for Basic, prefabricated components that are used
when constructing an application.
Basic. See Beginner's All-purpose Symbolic Instruction Code.
Beginner's All-purpose Symbolic Instruction Code (BASIC) A simple programming
language originally developed to te.ach computing, Basic has gained
popularity and widespread adoption due to its simplicity and ease of
use. VisualAge for Basic contains an implementation of the Basic
language, including some extensions.
behavior. The way a component or other object acts and reacts; for example, a
command button looks recessed when a user clicks on it.
button displays its on or off status through an internal method or
property and 2) a file object would typically be opened through an
Open method. See also method and property.
binary. Relating to or belonging to a numbering system with a base of 2.
Valid digits are 0 and 1.
binary file. A file whose data is encoded in binary form and is not readable.
For example, the compiled executable version of an application is
described as being a binary file.
binary large object (BLOB). A file whose data is encoded in binary form and is
not readable. For example, the compiled executable version of an
application is a binary file.
BLOB. See binary large object.
branching. The technique of bypassing specific instructions or operations to
alter the sequential processing of instructions in a program.
branching instruction. An instruction that changes the sequence of program
processing.
break mode. Debugging using breakpoints or watch expressions. See also
breakpoint, watch expression.
breakpoint. During debugging, a breakpoint is a marker that you place in your
application to pause execution at that point. Using breakpoints in
design mode or break mode allows you to analyze variables and other
values at specific points during program execution.
browser. A window that supports one or more programming activities, such as
creating new classes or methods, modifying existing classes or
methods, or viewing library members.
buffer. A portion of main storage that data is read into or written from.
by reference. A method of passing arguments to a procedure in which the
address of the argument is passed to the called procedure. Any
changes made to the argument by the called procedure are made
directly to the variable at the given address, and thus can be seen
by the calling procedure.
byte. A unit of storage consisting of eight adjacent binary digits (bits).
A byte can contain one EBCDIC character, and two bytes can contain
one DBCS character.
by value. A method of passing arguments to a procedure in which the called
procedure creates a local variable of the same name as the one in
the calling procedure and copies the value into it. Any changes made
to the argument by the called procedure are made to the local
variable and thus cannot be seen by the calling procedure.
笊絶武笊 35.3. C 笊絶武笊
CAE. See client application enabler.
call. An instruction to a program to begin running.
called program. A program that is run by another program or by a command.
call level interface (CLI). An implementation of the ODBC interface used to
let applications access data stored in a relational database
management system (RDBMS).
cascaded menu. A submenu that appears when a higher-level cascading menu
choice is selected. The submenu contains a set of choices related to
the higher-level menu choice. Cascaded menus are used to reduce the
length of higher-level menus.
cell. In VisualAge for Basic, the location in the Grid component at which
a row and a column intersect.
character. A letter, number, or symbol that belongs to the ASCII or ANSI
character set.
child. 1) A component that is contained in another component; for example,
an option button in a frame is called a child of the frame, and the
frame is called the button's parent. 2) An object contained in
another object; for example, a string object within a collection
object. 3) A class that inherits from another class is sometimes
called a child of that class; see subclass.
class. A template, similar to a type definition, that guides creation of
objects. A class defines the methods, variables, and properties for
objects of the class. See also object and instance.
to instance. For example, all text boxes have Caption and Multiline
properties, defined by the Text class, but property values (for
example, "Save" and True) are different for each text box.
class extension. An extension to the functionality of a class defined by
another application. The extension consists of one or more methods
that define the added functionality. These methods cannot modify the
existing behavior of the defined class; they can only add behavior
specific to the application that contains the extended class.
class hierarchy. A tree structure that shows which classes inherit from which.
By looking at any class in the class hierarchy, you can see its base
classes and its subclasses. see also class, inherit, base class, and
subclass.
class method. See method. The term class method is sometimes used in contrast
to the term instance method. See also method and instance method.
CLI. See call level interface.
client application enabler (CAE) An IBM program product that provides run-time
support to allow applications to access local or remote database
servers via popular communications protocols.
client/server. The model of interaction in distributed data processing in
which a program at one location (the client) sends a request to a
program at another location (the server), and awaits a response.
clipboard. A resource provided by the operating system that stores and returns
information highlighted by mouse, keyboard, or macro operations. The
clipboard allows data to be exchanged between different portions of
an application, or between different applications.
Code Editor. In VisualAge for Basic, a syntax-sensitive editor for BASIC
source code.
column function. In VisualAge for Basic, a function that calculates a value
from a set of values in a table.
comment. A word or statement in a program, command, or file that serves as
documentation instead of instructions. A comment is ignored by a
compiler.
Common Object Request Broker Architecture (CORBA). An industry specification
for the design of Object Request Brokers (ORBs). ORBs allow
different kinds of computer systems to exchange object data with
each other. Distributed System Object Model (DSOM) is an example of
an Object Request Broker that conforms to the CORBA specification.
Common User Access (CUA). An IBM architecture for designing object-oriented
user interfaces using a set of standard components and terminology.
compile. To translate source code instructions into machine language form.
For example, in VisualAge for Basic, when you select the menu option
File=>Build Executable, you are compiling the application.
component. An object that is an element of the graphical user interface, such
as a command button or a text box.
component array. Several instances of the same component that share a common
name; for example, an array of command buttons. An index is used to
specify a particular component.
shared by all elements of a component array.
concatenate. To join two strings together to form a larger string. In
VisualAge for Basic, you use the ampersand (&) operator to join
strings together.
constant. A value that, when assigned, cannot change during program execution.
For example, you might define a constant called Pi to hold the value
3.1415926535, and then refer to that constant in your procedures.
Constants are generally declared as Global in scope. In VisualAge
for Basic, the file constant.bas contains declarations for many
common constants that you can use in your applications.
construction from parts. A software development technology in which
applications are assembled from reusable, existing software
components known as parts.
constructor. A special method that initializes an object. In VisualAge for
Basic the constructor method is named New. A constructor is called
automatically just after the object is created. You can not call a
constructor directly. See also destructor.
container. A class that acts as the parent for other classes. Generally, a
container manages the layout of graphical component classes. The
Form class is a container. Container classes act as the parent of
the classes they manage.
control. The Microsoft Visual Basic term for a component. See also component.
control array. The Microsoft Visual Basic term for a component array. See also
component array.
CORBA. See Common Object Request Broker Architecture.
cross-platform. The ability of a product or application to run on different
operating systems.
CUA. See Common User Access.
currency symbol. The character used to represent the currency of the country
selected under the operating system's international settings.
笊絶武笊 35.4. D 笊絶武笊
DARI. See distributed application remote interface.
data Information supplied to a program or stored in a data file.
database. The collection of all data files stored in a system. The data files
contain descriptions of how input data is presented to a program
from internal storage and how output data is presented to internal
storage from a program.
data control language (DCL). The subset of SQL statements used to grant and
revoke access permissions on database objects.
data description language (DDL). The subset of SQL statements used to create,
delete, and modify structures within a database. DDL operates on the
metadata that defines the structure of the database objects. The DDL
for managing user- defined functions includes CREATE, DROP, and
COMMENT ON statements.
data file. A file containing information that is manipulated by an
application. For example, a file containing payroll information is a
data file.
data item. A unit of data, either a constant or a variable, that can be
processed.
data manipulation language (DML). The subset of SQL statements used to add,
insert, delete, and update data within a database.
data type. An attribute of a variable that specifies the data format for the
variable. The data type restricts the type of data the variable will
accept.
date expression. A numeric or string representation of the date and time, with
the number of days to the left of the decimal point, and the time of
day to the right of the decimal point.
DB2 Client/Server (DB2 C/S). A relational database management system available
on OS/2 and AIX.
DB2 C/S. See DB2 Client/Server.
DB2 SDK. See DB2 software developer's kit.
DB2 software developer's kit (DB2 SDK). A collection of tools that help
developers create database applications.
DCE. See distributed computing environment.
DCL. See data control language.
DDCS. See distributed database connection services.
DDL See data description language.
debug mode. An environment in which programs can be tested.
debugger. A software tool used to detect, trace, and eliminate software
errors.
declaration. The definition of a variable or constant. A declaration can
specify the data type of the variable or constant. If no data type
is specified, the Variant type is assigned. The location of the
declaration determines the scope of the variable or constant.
default property. In VisualAge for Basic, each component is assigned a default
property, which is generally the property accessed most frequently.
You can set or retrieve the default property by referring to the
component within an expression. For example, the default property of
the Text Box component is Text.
default value. A value assumed when no value has been specified.
defined class. A new class that a containing application adds to the system.
It consists of a textual definition (which defines elements such as
instance variables), and methods (which define behaviors). Contrast
with extended class.
demote. To move a menu item to a lower level in the outline structure.
design time. The time when you are using the VisualAge for Basic application
builder interactively. For example, the Name property of a VisualAge
for Basic component is only available at design time. Contrast with
run time.
destructor. A special method that does cleanup just before an object is
destroyed. In VisualAge for Basic, the destructor method is called
New.
to constructors, which can not be called directly. See also object
lifetime.
directory separator. The character used to indicate subdirectory divisions.
For example, the directory separator for Microsoft Windows and OS/2
is the backslash (\), while the directory separator for AIX is the
forward slash (/).
distributed application. A workstation application that runs in cooperation
with programs running on other processes or machines. Client/server
applications are a subset of distributed applications.
distributed application remote interface (DARI). An application programming
interface that supports the sqleproc() function for invoking stored
procedures.
distributed computing environment (DCE). A set of services and tools that
support the creation, use, and maintenance of distributed
applications in a heterogeneous computing environment.
distributed database connection services (DDCS). A tool that provides local
applications with transparent read and update access to enterprise
data stored in DRDA application servers such as DB2 for MVS.
distributed relational database architecture (DRDA). An database architecture
that supports the SQL CALL statement for invoking stored procedures.
Distributed System Object Model (DSOM). An extension to SOM that enables SOM
objects to reside on multiple network nodes. See also System Object
Model.
DLL. See Dynamic Link Library.
DML. See data manipulation language.
DRDA. See distributed relational database architecture.
drive identifier. A prefix used by some operating systems to indicate a
logical drive choice. For example, in the file path
c:\subdir\filename.txt, c: is the drive identifier.
DSOM. See Distributed System Object Model.
dynamic array. An array whose size can change at run time. You create a
dynamic array by omitting the dimensions of the array from its
declaration statement, and then using the ReDim statement with
variables to set the dimensions of the array at run time. You can
change the dimensions of a dynamic array as many times as you need
to during the program.
dynamic binding. A process for resolving an address when a call to an object
is made, rather than resolving it at compile time.
Dynamic Link Library (DLL). A file containing data and code objects that can
be used by programs or applications at run time, but are not part of
the program's executable (.exe) file. DLLs store libraries of
functions in binary form for use by Windows applications. You can
access functions stored in DLLs by using special VisualAge for Basic
declarations.
笊絶武笊 35.5. E 笊絶武笊
edit. In general, to add, change, delete, or rearrange data. In the
VisualAge for Basic Project Window, the Edit menu choice enables you
to perform operations such as cut, paste, copy, or delete on an
object selected in a VisualAge for Basic form.
EHLLAPI. See emulator high-level language application programming interface.
element. The smallest addressable unit of an array or table.
embedded SQL. SQL statements contained in a source program that will be
converted, using precompilation services, to relational database
language statements. See also SQL.
emulator high-level language application programming interface (EHLLAPI). A
programming interface that enables a workstation application to
communicate with a mainframe application. EHLLAPI operates with a
terminal emulator, such as a 3270 terminal emulator.
encapsulation. An implementation technique that packages data and methods
inside an object for access control. Code inside an object can
access the object's internal representation: data and methods
private to the object. Code outside the object can access the
object's interface only: it's properties, public variables, and
public methods.
an object can be changed with no effect on other objects.
EUC. See Extended UNIX Code.
event. An occurrence relevant to an application. For example, when a user
clicks on a command button, a Click event is said to occur. See also
event procedure and event-driven.
event-driven. Application behavior that responds to events as they occur. For
example, when the user selects a Copy command, an event procedure
responds to that event with the appropriate Copy action. The term
"event- driven" describes applications that are controlled by a
series of such events, in contrast with applications that have a
pre-established order of operation.
event procedure. A sub procedure that implements an action in response to an
event. For example, when a user clicks on a command button with the
name Save, the Save_Click event procedure performs the save
operation.
explicit declaration. In VisualAge for Basic, the declaration of a variable
using the Dim, Global, Private, Public, or Static statements.
Contrast with implicit declaration.
expression. A mathematical formula or phrase that combines variable names and
operators to perform an operation.
extended class. In VisualAge for Basic, a class that uses and extends the
functionality of a class defined by a VisualAge for Basic class. It
consists of one or more methods that define the added functionality.
Contrast with defined class.
Extended UNIX Code (EUC). A code used for storing data in files that allows up
to four codesets in one data file.
extension language. A scripting language that allows execution of the source
text without compiling and linking.
extent of a variable. A variable's lifetime-that period of time during program
execution when storage is bound to the variable. When a Sub or
Function procedure ends, the extent of its local variables ends, and
the storage associated with them is freed for use by other parts of
the program.
external action. A function defined as having an external action can take some
action (such as sending a message or updating a file) that changes
the state of some non-DBMS object.
external function. A scalar function that resides in a library and is
implemented in an external programming language such as C, C++, or
VisualAge for Basic.
笊絶武笊 35.6. F 笊絶武笊
fenced function. A user-defined function that is defined to be run isolated
from DB2 by a firewall across which DB2/user-defined function
communication must occur. An unfenced function runs in the DB2
process.
FFST. See first failure support technology.
file. In VisualAge for Basic, a generic term for the object type that
refers to a data base file, a device file, or a set of related
records treated as a unit.
file description. Information that describes a file and its contents.
file reference. In VisualAge for Basic, a numeric expression preceded by a
pound sign (#) that is used to specify the file of the device being
accessed in an input/output statement.
first failure support technology (FFST). An error reporting and recovery
mechanism used by DB2 Client/Server and VisualAge for Basic.
fixed-point format. A style for the formatting of numeric data in which the
number is always represented as a fixed number of decimal places,
regardless of actual value.
fixed row. The non-scrolling area of a Grid component. The default color is
gray.
floating-point format. A style for the presentation of numeric data in which
the number of decimal places shown is determined by the value of the
number.
focus. The window that is currently selected on a graphical user interface
and will accept keyboard and mouse input is said to have focus. See
also active window.
form. A container or window that you use to design the graphical user
interface of your application, including the placement and
configuration of VisualAge for Basic components.
format. A specified arrangement of things such as characters, fields, and
lines, usually used for displays, printouts, or files.
function. In VisualAge for Basic, a set of instructions that perform a task. A
function accepts arguments and uses them as input values in its
calculations. When a function is complete, it returns a single
value. Therefore functions can be referenced directly within
expressions, and they are ideal for calculation or data conversion
tasks.
function body. In VisualAge for Basic, the piece of code that implements a
function.
function family. In VisualAge for Basic, the set of functions with the same
function name. The context determines whether the usage refers to a
set of functions within a particular schema, or all the relevant
functions with the same name within the current function path.
function invocation. In VisualAge for Basic, the use of a function in SQL,
together with any argument values being passed to the function body.
Also known as a function call.
function key. A keyboard key that is used to request a specific system
function. Shown as F followed by a number, such as F3.
function name. In VisualAge for Basic, the name by which a function is called
in SQL. Many specific functions can have the same function name, in
which case the name is said to be overloaded.
function path. In VisualAge for Basic, an ordered list of schema names that
restricts the search scope for unqualified function calls and
provides a final arbiter for the function selection process.
function path family In VisualAge for Basic, all the functions of the given
name in all of the schemas identified (or defaulted to) in the
function path.
function procedure. See function.
function result. In VisualAge for Basic, depending on the context, the value
generated by a function, or the definition of the characteristics of
the output of a function.
function signature. In VisualAge for Basic, the logical concatenation of a
function name with the data types of its parameters. Each function
in a schema must have a unique signature.
笊絶武笊 35.7. G 笊絶武笊
Graphical User Interface (GUI). An interface that enables users to communicate
with an application by manipulating graphical elements such as
windows and icons, rather than by entering commands. Examples of
GUIs are Presentation Manager in OS/2, Program Manager in Microsoft
Windows, and XWindows in AIX.
GUI. See Graphical User Interface.
笊絶武笊 35.8. H 笊絶武笊
host variable. A variable in an SQL statement used for substituting data
values into the statement at execution time. In VisualAge for Basic,
a host variable is preceded by a colon. For example: :hclientIO
笊絶武笊 35.9. I 笊絶武笊
icon. A small pictorial representation of an object.
implicit declaration. VisualAge for Basic treats the use of an undeclared
variable name within an expression as an implicit declaration.
VisualAge for Basic declares a variable of type Variant and makes it
local in scope.
index. In a database, an index is an ordered set of pointers to the rows of
a base table. Each index is based on the values of the data in one
or more table columns. An index is separate from the data in the
table.
number of the element in the set or array.
index variable. In programming, an index variable is a variable that holds an
index.
indicator variable. In embedded SQL, a SmallInt variable prefixed with a colon
and placed immediately after a host variable to indicate whether the
host variable is null.
inheritance. A process by which a class receives the properties, variables,
and methods of its base class (or classes) as specified in the class
definition. See also base class.
suppose you define a new class, based on a class that has a Print
method. And suppose further the new objects will not print correctly
with the inherited method. You can write a Print sub procedure and
define it as a method of the subclass. Then a method call to Print
with an object of the new subclass uses the new method, overriding
the inherited Print method.
input. Information or data that can be processed.
input file. A database or device file that has been opened with the option to
allow the reading of records.
inspector. A window in the VisualAge for Basic debugger that helps you analyze
and correct errors in your application. The inspector lets you
inspect the values of watch expressions, and verify calls in the
call stack. See also breakpoint, watch expression.
instance. Any object of a class is said to be an instance of that class. For
example, Text1 and Text2 are instances of the TextBox class.
instance method. A method that provides behavior for particular instances of a
class. Messages that invoke instance methods are sent to particular
instances, rather than to the class as a whole. See also class
method.
instance variable. Private data that belongs to an instance of a class and is
hidden from direct access by all other objects. Instance variables
can only be accessed by the instance methods of the defining class
and its subclasses.
instantiation. The process of creating new instances of a class; see also
instance.
instruction. A statement that specifies an operation performed by the system
and that identifies the data, if any, involved in that operation.
integer. A positive or negative whole number (that is, an optional sign
followed by a number) that does not contain a decimal place. Zero is
also an integer.
internal representation. The data format in which the data associated with a
variable is stored. The data format is specified by the variable's
data type attribute. See also data type.
interpreter. A computer program that translates instructions into computer
language and executes them in real time. The interpreter makes it
possible for an VisualAge for Basic program to be run in debug mode.
See also compile.
intrinsic function. A supplied function. Contrast with user-defined function.
invoke. To cause an event or to initiate the execution of a program.
iterative development. A software development process that allows progress in
stages. At the end of each stage, the result is verified by end
users. Through such verification, requirements are dynamically
identified and refined while the whole product is under development.
笊絶武笊 35.10. J 笊絶武笊
Julian date. A date format with the year in positions 1 and 2, and the day in
positions 3 through 5. The day is represented as 1 through 366,
right-aligned, with zeros in the unused high-order positions. For
example, Feb. 20, 1996 would be represented as 96051.
笊絶武笊 35.11. K 笊絶武笊
K (kilobyte). The primary unit of measure for storage capacity; 1K = 1024
bytes.
keyword See reserved word.
笊絶武笊 35.12. L 笊絶武笊
label. In VisualAge for Basic, the name that identifies a program line.
LAN. See local area network.
left-align. To place an entry in a field or to move the contents of a field so
that the leftmost character of the data is in the leftmost position
of the field.
library. A shared code repository represented by a single file. It stores
source code, object code, and persistent objects.
line number. In VisualAge for Basic, the number that prefaces and identifies a
program line.
line reference. The label or line number that specifies where control should
be transferred if certain conditions exist when the line executes.
literal. In expressions, a literal is a value that is referenced directly,
rather than as the value of a variable.
load. To place into memory. In VisualAge for Basic, for a form to be
displayed, it must first be loaded into memory.
local area network (LAN). A computer network located within a limited
geographical area. A LAN typically consists of one or more server
machines providing services to a number of client workstations.
logical line. One or more physical lines of code joined by the line
continuation character (_).
loop. A sequence of instructions that is executed repeatedly.
笊絶武笊 35.13. M 笊絶武笊
main procedure. In VisualAge for Basic, a general procedure called Main is
required if your application does not have a form designated as the
startup form. Normally, the startup form serves as the initializing
sequence when an application is executed. The Main procedure can
serve the same purpose. You cannot have a procedure called Main as
well as a startup form in the same application.
MDI. See Multiple Document Interface.
menu. A list of action, routing and settings choices presented to the
user. The user's selection determines what the application does
next. Menu types include menu bar, pull-down menu, cascades menu,
and pop- up menu.
menu bar. The area near the top of a window, below the title bar and above the
rest of the window, that provides access to pull-down menus. In the
VisualAge for Basic Project Window, the menu bar provides the
commands you use to develop your application.
menu browser. See Menu Editor.
Menu Editor. A design tool that lets the developer create menus for the user
interface.
menu item. A listing included on a drop-down or cascade menu that provides the
user with an action choice.
menu pane. One of the areas on a drop-down menu that is separated by a
separator bar.
method. A sub procedure or function that implements part of the services or
behavior of an object. Objects that are Toolbox components come with
their methods built in; you do not have to write them unless you are
creating custom components.
interface and can be called from code external to the object. For
example, an object named FilObj1, might have a Sort method callable
from a Form1 script as FilObj1.Sort.
mnemonics. A symbol that helps the user remember the meaning of a specific
action, entity, or event. Typically a mnemonic for a menu item is a
character in the menu item highlighted with an underscore, such as S
in Save. You can use a series of keystrokes that include the
designated character to select the action.
modal window. A window that pauses all other program operations until you
interact with it. For example, in most applications, quitting a file
with unsaved changes will bring up a modal window that asks for
confirmation. Contrast with non-modal window.
modeless window. See non-modal window.
module. Building block of a VisualAge for Basic application. Code modules
contain functions and sub procedures, as well as declarations. The
functions, sub procedures, and declarations contained in a code
module are general in scope.
module-level variable. In VisualAge for Basic, a variable that is declared in
the Declarations section of a module using the Dim or Private
statement. A module-level variable can be read and modified by any
procedure in the module, but not by procedures in other modules. A
module-level variable retains its value as long as the application
is running.
modulo. The remainder of a division operation. For example, 22 modulo 5 = 2
(2 is the remainder of the division operation).
Multiple Document Interface (MDI). An MDI form supports multiple forms within
the same form window.
multiple inheritance. A sharing mechanism that enables a new class to inherit
properties, variables, and methods from more than one base classs,
as specified in its class definition. See also inherit and base
class.
笊絶武笊 35.14. N 笊絶武笊
NetBIOS. See Network Basic Input/Output System.
Network Basic Input/Output System (NetBIOS). An operating system interface for
application programs used on IBM personal computers that are
attached to an IBM token-ring network.
non-fixed row. The scrolling area of a Grid component. The default color is
white.
non-graphical components. All objects within windows except graphical
components.
non-modal window. A window that does not require you to interact with it
before switching focus to another form, window, or application. For
example, most progress windows are non-modal. Contrast with modal
window.
non-visual component. A part that you can add to a graphical user interface
but that is not visible to the user during run time. A non-visual
component may allow access to a database or API, or it may represent
some real-world object that exists in the business environment.
null-call function. A null-call function can handle null arguments and can
produce a null result.
null value. A special value used in database and arithmetic operations to
indicate that an error has occurred. Any expression including a null
value equates to null. Thus, the null value propagates to the final
result of any series of operations and indicates an error.
numeric. Character sequence interpreted as a number. Any combination of
variables, constants, functions, and operators that an application
can evaluate as a number.
笊絶武笊 35.15. O 笊絶武笊
object. A software structure that often has a visual representation, as do
forms, component arrays, and command buttons. Objects are the
building blocks of your application.
instance, instantiating, and class.
object ID (OID). A unique identifier for an object.
Object Linking and Embedding (OLE). A system for the exchange of object data
between applications in Microsoft Windows.
object-oriented programming (OOP). A programming method built around objects
and based on sending messages back and forth between those objects.
The basic concepts of OOP are encapsulation, inheritance, and
polymorphism.
object variable. An object variable is like a handle on an object: it allows
you to refer to the object within procedures. Each time an object is
created, an object variable of the same name is also created. When
you manipulate an object using VisualAge for Basic statements, you
are actually manipulating an object variable. You can also create
your own object variables, and more than one object variable can
point to the same object.
ODBC. See Open Database Connectivity.
OID. See object ID.
OLE. See Object Linking and Embedding.
OOP. See object-oriented programming.
Open Database Connectivity (ODBC). A protocol for the exchange of database
information between applications and relational databases in
Microsoft Windows, in which SQL statements are passed as arguments.
OpenDoc. An open, cross-platform, object-oriented component embedding
architecture.
operating system. The software that controls the overall behavior of a
computer, including memory management, file storage, disk
management, and peripheral devices.
operator. A symbol used to represent an arithmetic operation, such as a + or -
used to indicated addition or subtraction. A symbol representing an
operation processed on character data, such as concatenation.
output. Data that has been processed. Data transferred from storage to an
output device.
output file. A database or device file that has been opened with the option to
allow the writing of records.
overflow. The condition that occurs when a portion of the result of an
operation exceeds the capacity of the intended unit of storage.
overloaded function name. Using the same function name or identifier to
represent different functions.
overloading. A mechanism that enables a name to refer to more than one entity.
In a particular context, rules resolve which entity is actually
referenced. Polymorphism is one use of overloading. See also
polymorphism.
笊絶武笊 35.16. P 笊絶武笊
parameter. A data element that is included in a message to provide the
requested method with any information that it might need to perform
its task.
parameterized data type. Any of the data types that can be defined with a
specific length, scale, or precision, such as strings.
parent. A component's container, as specified by its Container property. For
example, a form serves as a parent to the components created
directly on it.
part. A part is a component that enables users to edit compound documents.
systems. For example, an OpenDoc part can be placed in an OLE
container. 502584ミ「.
DLL's.
polymorphism. The ability of different objects to respond to the same method
call in different ways. At design time, method calls can contain a
single (overloaded) method name, which might refer to any of several
method implementations.
At design time, the name Print might be used for either method
implementation, for instance BitMap1.Print. At runtime, the method
call BitMap1.Print automatically invokes the correct implementation,
based on 1) method-name and 2) the object's class. See also
overloading.
pop-up menu. A menu that is only displayed when the user request it: typically
by a click of the right mouse button.
primitive part. A basic building block of other parts. Primitive parts can be
visual or non-visual. For example, a multi-line edit field is a
primitive visual part.
private. A measure of the scope of a variable or procedure. A private
variable is only accessible within the procedure in which it is
declared.
private class. A class that is not visible outside its containing application.
Contrast with public class.
private method. A designation that application developers can use to indicate
that a method is only for internal use in the application they are
developing. This designation is provided for convenience, and does
not have any effect on the underlying code implementation. Contrast
with public method.
procedure. A set of commands, statements, input data, or remarks that process
a specific set of functions. In this book, procedure is used as a
generic term for Sub procedures and Function procedures in a
VisualAge for Basic application.
processing. The action of operating on input data.
program. An object that contains a set of instructions that tell a computer
where to get input, how to process it, and where to put the results.
A program is created as a result of compilation.
project. In VisualAge for Basic, the collection of source files necessary to
build an application or set of applications.
Project window. The main VisualAge for Basic window. It lists, in outline
format, the objects contained within a VisualAge for Basic project.
It contains a menu bar, tool bar, and status area that enable you to
use and modify the objects contained within a project.
promote. Moving a menu item to a greater level in the outline structure.
promotion (of a function argument) The implicit conversion of a function
argument from one data type to another data type.
property. An attribute that helps define the behavior of an object. For
example, an attribute of a form could define the form's background
color.
Property Editor. In VisualAge for Basic, an editor that enables you to view
and modify the properties for all selected objects in the current
form. The properties define the object's appearance, and its
response to user actions.
public class. A class that is visible outside its containing application, and
provided as part of a product API. Contrast with private class.
public method. A method that can be called from scripts in objects of other
classes. Public methods are part of an object's interface.
pull-down menu. A menu that extends from a selected choice on a menu bar or
from the system-menu symbol. The choices in a pull-down menu are
related to one another in some manner
笊絶武笊 35.17. R 笊絶武笊
receiver. The object that receives a message. Contrast with sender.
record. An ordered set of fields that make up a single occurrence of the
unit of data transferred between a file and a program.
recordset. A group of records in a database.
regular expressions. In VisualAge for Basic, a check box in the Edit=>Find and
Edit=>Replace windows of the Code Editor. Selecting the checkbox
causes the alphanumeric and special characters that you enter to be
interpreted as a pattern to be searched for.
remote build. A process that transfers and makes a stored procedure or
user-defined function on a database server node on your network.
remote debugging. The process of debugging a stored procedure or user-defined
function running on a database server node on your network.
remote execution. The process of running a stored procedure or user-defined
function on a database server node on your network.
remote registration. The process of registering a stored procedure or
user-defined function on a database on a database server node on
your network.
reserved word. In VisualAge for Basic, a word that has a special meaning and
cannot be used as a variable name. Reserved words in VisualAge for
Basic include the names of functions, objects, and statements that
are part of the VisualAge for Basic language.
return value. The value returned by a function and substituted in the
expression that called the function.
routing choice. A choice that displays a pull-down menu, a cascaded menu, or a
window containing additional choices.
run. To process a program, command, utility, or other machine function
run time. The state of an application when it is actively executing, as
opposed to when it is being designed. For example, in VisualAge for
Basic, properties associated with Grid cell selection such as
SelEndCol and SelEndRow are read and write available at run time,
but not at design time. Contrast with design time.
笊絶武笊 35.18. S 笊絶武笊
scalar function. A VisualAge for Basic function that calculates a value from
one row in a relational table or view. The arguments of a scalar
function are single values (scalars) and it returns a single value
as a result.
schema. (1) The set of statements, expressed in data definition language,
that completely describe the structure of a database. (2) The
high-order part of the two-part user-defined or built-in function
name. Functions are considered to be owned by a schema.
scope. The extent to which a variable can be manipulated from other parts
of an application. For example, if a variable is private in scope,
it can only be accessed from within the procedure in which it is
declared.
sender. An object that sends a message to another object. On the level of
code implementation, the sender is considered to be the sending
method within the class or instance that issues the message.
Contrast with receiver.
separator. A punctuation character used to delimit character strings. A space
is also acceptable as a date separator.
separator bars. A horizontal line in a drop-down menu that creates a separate
area or pane on the menu.
serial date. The number of days since December 30, 1899. December 30, 1899 is
considered day 0 and December 31, 1899 is considered day 1.
server. A computer that provides services to multiple users or workstations
in a network. For example, a file server, print server, or mail
server.
server procedure. A general term that includes both stored procedures and
user-defined functions.
settings choice. A type of choice that sets characteristics of objects or
displays identifying characteristics of objects.
settings view. In VisualAge for Basic, a view of a part that provides a way to
display and set the attributes and options associated with the part.
shift-JIS. Japanese Industry Standard multi-byte coding. Codes are numerically
shifted from codes used by JIS.
shortcut key. A key or combination of keys, assigned to a menu command, that
selects the menu command even if the menu item is not currently
displayed; for example, using Ctrl+C to select a Copy command.
signature. The number, order, and data types of a function's arguments that
distinguish one function from all others bearing the same name
within the same schema. All methods are polymorphic, which means
that multiple methods may share the same name provided that they
reside in different classes or have different signatures. Method
signatures are different if they differ in the number or types of
arguments.
snapshot. The result of a query expression that contains requested fields from
one or more tables. A snapshot is equivalent to a dynaset, except a
snapshot is not editable.
SOM. See System Object Model.
sourced function. A built-in or user-defined DB2 function that refers to
another function, either built-in or user-defined, already known to
the database. The referenced function will be executed as the body
of the sourced function, but DB2 does automatic type conversion if
needed.
specific function. A particular function known to the DBMS by its specific
name. Many specific functions can have the same function name. Also
known as a function instance.
SQL. See structured query language.
SQLDA. See structured query language data area.
startup form. In VisualAge for Basic, one of the forms in your application is
designated as the startup form and is the first form loaded. The
startup form load procedure is the first procedure executed when the
application is started. See also main procedure.
status area. A part of a window where information appears that shows the state
of an object or the state of a particular view of an object.
stored procedure. A program loaded at the server. If it contains SQL
statements or does any other kind of DB2 access, then it is executed
as part of the unit of work (UOW) started by the client program.
string. A set of alphanumeric characters that are stored together. A
variable containing a person's name is an example of a string.
structured query language (SQL). A language used to access relational
databases.
structured query language data area (SQLDA). A set of nested structures that
provides information used for passing data between an application
and a database during the execution of certain SQL statements and
DB2 APIs. The SQLDA can describe columns, input variables, or output
variables.
subclass. A class that inherits behaviors and specifications (in other words,
methods and variables) from another class. Contrast with superclass.
For example, the class DUCK is a subclass of the class BIRD, which
is in turn a subclass of the class ANIMAL
Sub procedure. A series of VisualAge for Basic statements that perform a task.
Sub procedures can be associated with events and accept parameters,
but do not return values.
subroutine. In VisualAge for Basic, a group of statements in a program
processed by a GoSub statement or a separately compiled program
processed by the Call statement.
superclass. A class from which another class inherits behaviors and
specifications (in other words, methods and variables). Contrast
with subclass.
system date. The date established for the system when it is started.
System Object Model (SOM) An object-structured protocol that enables
applications to access and use objects and object definitions,
regardless of what programming language created them, with no need
to recompile the application.
system time. The elapsed time from when the system was started to the current
time. If the system time is changed to local time when the system is
started, the current system time is the local time.
笊絶武笊 35.19. T 笊絶武笊
table. The physical representation of a collection of fields and indexes.
TCP/IP. See Transmission Control Protocol/Internet Protocol.
team programming. Development of a program, system, or application suite by a
team of two or more programmers.
test mode. See debug mode.
text box. A component that accepts text from the user or displays text. Class:
TextBox.
thread. In OS/2 and other operating systems, the smallest unit of execution
within a process that is not identifiable outside of its parent
process. A process consists of a collection of threads in various
states.
title bar. The area at the top of each window that contains the system menu
symbol from which the system menu appears, a small icon, a window
title, and the window sizing buttons.
tool bar. In VisualAge for Basic, the strip of icons along the top of the
Project Window. The tool bar provides quick access to frequently
used VisualAge for Basic commands.
tool button. A button that performs a useful function, such as opening the
code editor.
transaction. In client/server transaction processing, a business activity that
transforms a database from one state to another (for example, making
an airline reservation).
Transmission Control Protocol/Internet Protocol (TCP/IP). A set of
communications protocols that provide peer-to-peer connectivity
functions for both local and wide-area networks.
trigger. An update operation (insert, update, or delete) on a specified table
that causes a set of actions to be executed. You can use triggers to
validate input data, send an e-mail message, generate a value for a
newly inserted row, or write to other tables to create a log or
audit trail.
twip. One twentieth of a point. Twips are used by VisualAge for Basic as a
unit of measurement for the placement of graphical components on
interfaces. There are 72 points or 1440 twips in an inch, and 567
twips in a centimeter.
type in. The action of pressing keys on a keyboard to input information.
笊絶武笊 35.20. U 笊絶武笊
UDF. See user-defined function.
UDT. See user-defined type.
UI. See user interface.
user-defined function A scalar function that can be used in an SQL statement
and is not provided as a built-in SQL function.
user-defined type (UDT). A variable that holds several related data elements
within a single reference.
user interface (UI). The hardware, software, or both that enables the user to
interact with a computer. In VisualAge for Basic, the UI refers to
the visual presentation with which the user interacts, and its
underlying software.
笊絶武笊 35.21. V 笊絶武笊
variable. A name that points to a memory location where information can be
temporarily stored.
variable name. A name that represents a type of value. In VisualAge for Basic,
a variable name cannot be a reserved word and cannot contain any
spaces or punctuation marks. A variable name must begin with a
letter and can be between 1 and 40 characters long, inclusive.
variant. A flexible data type capable of storing different kinds of
information. Variants containing data of different types can be
combined in VisualAge for Basic operations, with data conversion
performed as necessary.
variant function. A user-defined function whose result is not solely dependent
on the values of the input arguments. That is, successive calls with
the same argument values could produce a different answer.
VBX. See Visual Basic extension.
virtual class. See abstract class.
VisualAge for Basic. A programming language and development environment for
creating database applications, user- defined functions, and stored
procedures.
Visual Basic extension (VBX). An extension to the language definition of
Microsoft Visual Basic.
visual component. A part that has a visual representation at run time. Visual
parts, such as windows, push buttons, and entry fields, make up the
user interface of an application. Contrast with non-visual
component.
笊絶武笊 35.22. W 笊絶武笊
watch button. A tool button that lets you set a watch over the value of a
property or expression.
watch expression. During debugging, a watch expression is an expression that
pauses your application when the expression changes or becomes true.
The watch expression enables you to check variable values and the
status of the expression during program execution. A watch
expression differs from a breakpoint because it is conditional and
because it does not specify a specific line of code where execution
pauses. See also breakpoint.
wildcards. Refer to Regular Expressions.
window. An area with visible boundaries that presents a view of an object,
or enables a user to conduct a dialog with a computer system.
window title. The area on a title bar that contains the name of the object or
a short description of the contents of the window.
********* Start of Header ********************* .*
笊絶武笊 36. Reader's Comments 笊絶武笊
VisualAge for Basic Programming Guide
Publication Number SC26-8833-00
International Business Machines Corporation
Department W92/H3
PO Box 49023
San Jose, CA 95161-9023
We'd Like to Hear from You!
Please use one of the following ways to send us your comments about this book:
Mail - Use the Readers' Comments form.
If you are sending the form from a country other than the United States,
give it to your local IBM branch office or IBM representative for
mailing.
Fax - Use this Readers' Comments form and fax it to this U.S. number:
800-426-7773 or (408) 463-4393.
Electronic mail - Internet: COMMENTS@VNET.IBM.COM
Be sure to include the following with your comments:
Title and publication number of this book
Your name, address, and telephone number if you would like a reply
Please comment on the information in this book and the way the information is
presented. If you want to comment on the product, please see the VisualAge
for Basic online help. Select Help Technical Support on the Project window.
To request additional publications, or to comment on other IBM information or
the function of IBM products, please give your comments to your IBM
representative or to your IBM authorized remarketer.
Readers' Comments
How satisfied are you with the information in this book?
笏娯楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏ャ笏笏笏笏笏笏笏笏笏笏笏笏笏笏
笏 笏 笏 笏 笏 笏 Very 笏
笏 笏 Very 笏 笏 笏 笏 Dissatis- 笏
笏 笏 Satisfied 笏 Satisfied 笏 Neutral 笏 Dissatisfied 笏 fied 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Technically 笏 笏 笏 笏 笏 笏
笏 accurate 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Complete 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Easy to find 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Easy to 笏 笏 笏 笏 笏 笏
笏 understand 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Well organ- 笏 笏 笏 笏 笏 笏
笏 ized 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Applicable to 笏 笏 笏 笏 笏 笏
笏 your tasks 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Grammatically 笏 笏 笏 笏 笏 笏
笏 correct and 笏 笏 笏 笏 笏 笏
笏 consistent 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Graphically 笏 笏 笏 笏 笏 笏
笏 well designed 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏懌楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏シ笏笏笏笏笏笏笏笏笏笏笏笏笏笏、
笏 Overall sat- 笏 笏 笏 笏 笏 笏
笏 isfaction 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏 [_] 笏
笏披楳笏笏笏笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏
笏笏笏笏笏笏エ笏笏笏笏笏笏笏笏笏笏笏笏笏笏
Please tell us how we can improve this book:
May we contact you to discuss your comments? [_] Yes [_] No