home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vppevl.zip
/
readme.inf
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1994-10-13
|
86KB
|
1,199 lines
ΓòÉΓòÉΓòÉ 1. VisPro/C++ ΓòÉΓòÉΓòÉ
Get Serious OS/2 Development Power With VisPro/C++!
VisPro/C++ is a full-featured visual programming tool for the C Set++ compiler.
It gives you the power to build 32-bit OS/2 2.x applications in record time.
VisPro/C++ gives you the robust features you have come to expect from solutions
costing much more. These tools leverage all of the important features of OS/2
including full integration with the Workplace Shell. And they come from
HockWare, the pioneer in value-priced visual programming products dedicated to
OS/2, including VisPro/REXX, and VisPro/C.
An abundance of CUA '91 objects, multiple development views,
entity-relationship database designer and an integrated environment are just
some of the productive features you can count on for powerful development.
With all of this, no other tool matches the functionality and productivity of
VisPro's environment--or its price.
Easy-to-use drag and drop programming
Quickly develop robust OS/2 2.x GUI and DB2/2 client/server applications
with ease using drag and drop programming. The C++ code automatically
appears for each event.
Objects, objects, objects
From simple buttons and boxes to 3-D business graphics and everything
in-between, VisPro/C++ provides the most CUA '91 objects. Not only does it
support all of the objects in OS/2, they have extra add-on objects.
Also available is VisPro/Objects, a SOM based object builder that allows you
to quickly develop your own custom objects.
The best of OS/2
VisPro/C++ gives you the best of OS/2 with complete Workplace Shell
enablement. Drag and drop programming, multiple development views including
Layout, List, Event Tree and Settings views, and the ability to get pop-up
menus on the objects are some Workplace Shell features that give you maximum
leverage of OS/2.
C++ code just like you'd expect and more
VisPro/C++ generates well-structured code. The result is non-proprietary,
royalty-free code that is easy to read and maintain. And it also supports
code regeneration.
Lightning fast DB2/2 database design
For DB2/2 programming, VisPro/C++ has a visual database designer. It
provides an entity/relationship diagramming tool and SQL builder that lets
you quickly create DB2/2 applications or reverse-engineer existing DB2/2
databases.
VisPro/C++ Features
Drag and drop programming
Workplace-Shell enabled drag and drop programming that automatically
generates the code for you. It also allows you to drag items to the printer
shredder and Workplace Shell folders.
CUA '91 objects
Comprehensive set of CUA '91 programming objects including: push button,
radio button, check box, list box, combo box, group box, entry field, MLE,
text, bitmap object, icon object, spin button, frame, slider, notebook, and
container.
Extra objects
o 3-D business graphics - displays data in bar, stacked bar, pie, line and
area charts.
o Formatted entry field - allows users to display and edit specific formats
of data.
o Spreadsheet - allows users to enter and display data in typical
spreadsheet format.
o Clock - allows users to veiw time in analog, digital and military format.
o Calendar - allows users to view and interact with a traditional monthly
calendar.
Code generation
Well-structured code generation gives you high quality code that is easy to
read and maintain. The non-proprietary, royalty-free code can be used
outside of the VisPro development environment. VisPro supports code
regeneration which allows you to incorporate changes you have made to events
and code sections outside of the VisPro environment.
VisPro/C++ automatically generates object and object event-handler code so
you don't have to worry about the details
Integrated development environment
o Manage bitmap, icon and string resources
o Visually set comiler and linker options.
o Monitor compiler progress.
o Click on compiler errors to find corresponding location in VisPro editor
or any external editor.
Multiple views
Four development views allow you to efficiently create, change or customize
your program. Views include Settings, Layout, Event Tree and List. The
layout view provides a WYSIWYG design canvas and a floating tool palette.
Visual DB2/2 database designer
Visual method for developing DB2/2 database applications or
reverse-engineering existing DB2/2 databases into diagrams. Using the
entity-relationship diagramming tool, you drag and drop tables and
relationship links in to a layout area. The point-and-click SQL builder
allows you to easily build syntax error-free SQL statements.
VisPro/Objects
SOM-based interface that allows you to create and add custom controls to the
VisPro tool bar. It allows you to specify behavior, styles and methods and
generates most of the source code needed to bring the object into all VisPro
environments - C, C++ an REXX.
Graphical class browser
VisPro/C++ includes a Graphical browser, which allows you to view the IBM
User Interface Class Library. You can also drag and drop methods from the
library into a VisPro/C++ application.
Other features
o User interface resource compatibility - allows you to build an application
with VisPro/REXX and import user interface resources to VisPro/C++ and
vice versa. User interface resources include: bitmaps, icons, panel
definitions, menus and accelerator key definitions.
o Accelerator key - allows you to type a couple of characters in the event
editor to automatically generate a construct of the code for commonly used
logic structure.
o Form styles - provides full support of all forms including plain, sizable,
scrollable, window list, dialog and title bar.
o Drag/drop support - enables you to add drag and drop functionality to your
VisPro program.
o OS/2-style help - allows you to provide OS/2-style (IPF) help to your
program which users can access your program's help file just like help for
other OS/2 applications.
System Requirements: OS/2 2.x, 5Mb memory and 2.5 Mb hard disk space; IBM
CSet++.
Suggested Retail Price: $399
ΓòÉΓòÉΓòÉ 2. Getting Started ΓòÉΓòÉΓòÉ
Once you install your Evaluation version of VisPro/C++, you can use the online
help to get information about how to use the product. Instructions for
installing the Evaluation version, opening a project, and using the online help
are provided in the following sections.
o Installing the Evaluation Version
o Creating a VisPro/C++ Project
o Opening the Main form
o Using the VisPro/C++ Online Help
o Using the C++ Information Online Reference
ΓòÉΓòÉΓòÉ 2.1. Installing the Evaluation Version ΓòÉΓòÉΓòÉ
Before you use VisPro/C++, ensure the following:
1. OS/2 2.0 or any later version must be installed on your system.
2. DB2/2 must be installed to use the VisPro/C++ Database Designer.
3. Your hard disk should have approximately 2.5 megabytes of free disk space.
4. The IBM CSET++ compiler must be installed on your system for you to compile
source code created by VisPro/C++.
5. The OS/2 2.1 Toolkit is also required for you to create OS/2 applications.
NOTE: No version of VisPro/C++ should be running when you install the
Evaluation version. If this occurs, close all VisPro/C++ windows, reboot and
then start the installation over.
To install the VisPro/C++ Evaluation version, complete the following steps:
1. Place the Evaluation diskette in the drive you wish to install from.
2. Press the right mouse button to get a pop-up menu on the diskette drive you
are using.
3. Select the arrow on the Open menu item.
4. Select Icon View.
5. Double-click on the SETUP.EXE program, which has the VisPro/C++ icon.
6. Select the drive where you want to install the Evaluation version beside
'Install on drive'.
7. If you want to change the path you are installing on, type the path name in
the Install path field.
8. Select Install.
9. When the installation is complete, the Installation Complete window
appears. It will prompt you for additional input if modifications to your
CONFIG.SYS file are necessary.
By default, the installation program will modify your CONFIG.SYS and
display this README information book. If you do not wish the installation
program to modify your CONFIG.SYS, deselect the 'Update the CONFIG.SYS'
check box and you will be given instructions on the changes needed. If you
do not wish to view the README book, deselect the appropriate check box.
10. Select Continue.
The changes are made to your CONFIG.SYS.
11. Since VisPro/C++ requires a path be specified to its required files, you
must shutdown and reboot before using the product.
After Rebooting, the VisPro/C++ folder appears on the OS/2 desktop.
12. Double Click on the VisPro/C++ icon in the Workplace Shell.
You will see the VisPro/C++ Icon View window appear. This window contains
the following:
o VisPro/C++ Class Browser: Allows you to add methods from the User
Interface Class Library to your application.
o Projects folder: Where you will create new projects.
o Samples folder: Contains the Data entry sample.
o Color palette: Allows you to change colors on your form.
o Font palette: Allows you to change the font on your form.
o Read Me: This Read Me File.
ΓòÉΓòÉΓòÉ 2.2. Creating a VisPro/C++ Project ΓòÉΓòÉΓòÉ
When you open the VisPro/C++ folder you created during installation, you see a
template called Project. You can drag a new folder off the Project template and
use it as your new project, which will become your application.
To open your new project, complete the following steps:
1. Open the VisPro/C++ icon on your desktop. To do so, double-click the
folder.
2. Open the Projects folder in the VisPro/C++ folders Icon View window. To do
so, double-click the Projects folder.
3. Create a new Project folder. To do so, press the right mouse button and
drag a folder off the Project template in the Projects - Icon View window.
A Project folder appears.
4. Rename your Project folder. To do so, select the Project folder and press
Alt while you click the left mouse button. Type the name you want to assign
to your new application.
Click outside of the folder. This 'sets' the name for the Project folder.
5. Open your Project folder. To do so, double-click the folder icon.
The icon view for your new application appears. You will see a Main icon.
The Main icon is the form you use to begin designing your application.
After your application is complete, do not delete, move, or rename the Main
form.
The next section details the ways in which a form may be accessed.
ΓòÉΓòÉΓòÉ 2.3. Opening the Main Form ΓòÉΓòÉΓòÉ
To begin creating your application, you can open the Main form in one of two
ways:
o METHOD A:
Double-click on the Main icon. The form appears in the Layout view,
presenting the tool bar and the canvas. This view allows you to easily design
your form.
o METHOD B:
Select the Main icon, and then click the right mouse button to get the pop-up
menu for the Main icon. Select Open. A cascading menu appears, allowing you
to select the view you want to begin working with. The Layout view is
recommended for designing the layout of your form.
You may also generate source code and start a compilation from the pop-up
menu, without having to open your project.
ΓòÉΓòÉΓòÉ 2.4. Using VisPro/C++'s Online Help ΓòÉΓòÉΓòÉ
VisPro/C++ includes an extensive online help system that you can use if you
have questions while you are working. To get information about how the online
help works, select the Help menu. A cascading menu appears, presenting the
following menu items
o Help Index....
o General Help....
o Using Help....
o Product information....
You can select any of these items. To find out what information each of these
items provides, highlight the item (use the arrow keys), and then press F1.
Note: You can browse the help using the online help Contents. To use the
Contents, select the OPTIONS menu from within any help window, and then select
CONTENTS.
ΓòÉΓòÉΓòÉ 2.5. Using the C/C++ Online Language Reference ΓòÉΓòÉΓòÉ
If you require information about C++, you can use the excellent C++ Online
Language Reference that comes with the CSET++ compiler. To use the reference,
double click on the IBM C/C++ Tools folder in your Workplace Shell. Then double
click the C/C++ Online Language Reference icon in the Icon View window.
You may also wish to use the QwikInf facility which comes with the IBM Toolkit
to speed access to your most used programming references. To find out more
about KwikInf, start it by selecting the KwikInf Icon from the Toolkit
Information folder of the Toolkit 2.1 Icon folder.
ΓòÉΓòÉΓòÉ 3. Limitations of the Evaluation Version ΓòÉΓòÉΓòÉ
The Evaluation Version of VisPro/C++ differs from the full product in several
key aspects:
o No user's guide or reference is provided. However, you can get enough
information to get started by viewing this README file and by referring to
the online help. The full product comes with a complete user's guide which
includes detailed information on how to use VisPro, a description of the
structure of the generated code, full descriptions on all the add on objects,
and much more.
o The evaluation version is limited to generating the source for projects with
two windows (forms). Also each form is limited to at most 10 objects.
Obviously, these limitations are not part of the full product.
o The Database Designer is not included in the Evaluation version. This feature
allows you to design DB2/2 applications or reverse engineer existing DB2/2
databases to create entity/relationship (E/R) diagrams. These can then be
used to create visual SQL statements or to automatically generate the code
used to access Database Manager-DB2/2 calls. Using the Database Designer you
can construct a form accessing a database table with a single drag and drop
operation.
_________________________________________
The VisPro/C++ Database Designer.
o The VisPro add-on objects are not included in the Evaluation Version. These
objects are business graphics, formatted entry field, spreadsheet, clock, and
calendar. All of these are C++ objects integrated with the User Interface
Class library.
_________________________________________
A sample application displaying some of the add-on objects.
You can use these classes in any or your C++ applications, even those not
generated by VisPro.
Business graphics
Add pizzaz to your business related applications by using this control.
Displays your data in bar, stacked bar, pie, line and area charts
formats. You can control many style options including 3D effects and
colors.
Formatted entry field
Displays a text entry area that has specific formats of data, including
date, time, uppercase, or a customizable picture mask.
Spreadsheet
Allows users to enter and display data in spreadsheet format. You can
control the number of rows and columns, as well as other spreadsheet
attributes. This is ideal for providing you applications with a way of
entering information in column fashion.
Calendar
This monthly calendar provides you applications with a quick and easy way
of specifing date information.
Clock
The clock control displays the time in analog, digital and military
format.
_________________________________________
A sample application displaying the clock object in analog, digital and military format.
o The evaluation version is shipped with only one sample program. The full
product currently has several, including samples showing how to use the
container and the VisPro add-on objects,
o The resource information for each window is generated in binary form in the
Evaluation Version. As a result, it is not possible to modify these outside
the VisPro environment. In the full product, this information is generated in
textual form, allowing for easy inspection and modification.
o The product information window is forced to the foreground every time you
enter the Evaluation Version of the VisPro editor. In the full product, you
can choose not to view this window.
o After opening the layout view 40 times, the evaluation version will bring a
window telling you that you have used it 40 times. After this, you will no
longer be able to bring up the layout editor.
ΓòÉΓòÉΓòÉ 4. Sample Project ΓòÉΓòÉΓòÉ
This section describes the steps you follow to create a simple data entry
application using a variety of standard objects. Your final application should
look something like this:
To use the application, a user types text into the entry field at the top of
the project. Selecting the Add push button or pressing the Enter key adds the
item in the entry field to the end of the list box in ascending or descending
order, depending on the state of the Sort order radio buttons.
If the user selects Clear, the contents of the list box and entry field are
deleted, and the text insertion cursor is placed in the entry field for further
processing.
To create the data entry application, complete the steps in each of the
following sections.
1. Start the Application
2. Add the Objects
3. Size and Align Objects
4. Provide Behavior
5. Changing the Order of the Objects
6. Compile and Execute the Application
ΓòÉΓòÉΓòÉ 4.1. Start the Application ΓòÉΓòÉΓòÉ
To start the application and name it, complete the following steps:
1. Double-click on the VisPro/C++ icon in the Workplace Shell.
2. Double-click on the PROJECTS folder in the VisPro/C++ Icon View window.
The Projects - Icon View window appears.
3. Drag a new project off the Project template (hold down the right mouse
button and drag to an empty space in the Projects folder, then release).
4. Use direct editing to name the new project Data (press the Alt key and
click the left mouse button at the same time). Type Data over the existing
name.
5. Double-click on the Data project.
The Data - Icon View window appears. You will see the following icons:
o Main form, which is the form you use to begin designing your application.
After your application is complete, do not delete, move, or rename the
Main form.
o Form template, which allows you to drag off additional forms if you want
your application to have more than one window.
o SubProcs folder, which allows you to incorporate existing C++ code into
your application or to group commonly used code segments so they can be
called anywhere in your program.
o Source folder, which contains all of the source code for your project. The
source code is created by selecting either Generate source or Generate and
compile from the project's Form menu.
o OPTIONS.MKP, is a file which contains the build options for your
application. It is invoked by double-clicking the OPTIONS.MKP icon.
o RESOURCE.VPP, is a file which contains external resources for your
application, such as bitmaps or pointers. You can start the VisPro
Resource editor by double-clicking on the RESOURCE.VPP file.
6. Double-click on the Main icon.
The Layout view for the application appears.
The Form Layout view is the environment in which you design the window that
your user will perform tasks with. For each window your user works with,
you create a form. This application will consist of a single form.
The form consists of two main parts: the Tool Bar/Palette and Canvas.
ΓòÉΓòÉΓòÉ 4.1.1. The Tool Bar/Palette ΓòÉΓòÉΓòÉ
_________________________________________
The VisPro/C++ Tool palette. An * denotes objects that are not
included in the Evaluation version.
About the Tool Bar
The tool bar and tool palette consist of a series of icons. Each icon
represents a tool. Each tool is used to place a certain kind of object on the
canvas. For example, the push button tool places a push button object on the
canvas.
An object is a graphical item that can be used to perform tasks. Radio buttons
and list boxes are examples of objects.
The difference between a tool and an object is that a tool is a graphical
representation of something that can be added to the canvas. Once added, it
becomes an object that can be used to perform tasks.
You can turn off the tool bar by selecting Open and then Settings from the Form
menu. Select the Options page and deselect Show tool bar. You can also use the
Options page to select the tool palette. If you select Save defaults, all the
defaults you have set for the form are saved, including fonts, grid spacing,
etc.
Saving defaults affects the defaults for every other project you create. If you
do not select Save defaults, your changes will affect only the project the
change was made in.
ΓòÉΓòÉΓòÉ 4.1.2. The Canvas ΓòÉΓòÉΓòÉ
_________________________________________
The VisPro/C++ Layout view, showing the tool bar and tool palette.
About the Canvas
The canvas is the open, gridded area below the tool bar. This is the area in
which you will design (or lay out) your form. You select the tools you need
from the tool bar or tool palette and add them to the canvas. Once objects are
added to the canvas, you can customize their appearance and provide behavior
for them.
You can turn off the grid in the canvas by selecting Open and then Settings
from the Form menu. Select the Options page and deselect Show grid. If you
select Save defaults, all the defaults you have set for the form are saved,
including fonts, grid spacing, etc. Saving defaults affects the defaults for
every other project you create. If you do not select Save defaults, your
changes will affect only the project the change was made in.
Note: Snap to grid forces the object to align with the nearest grid line. If
you do not want to use this feature, deselect it.
ΓòÉΓòÉΓòÉ 4.2. Add the Objects ΓòÉΓòÉΓòÉ
In this section, you add the objects from the toolbar to the Layout view of
your application. You will then specify characteristics, such as a unique name,
for those objects. You specify these characteristics using the Settings view
for the objects.
The application consists of a text object, two push buttons, two radio buttons,
a list box, and an entry field.
Complete the steps in the following sections to add the objects and define
settings for them.
ΓòÉΓòÉΓòÉ 4.2.1. Add Push Button ΓòÉΓòÉΓòÉ
In this section, you add a push button to the canvas. You then use the Settings
view of the push button to specify that it will be named Add. In addition, you
use the Settings view to provide a descriptive name (known as a symbol) for the
push button. This descriptive name makes it easy to identify the object when
you begin programming.
1. Select the Push button tool from the tool bar.
2. Click inside the canvas to place a push button approximately where you see
it in the figure of the application (the bottom left corner of your form).
3. Double-click the push button.
The Settings view notebook for the push button appears, displaying the
Style page.
4. Select the Default check box. This causes the ADD push button to be
selected whenever the Enter key is pressed.
5. Select the General tab on the Settings notebook.
6. Select the Text field, and type ~Add. This causes the push button to appear
with the label Add on the Layout view, and when the application is run. The
tilde (~) character in front of the A places an underscore beneath the A
character, allowing the user to select the ADD push button by pressing the
Alt-A combination.
Note: An alternative method for specifying the name of the object is to use
direct editing. The General page is recommended here for convenience
because you will be specifying other settings for the object.
7. Select the Symbol field, and type ADD. Do not change the default ID.
Note: Symbol is a unique name you supply that identifies an object. The ID
is a unique integer used to identify an object. The Symbol is optional, but
you include it because a symbol with a de scriptive name is easier to refer
to.
8. Select Close from the title bar icon menu (the symbol at the top left-hand
corner of the Settings view window).
ΓòÉΓòÉΓòÉ 4.2.2. CLEAR Push Button ΓòÉΓòÉΓòÉ
In this section, you add another push button to the canvas. You then use the
Settings view of the push button to specify that it will be named CLEAR. In
addition, you use the Settings view to provide a descriptive name (known as a
symbol) for the push button. This descriptive name makes it easy to identify
the object when you begin programming.
1. Select the Push button tool from the tool bar.
2. Click inside the canvas to place a push button approximately where you see
it in the figure of the application (to the right of the ADD button).
3. Double-click the push button.
The Settings view notebook for the push button appears, displaying the
Style page. The defaults are used for the Style page.
4. Select the General tab on the notebook. Select the Text field, and type
~Clear. This causes the push button to appear with the label Clear when the
application it run. The tilde (~) character in front of the C places an
underscore beneath the C character, allowing the user to select the CLEAR
push button by pressing the Alt-C combination.
Note: An alternative method for specifying the name of the object is to use
direct editing. The General page is recommended here for convenience
because you will be specifying other settings for the object.
5. Select the Symbol field, and type CLEAR. Do not change the default ID.
Note: Symbol is a unique name you supply that identifies an object. The ID
is a unique integer used to identify an object. The Symbol is optional, but
you include it because a symbol with a descriptive name is easier to refer
to.
6. Select Close from the title bar icon menu (the symbol at the top left-hand
corner of the Settings view window).
ΓòÉΓòÉΓòÉ 4.2.3. Items List Box ΓòÉΓòÉΓòÉ
To add and define settings for the Items list box, complete the following
steps:
1. Select the List box tool from the tool bar.
2. Click inside the canvas to place the list box above the CLEAR and ADD push
buttons.
3. Double-click the list box.
The Settings view notebook for the list box appears.
4. Select the General tab on the notebook.
5. Select the Symbol field, and type ITEMS. Do not change the default ID.
6. Select Close from the title bar icon menu.
ΓòÉΓòÉΓòÉ 4.2.4. Sort Order Radio Buttons ΓòÉΓòÉΓòÉ
Two radio buttons, Ascending and Descending, will now be added to your project.
Radio buttons represent a mutually exclusive choice that the user of your
project must make. That is, only one of these buttons can be highlighted at a
time. Radio buttons (and check boxes) are generally used only to show a
selection state in your applications.
To add the Ascending and Descending radio buttons to your project, complete the
following steps:
1. To accomodate the next several objects, increase the size of your form by
positioning the mouse pointer over the top border of your form window.
2. Right click and drag the form window up about an inch, then release the
mouse to set the new form position.
3. Select the Radio button tool from the tool bar.
4. Click inside the canvas to place two radio buttons, one over the other,
above the Items list box.
5. Double-click the top radio button.
The Settings view notebook for the radio button appears.
6. Select the Group check box on the Style page. This provides a mutually
exclusive behavior for the two radio buttons (you should only select the
Group check box for the first radio button in a group).
7. Select the General tab on the notebook.
8. Select the Text field, and type Ascending.
9. Select the Symbol field, and type ASCENDING. Do not change the default ID.
10. Select Close from the title bar icon menu.
11. Double-click the lower radio button.
The Settings view notebook for the radio button appears.
12. Select the General tab on the notebook.
13. Select the Text field, and type Descending.
14. Select the Symbol field, and type DESCENDING. Do not change the default ID.
15. Select Close from the title bar icon menu.
ΓòÉΓòÉΓòÉ 4.2.5. Sort Order Text Object ΓòÉΓòÉΓòÉ
To add and define settings for the Sort order text object, complete the
following steps:
1. Select the Text object from the tool bar.
2. Click inside the canvas to place the text object above the Ascending radio
button.
3. Double-click the text object.
The Settings view notebook for the text object appears.
4. Select the General tab on the notebook.
5. Select the Text field, and type Sort order.
6. Select Close from the title bar icon menu.
ΓòÉΓòÉΓòÉ 4.2.6. Data Entry Field ΓòÉΓòÉΓòÉ
To add and define settings for the Data entry field, complete the following
steps:
1. Select the Entry field tool from the tool bar.
2. Click inside the canvas to place an entry field tool on the canvas, above
the Sort order text object.
3. Double-click the entry field.
The Settings view notebook for the entry field appears.
4. Select the General tab on the notebook.
5. Select the Symbol field and type DATA. Do not change the default ID.
6. Select Close from the title bar icon menu.
ΓòÉΓòÉΓòÉ 4.3. Size and Align Objects ΓòÉΓòÉΓòÉ
To adjust the objects so that text fits inside each object, complete the
following steps:
1. Select the objects that contain text (the text object and radio buttons).
An easy way to select multiple objects is to use drag selection. Place the
mouse pointer over the first object and press the left mouse button. Hold
it down as you move the mouse to select the other objects. Then release the
mouse button.
The selected objects are highlighted.
2. From the Selected menu, select Arrange, and then select Fit to Text.
The objects you selected change size to accommodate the text inside.
Note: You did not fit the text for the entry field because the text in the
entry field changes when the field is used, depending upon the total. You
did not change the push buttons because they need to be equal sizes.
ΓòÉΓòÉΓòÉ 4.4. Provide Behavior for the Application ΓòÉΓòÉΓòÉ
You will now program the application so that it works as described at the
beginning of this section. You can provide behavior for the application from
the Layout view. However, we will use the Event tree view because it allows you
to easily see both the objects and the C++ statements for the behavior you
specify.
To switch to the Event tree view, select Event tree view from the View menu.
The objects you added to your application appear on the left. The Event window
appears on the right.
In the following sections, you will provide behavior for the When opened event,
the ADD push button, and the CLEAR push button.
ΓòÉΓòÉΓòÉ 4.4.1. Form Constructor Event (When Opened) ΓòÉΓòÉΓòÉ
When the user starts this project, one of the two radio buttons should be
highlighted (since they are mutually exclusive, and one or the other must
always be highlighted).
The Form constucter event is where all form initialization takes place: such as
loading list boxes with data and setting display styles for objects.
To select the Ascending radio button from the Form constructor event, complete
the following steps:
1. From the Form menu, select Code sections, and then Form constructor (when
opened).
The Code Section Form constructor window appears. The top of the Event
window displays the following statement for Form constructor:
/* Code Section Form constructor (when opened) - Form DATA\Main */
2. We will be dragging objects to the Form constructor window from the Event
tree view. Position the Form constructor window so that the left side of
the window is visible beneath the Event tree view of your project.
Select the title bar of the Event tree view window to make it active.
3. Move the mouse pointer over the Ascending radio button icon (on the left
side of the Event tree view), and hold down the right mouse button as you
drag from the Ascending radio button icon on the Event tree view to the
Form constructor window. Release the mouse when you reach a point below the
existing code on the Form Constructor window.
The Create Link window appears.
4. Select Check the item from the Create Link window, then select OK.
SHORTCUT METHOD: Double-click Check the item.
The following C++ statement appears:
/* Check the item ASCENDING Radio Button */
ASCENDING->select();
5. Select Save from the Event menu.
NOTE: The Save option on the menu may be disabled. This is because
VisPro/C++ by default automatically saves your form every 15 seconds. To
change this interval, or disable autosave, select the appropriate check box
from the Options page of your form's Settings view.
The code in the Form constructor window should look like this when your are
finished:
/* Code Section Form constructor (when opened) - Form DATA\Main */
/* Check the item ASCENDING Radio Button */
ASCENDING->select();
ΓòÉΓòÉΓòÉ 4.4.2. ADD Push Button ΓòÉΓòÉΓòÉ
The ADD push button takes the value found in the entry field and adds it to the
list box. To provide this behavior, complete the following steps:
1. From the Event tree view, select the ADD push button.
2. From the Selected menu, select When, and then Clicked/Selected.
The following C++ statements appear in the top of the Event window.
/* Event ~Add ADD, Clicked/selected */
IString aTextValue="text";
unsigned long anUnsignedValue=0;
3. Make sure the ADD push button Clicked/selected event is highlighted. Then
drag the DATA entry field into the Event window, below the existing C++
statements, and release the mouse button.
The Create Link window appears.
4. Select Get item value, and then select OK.
The following C++ statement appears:
/* Get item text DATA Entry Field */
aTextValue=DATA->text();
5. Move the mouse pointer over the Ascending radio button icon. Then drag the
Ascending radio button into the Event window, below the existing C++
statements, and release the mouse button.
The Create Link window appears.
6. Select Is button selected?, then select OK.
The following C++ statement appears:
/* Is button selected? ASCENDING Radio Button */
IBoolean aBoolean = ASCENDING->isSelected();
7. On a new line below this statement, type the word if (followed by a space).
The following code template will be added:
if ()
{
} else {
} /* end if */
8. In the parenthesis, type
aBoolean == 1
Move the cursor down one line and to the right of the bracket ({), and
press Enter to insert a blank line in your code template. This provides
space to insert the code for the next step.
9. Make sure the ADD push button Clicked/selected event is highlighted. Then
drag the Items list box into the Event window, into the blank line created
by the previous step.
The Create Link window appears.
10. Select Add item sorted ascending, and then select OK.
The following C++ statement appears:
/* Add item sorted ascending ITEMS List Box */
ITEMS->addAscending(aTextValue);
11. Insert a blank line between the lines containing the words else and end if.
12. Make sure the ADD push button Clicked/selected event is highlighted. Then
drag the Items list box into the Event window, and into the blank line
created by the previous step.
The Create Link window appears.
13. Select Add item sorted descending, and then select OK.
The following C++ statement appears:
/* Add item sorted descending ITEMS List Box */
ITEMS->addDescending(aTextValue);
Now that the text has been added to the list box, we will delete the
contents of the entry field, and give it focus. This allows the user to
begin typing a new value without having to delete the previous value.
14. Make sure the ADD push button Clicked/selected event is highlighted. Then
drag the DATA entry field into the Event window, below the existing
statements.
The Create Link window appears.
15. Select Clear all, and then select OK. This deletes the contents of the DATA
entry field.
The following C++ statement appears:
/* Clear all DATA Entry Field */
DATA->setText("");
16. Drag the DATA entry field into the event window once more, releasing the
mouse below the existing statements in the event window:
The Create Link window appears.
17. Select Give focus to window, and then select OK.
The following C++ statement appears:
/* Give focus to window DATA Entry Field */
DATA->setFocus();
18. Select Save from the Event menu.
When you are finished with the ADD push button, your code will look like this:
/* Event ~Add ADD, Clicked/selected */
IString aTextValue="text";
unsigned long anUnsignedValue=0;
/* Get item text DATA Entry Field */
aTextValue=DATA->text();
/* Is button selected? ASCENDING Radio Button */
IBoolean aBoolean = ASCENDING->isSelected();
if (aBoolean == 1)
{
/* Add item sorted ascending ITEMS List Box */
ITEMS->addAscending(aTextValue);
} else {
/* Add item sorted descending ITEMS List Box */
ITEMS->addDescending(aTextValue);
} /* end if */
/* Clear all DATA Entry Field */
DATA->setText("");
/* Give focus to window DATA Entry Field */
DATA->setFocus();
ΓòÉΓòÉΓòÉ 4.4.3. CLEAR Push Button ΓòÉΓòÉΓòÉ
The CLEAR push button deletes everything in the Items list box and the DATA
entry field, then places the cursor in the DATA entry field to allow further
input. To provide this behavior, complete the following steps:
1. From the Event tree view, select the CLEAR push button.
2. From the Selected menu, select When, and then Clicked/Selected.
The following C++ statements appear in the Event window.
/* Event ~Clear CLEAR, Clicked/selected */
IString aTextValue="text";
unsigned long anUnsignedValue=0;
3. Make sure the CLEAR push button Clicked/selected event is highlighted. Then
drag the Items list box into the Event window, below the existing C++
statement, and then release the mouse button.
The Create Link window appears.
4. Select Delete all items, and then select OK.
The following C++ statement appears:
/* Delete all items ITEMS List Box */
ITEMS->removeAll();
5. Next, drag the DATA entry field into the event window, below the existing
C++ statements, and then release the mouse button.
The Create Link window appears.
6. Select Clear all and then select OK.
The following C++ statement appears.
/* Clear all DATA Entry Field */
DATA->setText("");
7. Drag the DATA entry field into the event window, below the existing C++
statements, and then release the mouse button.
The Create Link window appears.
8. Select Give focus to window, and then select OK.
The following C++ statement appears:
/* Give focus to window DATA Entry Field */
DATA->setFocus();
9. Select Save from the Event menu.
When you are finished editing the CLEAR push button, your code will look like
this:
/* Event ~Clear CLEAR, Clicked/selected */
IString aTextValue="text";
unsigned long anUnsignedValue=0;
/* Delete all items ITEMS List Box */
ITEMS->removeAll();
/* Clear all DATA Entry Field */
DATA->setText("");
/* Give focus to window DATA Entry Field */
DATA->setFocus();
ΓòÉΓòÉΓòÉ 4.5. Changing the Order of the Objects ΓòÉΓòÉΓòÉ
When the application starts, the ADD push button is given focus. This means
that it is the currently selected object in your form. To give the DATA entry
field focus, click on it with the left mouse button, or press Shift+Tab from
the keyboard.
In this section, we will use the List view to give focus to the DATA entry
field when the application is started. This prevents the user from having to
select the DATA entry field before typing data. To move to the List view,
select List view from the View menu.
Each row in the List view represents an object in the Layout view. The object
type and icon appear on the left of the split bar, with other attributes on the
right. In this view, you can use direct editing to change the Text identifier
for an object, as well as the Symbol name (descriptive name) for an object.
To give focus to the DATA entry field when your application is started,
complete the following steps:
1. Select the DATA entry field row by left-clicking on it with the mouse.
The DATA entry field row is highlighted.
2. With the mouse cursor on the DATA entry field row, right-click and drag the
mouse pointer until it is just above the ADD push button row.
A solid horizontal line appears above the ADD push button row.
3. Release the mouse button, and the DATA entry field appears above the ADD
push button in the object order.
You could also programmatically give the focus to the entry field in the
'When opened' event for the main form. The technique you just used,
however, is much faster to implement and visualize if your are working with
many objects.
4. Select Generate and compile from the Form menu, then double-click on the
RUN.EXE program object in your project folder to see your changes.
ΓòÉΓòÉΓòÉ 4.6. Compile and Execute the Application ΓòÉΓòÉΓòÉ
To compile the application, select Generate and compile from the Form menu.
The VisPro Viewer appears, displaying the compilation progress and notifying
you when the compilation is complete.
If there is an error in your code, it will be displayed in the VisPro/Viewer
output window. Double-click on that error line in the VisPro Viewer, and the
event window containing the error will appear for you to correct.
To run the application, double-click the left mouse button on the file RUN.EXE,
which is located in the source folder of your project.
ΓòÉΓòÉΓòÉ 5. How To Order VisPro/C++ ΓòÉΓòÉΓòÉ
VisPro/C++ is available directly from HockWare or from your favorite software
reseller.
Telephone FAX:
(919) 380-0616, Fax: (919) 380-0757
CompuServe:
CompuServe ID#: 71333,3226
You can reach our forum in the OS/2 Vendors forum by typing GO HOCKWARE
Internet:
Internet ID: hockware@vnet.net
ADDRESS:
HockWare Incorporated, P.O. Box 336, Cary, NC 27512-0336 (USA)
The next section contains an online order form, which you may print out to use
when mailing or faxing your order to us.
ΓòÉΓòÉΓòÉ 5.1. Order Form for VisPro/C++ ΓòÉΓòÉΓòÉ
SHIPPING ADDRESS: BILLING ADDRESS:
Name: ____________________________ Name: ____________________________
Company: _________________________ Company: _________________________
Address: _________________________ Address: _________________________
__________________________________ __________________________________
City: ____________________________ City: ____________________________
State: ___________________________ State: ___________________________
Country: _________________________ Country: _________________________
Zip: _____________________________ Zip: _____________________________
Phone: ___________________________ Phone: ___________________________
FAX: _____________________________ FAX: _____________________________
PAYMENT METHOD: (Circle)
Check Purchase Order(Include copy of PO) Credit Card: Visa Amex MC
Wire Transfer Account Number:
______________________________
Expiration Date: _____________
UPS SHIPPING and HANDLING FEES: (Alaska, Hawaii, Puerto Rico and Intnl.
shipping fees vary. Please call.)
Ground: 1-3 Copies $7.00 each additional copy: $2.00
2nd day air: 1 copy 15.00 each additional copy: 4.00
Next day air: 1 copy 25.00 each additional copy: 6.00
ITEM QUANTITY UNIT PRICE TOTAL
VisPro/C++ __________ $399.00 _____________
VisPro/C __________ $399.00 _____________
SUBTOTAL _____________
Sales Tax
(residents of NC, 6% subtotal) _____________
Shipping _____________
TOTAL _____________
Where did you hear about VisPro/C++? Please list the name of the
magazine or other source. Thanks!
Article __________________________ Catalog _____________________________
Advertisement ____________________ Direct Mail _________________________
Electronic Bulletin ______________ Other _______________________________
HockWare, Inc. Telephone (919) 380-0616 FAX (919) 380-0757