Intro
Intro
Copyright
Copyright 2000 by Centura Software Corporation. All rights reserved.
Introducing Centura Team Developer
20-6200-0004
May 2000
Title: Introducing Centura Team Developer
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .x
What you need to know . . . . . . . . . . . . . . . . . . . . . .x
What is in this manual. . . . . . . . . . . . . . . . . . . . . . . .x
Typographical conventions . . . . . . . . . . . . . . . . . . . xi
Other helpful resources . . . . . . . . . . . . . . . . . . . . . xii
Send comments to.... . . . . . . . . . . . . . . . . . . . . . . . xii
Preface
The purpose of this manual is to help you install Centura products on your
workstation and to get started building applications and managing projects. The
preface explains:
• This manual’s audience.
• What is in the manual.
• Conventions used in the manual.
• Other helpful resources.
• Where to send comments.
Audience
Introducing Centura Team Developer is for first-time Centura users, users looking to
try the new features of Centura Team Developer, or for those evaluating Centura for
use within their organization. This document helps you become familiar with Centura
interface and powerful programming tools.
Typographical conventions
Before you start using this manual, it is important to understand the typographical
conventions we use in this manual:
bold type Menu items, push buttons, and field names. Things that
you select. Keyboard keys that you press.
courier type Commands or code you must enter through the keyboard
exactly as shown.
Note: We use this Note: convention to call your attention to special information.
Chapter 1
Using SQLWindows
This chapter starts you building applications with Centura SQLWindows, the next
generation client/server application development and deployment environment for
Windows. To explore the SQLWindows desktop, read Chapter 6, Centura Desktop
and Components. There you can learn about the outline and tools you use in this
tutorial such as the Coding Assistant and the Attribute Inspector.
SQLWindows lets you code and layout applications in an integrated graphical
environment that includes:
• Multiple configurable source code and user interface views.
• Drag-and-drop user interface design.
• Context-sensitive coding assistant and online help for all functions.
• Interactive debugging.
• Multiple dockable toolbars.
This chapter contains:
• Procedures for installing the Centura software.
• A tutorial that builds a fully functional SQLWindows application.
Select Close
When you select Close, SQLWindows returns you to Designtime mode, where you
can continue development on your application. You are now ready to build the
AccountInfo.app application yourself. To begin, select New from the File menu.
SQLWindows asks you if you would like to use newapp.app as the template for your
application. Click OK.
Dialog overview
This application has two windows; a Login dialog and a form for displaying database
information. To build the Login dialog, you:
• Create a dialog with three data fields and two push buttons.
• Code the data fields to accept a database, username, and password.
• Code the OK push button to accept the dialog information and open the
Account Information window.
• Code the Cancel push button to cancel the dialog.
If you followed the steps in the previous section, you are running SQLWindows. A
blank application template is ready for your use. Your workspace looks like this.
Left Pane
2. With focus on the dialog, select Attribute Inspector from the Tools menu. Type
dlgLogin in the Dialog Box: field at the top and Database Login in the
Object Title field.
dlgLogin
Database Login
3. Select Controls from the Tools menu to bring up the Controls toolbar. Select the
standard data field from the Controls palette, move your cursor over the dialog,
and click to drop the data field on the dialog box.
Data field
4. With the focus on the data field, go to the Attribute Inspector. Change the Data
field name from df1 to dfDatabase.
5. From the Controls toolbar, drop a second standard data field under the first one in
the dialog window. In the Attribute Inspector, change the Data Field name from
df2 to dfUser. Then drop a third standard data field under the second. In the
Attribute Inspector, change the Data Field name from df3 to dfPassword.
Your dialog looks like this:
6. Now label the data fields. Click the standard Background Text on the Controls
palette and drop this object on the dialog to the left of the first data field.
7. Enter the text Database. Drop a second background text object next to the
second data field and type User Name on it. Drop a third background text object
next to the third data field and type Password on it. Your dialog looks like this:
Push Button
9. Drop the push button object on the bottom of the dialog box, and type OK. With
the focus on the push button, go to the Attribute Inspector. Change the Pushbutton
name from pb1 to pbOK.
10. Select the standard push button from the Controls palette again. Drop this second
push button on the dialog to the right of the OK push button. Type Cancel on
the push button. In the Attribute Inspector, change the Pushbutton name from pb2
to pbCancel. Your dialog looks like this:
You need to code functionality into the objects on your dialog. Some of that
functionality connects the dialog to the form window of the application. Therefore,
before coding the items in the dialog, you must create the form window.
11. Click on the Outline tab in the right pane of SQLWindows. In the left pane, click
Application1. Right-click the Windows section underneath it. Select New, Form
Window from the menu that appears. Type frm1. In the Attribute Inspector,
there is an option for Automatically Create; change this to No. Type Account
Info in the Object Title field. Your new form looks like this:
3. Type hSql in the outline. In the Coding Assistant, double-click Boolean to add
it to your outline. Type bConnect in the outline. Your outline looks like this:
4. Press Enter to insert a line. Double-click Call in the lower part of the Coding
Assistant. Start typing SalCreateWindow in the text box below the list combo
box in the upper part of the Coding Assistant. Press Enter when
SalCreateWindow becomes highlighted in the function list.
Call SalCreateWindow( Template, Window_Handle ) appears in
your outline. Template, Window_Handle is highlighted.
5. Type:
frm1, hWndNULL
This replaces Template, Window_Handle.
6. Click On SAM_AppStartup. This tells SQLWindows where in the outline to
insert the next call.
7. Double-click On SAM_AppExit in the upper part of the Coding Assistant.
Double-click If in the lower part of the Coding Assistant. Type bConnect, so that
your outline now reads If bConnect. Press Enter.
8. Double-click Call in the lower part of the Coding Assistant. Start typing
SqlDisconnect in the text box below the list combo box in the upper part of
the Coding Assistant. Press Enter when SqlDisconnect becomes highlighted in
the function list.
Call SqlDisconnect( Sql_Handle ) appears in your outline.
Sql_Handle is highlighted. Type hSql over it. Your outline looks like this:
On SAM_AppStartup
If SalModalDialog( dlgLogin, hWndNULL, 'ISLAND', 'SYSADM',
'SYSADM' )
Call SalCreateWindow( frm1, hWndNULL )
On SAM_AppExit
If bConnect
Call SqlDisconnect( hSql )
Define parameters
1. Click Window Parameters under the dlgLogin section in the outline. In the
Coding Assistant, double-click String, then type strDefDatabase and press
Enter.
2. Double-click String again, and type strDefUser. Press Enter.
3. Double-click String again, and type strDefPassword. The outline looks like
this:
Window Parameters
String: strDefDatabase
String: strDefUser
String: strDefPassword
You have just finished building and coding your Login dialog! You:
• Created a dialog with three data fields and two push buttons.
• Coded the data fields to accept a database, username, and password.
• Coded the OK push button to accept the dialog information and open the
Account Information window.
• Coded the Cancel push button to destroy the dialog when clicked.
Note: You can also select Go from the Project menu, or click the Compile (checkmark) icon
on the toolbar.
2. Click Yes.
A dialog appears where you can specify the directory where you want to store your
application and specify the name of the application.
3. Type Account.app in the Filename field. Click Save.
Close
1. Right-click on the frm1 window in the Outline. Select Preview Window from the
menu that appears. The desktop looks like this:
2. Click the standard background text control on the Controls palette and drop this
on the left side of the form. Enter the text Company ID. Repeat this step for each
of the following labels:
Invoice Number
Company Name
Date of Invoice
Status
Date Paid
Employee ID
Amount Paid
Note: An easy way to align fields and labels so they look nice is to hold down the Shift key and
click on the various fields until they are all selected. Then, choose Align from the Layout menu.
3. Select the standard data field from the Controls palette and drop a data field next
to each label, with attributes for each as follows (use the Attribute Inspector):
4. Click the data field next to Date of Invoice. Use the Attribute Inspector to change
the Format to MM-dd-yy. Repeat this step for Date Paid.
5. Select the standard child table window from the Controls palette and drop this at
the bottom of the form.
FROM INVOICE
INTO
:dfINVOICE_NO,
:dfCOMPANY_ID,
:dfCOMPANY_NAME,
:dfINVOICE_DATE,
:dfDATE_PAID,
:dfSTATUS,
:dfAMOUNT_PAID,
:dfEMPLOYEE_ID' )
Note: When you enter this code without the Coding Assistant, you begin by pressing the Insert
key. Then, type the programming statement. To add the next statement, press Enter. To continue
a programming statement to the next line, press CTRL + Enter.
To indent the current line for a programming statement, hold down the Alt key and press the
right arrow key. If you are indenting for readability only, use the Tab key.
:dfCOMPANY_NAME,
:dfINVOICE_DATE,
:dfDATE_PAID,
:dfSTATUS,
:dfAMOUNT_PAID,
:dfEMPLOYEE_ID' )
Call SqlExecute( hSql )
Call GetResultSetCount (hSql, nLastRecord)
Call SqlFetchNext( hSql, nFetch )
Pushbutton: pbFirst
Message Actions
On SAM_Click
Call PopulateFormWindow( )
Type:
Call tblINVOICE_ITEM.PopulateChildTable( )
Your code for this push button looks like this:
Pushbutton: pbLast
Message Actions
On SAM_Click
If SqlFetchRow( hSql, nLastRecord - 1, nFetch )
Call tblINVOICE_ITEM.PopulateChildTable( )
You have now added navigational push buttons. They let the user browse to and fro in
the database records. You are finished building the Account Information application.
Note: You can also select Go from the Project menu, or click the Compile (checkmark) icon
on the toolbar.
4. Use the push buttons at the top to browse through various records.
Chapter 2
Centura SQLWindows
Windows NT and Windows 9x are 32-bit, pre-emptive multitasking operating
systems that run on the latest generation of microprocessors. Native 32-bit
applications provide scalability, performance and robustness for demanding mission-
critical business applications. Centura applications run as native 32-bit applications
on Windows NT 4.0 and Windows 9x. You use Centura SQLWindows to build these
32-bit applications.
Centura SQLWindows has a user interface that closely matches the look and feel of
Windows 9x. The primary UI control is similar to the Windows Explorer, where
navigation is by components in the left pane (tree view) of a window, and the right
pane (tab view) of the window shows the contents of the component selected.
A Tabbed view
provides more than
one way of looking
at an application.
Centura Desktop
You have already been introduced to Centura SQLWindows in Chapters 1 and 2
where you built Centura applications. Here, you get a more detailed explanation of
some of the desktop features.
The desktop is a highly graphical and easy-to-use environment. Some of the tolls
include a toolbar, an application window, tabbed application views, status bar, and a
Controls toolbar make up the SQLWindows environment.
Toolbars
Controls
Toolbar
Tree Tab
View Views
Status Bar
These tools assist you in creating the various parts of an application, navigating
through it, and enhancing it as your project grows.
• Use the toolbar icons to build and edit your application quickly and easily.
• Use the application tree view and tab views to navigate through the sections
of your code and as a visual summary of your application.
• Use the tab views to see various presentations of different sections of your
application code. As you build an application, Centura automatically adds the
appropriate items to your outline.
• Use the status bar to see the setting of the Num Lock, Scroll Lock, and Caps
Lock keys, and get other helpful information.
• Use the Controls toolbar to add graphical objects like push buttons, data
fields, and ActiveX objects to your layout.
Toolbar
The toolbars provide icons that help you build and edit your application quickly and
easily. They also provide quick access to various components of Centura.
You can customize your toolbar in Centura. This following picture shows you a
typical set of Centura toolbars.
Each icon supports Tooltips. When you place your cursor over the icon, a label
displays the capability of the icon.
Each tool bar listed in this dialog has several tools associated with it. Click on
various options to see how you effect your desktop.
3. Click Tools... to open the Tools dialog if you want to add more executable tools.
In this dialog, you can select individual tools to add to the Tools toolbar and
specify commands to make available to run from the tool bar.
Status bar
Centura has a status bar at the bottom that shows the setting of the Num Lock, Scroll
Lock and Caps Lock keys. The status bar also displays a message that shows the
currently selected item on the menu or tool bar and the currently selected object on a
form or outline view.
Turn on the status bar by right-clicking on a blank section of the toolbar. Select Status
Bar from the menu. Turn the status bar off by either right-clicking on the status bar
and selecting Status Bar from the menu or by right-clicking on a blank section of the
toolbar and selecting Status Bar.
Controls toolbar
This toolbar is dockable. The dockable Controls toolbar contains icons representing a
rich choice of graphical objects you can easily add to an application as part of your
interface design
Selector and
Frame List Box
Object tools
Tip: When you click a control on the toolbar, you do not have to hold down the mouse button
while moving to the form to drop the object.
Attribute Inspector
When you first create applications in Centura, it is similar to laying out shapes on a
canvas. The shapes are the objects that you use. You use the Attribute Inspector to
modify an object name, title, and background color, and so on.
Each object has an Edit menu.
Edit Attribute
Menu Inspector
Both the Edit menu and the Attribute Inspector are tailored for the ways in which you
use an object. The Attribute Inspector shown above is for a dialog box.
To display the Edit menu, drop an object on a form. Right-click on the object. The
Edit menu appears.
To display the Attribute Inspector, select Attribute Inspector from the Tools menu.
You can set attributes for your Form window and any graphical objects you drop on
your form window. The Attribute Inspector gives you complete control over the look
and feel of graphical objects.
Coding Assistant
SQLWindows Coding Assistant makes coding applications quick, easy, and far less
error prone. Click on any section of the outline and appropriate code choices appear
in the Coding Assistant.
Bring up the Coding Assistant by selecting Coding Assistant from the Tools menu.
Double-click on an item in the Coding Assistant to add it to the outline. If you choose
a function, the full syntax appears in the outline and you can quickly replace the
parameters.
The Coding Assistant suggests whether to add new code to the same level or indented
another level.
Online Help
You can get help at any time by pressing F1.
Component wizards
Programmers can get started quickly by using the new Component Wizards. Centura
SQLWindows comes with a number of wizards for easy application building.
Report Builder
You can use Report Builder (often referred to as Reports) to design reports in an easy-
to-use graphical environment. This chapter describes how you can use Reports to:
• Design and print various types of reports to meet your reporting needs.
• Format each report element with easily accessible formatting options.
• Display summary calculations to neatly arrange your report.
• Import and display data and graphics from different sources.
• Design a report template you can use repeatedly with different data sources.
To bring up the Report Builder, select Report Builder from the Tools menu in
SQLWindows.
Database Explorer
To help developers work with all database schemas, whether simple or complex,
Centura SQLWindows includes easy to use schema management functionality.
Centura Database Explorer allows you to browse, create or modify database objects
like tables, views and indexes. You can also design and format reports.
developers can integrate stored procedures into their Centura applications with just a
few mouse clicks.
Calendar controls
The cCalendar and cCalendarDropDown date controls display one month at a time.
User can scroll a day, week, month or year at a time. Keyboard shortcuts are provided
for all mouse actions. cCalendarDropDown combines an edit field with a popup
calendar to provide date selection capabilities. The programmer has full control over
keyboard, mouse and display configuration.
Dynalibs provide the ability to segment the application logic into pre-compiled
libraries that are linked into the application at run-time. Dynalibs themselves can use
all features of Centura SQLWindows, including the Object Compiler.
When building a Dynalib, the programmer can specify which objects are “exported”
from the uncompiled library (.APL file) to the Dynalib (.APD file). This is called
export control, and it allows you to define the public/private members of a Dynalib.
The objects that can be exported to a Dynalib are:
• Global functions
• Global variables
• Window functions
• Top-level window objects - forms, tables, dialogs, MDI windows, and MDI
children.
Note: Start using Team Object Manager by working through the tutorial in Chapter 5.
Unlike other development environments that claim team programming support but
only support external version control through third-party tools like Intersolv’s PVCS,
Centura not only has built-in version control support, but goes far beyond it to include
features like project branching, diff and merge, coding standards management,
deployment management, impact analysis, audit trails, management reporting and
much more. For openness, it also supports PVCS. Thus, it is a truly comprehensive
project and object management environment, and is a project manager’s dream come
true.
Project and configuration management is easy with Centura, even when you are
working with multiple versions. The project branching feature allows you to work on
With Centura you can visually branch your applications. Sophisticated version
control at the file and object levels ensures that all your team members can securely
coordinate their work, no matter how large the project. Since the typical application
development team includes members with different roles, Centura allows you to
assign and manage roles and privileges for various team members.
If conflicts are detected during this process the conflicting code (objects)
from all files is added so that the conflicts can be resolved manually.
Object Browser
Teams of programmers have a powerful, reliable tool for documenting and
understanding object-oriented code. The Object Browser in Team Object Manager
allows complex OOP classes to viewed and printed graphically. A number of
standard reports provide details of class behavior.
Centura QuickObjects
QuickObjects are software classes with a design time interface. QuickObjects provide
you with an easy point-and-click alternative to writing code when you create client/
server applications. The purpose of QuickObjects is to bring ease-of-use, re-usability,
and flexibility to the development process.
The QuickObject architecture provides a robust foundation on which more
experienced developers can make their existing classes easier to use without
sacrificing power and functionality. You can use an instance of a DVC QuickObject
(data source, visualizer, and commander). In addition to these DVC QuickObjects,
Centura provides many other QuickObjects, such as Quick OLE, QuickeMail, and
QuickReport.
Read the manual, Using and Extending QuickObjects for a detailed description of
QuickObjects, including a lengthy discussion of the DVC framework.
Quick3Tier
Centura provides a choice of 2-tier and 3-tier application architecture. A key feature
that enables Centura’s 3-tier architecture is the 3-tier Wizard, which steps the
developer through the task of building a 3-tier application. With the unique 3-tier
Wizard, scalable applications can now be developed effortlessly with a range of
application servers.
The 3-tier Wizard can be used to integrate a Centura application with a Tuxedo-based
application server. The Centura Tuxedo Application Deployment Suite manages
transactions between the client application and Tuxedo server.
QuickCICS
QuickCICS makes it easy for you to invoke Customer Information Control Systems
(CICS) programs from Centura Team Developer applications. Quick CICS
applications can access all resources available to CICS, including data residing in
DB2, IMS, and VSAM databases. These applications can also use CICS system
facilities, such as security and transaction management.
QuickCICS applications are object-oriented programs built using the QuickCICS
Class Library. This library contains functional base classes that provide the generic
functionality required to invoke CICS programs and manage CICS transactions. You
use the QuickCICS Wizard to generate derived classes that are customized for the
specific CICS server programs your application will invoke. The wizard also
optionally generates a QuickObject Datasource class that may be used to build
QuickObject applications. The classes produced by the wizard may be saved in a
Centura Team Developer library (.APL) or placed directly into the outline of the
current application.
QuickeMail
Centura SQLWindows includes eMail connectivity to popular eMail systems.
Previously, the process of mail-enabling an application was long and tedious, often
requiring programmers to write DLLs and learn the intricacies of MAPI. With
QuickeMail, you can mail-enable an application in the same point-and-click
technique used with other QuickObjects.
QuickReport
A QuickReport makes it easy for programmers to build and use reports within the
Centura SQLWindows environment. WYSIWYG reporting within Centura
SQLWindows and reuse of templates improves productivity for report designers.
Report designers can create generic report templates that can be made available to
other programmers who need to tie these reports to various types of data. For
example, a report designer may design a cross tabular report template that conforms
to corporate standards. This report template is, in turn, used by programmers in
several departments:
QuickTabs
This control lets you build tabbed forms and dialogs. QuickTabs enable the creation
of property sheets similar to the style in Windows. The default style is a top tab
orientation. We will also support a bottom tab orientation. The bottom tab style is a
small tab similar to how Excel displays multiple sheets in a Workbook. With this
control, you can place a form window on a tab, so that the Window is created and
destroyed when the tab is shown/hidden.
QuickGraph
QuickGraph integrates business graphics into Centura SQLWindows applications
through graph controls that are directly linked to data. This elegant feature brings
drag-and-drop simplicity to the creation of charts and widens the choice of display
styles for your data. Stunning graphics can be combined within your application
without the need to resort to coding.
of a native relational database server with the ease and unobtrusiveness expected of a
graphical PC application.
The SQLBase single-user database engine is built for easy deployment, including
easy installation, a tool for easy set-up of databases, and interfaces for Centura
SQLWindows, C, C++ and ODBC. Its programmability options, such as advanced
cursor handling and result set processing, allow more robust applications to be
deployed off the LAN and onto the desktop. More robust applications can also run
against larger data sets, taking advantage of SQLBase’s native relational
functionality, such as query and sort optimization.
The SQLBase database engine included in Centura Team Developer is intended for
development only. When you deploy your application, you may purchase a
deployment suite called SQLBase Desktop, or SQLBase Server, a workgroup
database server. SQLBase Server, the fastest and easiest server for NetWare,
Windows NT and Windows 9x, is a robust database server designed for running
workgroup applications. It provides the functionality you expect in a high-
performance database server, including triggers and stored procedures, multiple
concurrency options, and query and sort optimization. SQLBase Server delivers this
power and performance with the unobtrusiveness expected of PC applications,
including a very small footprint. Its tools and maintenance options facilitate the easy
set up your databases for speed, remote management, and the automation of routine
tasks.
Databases utilities
SQLBase Desktop comes with a comprehensive set of graphical tools to manage and
administer your desktop database environment.
• SQLConsole provides point-and-click administration of databases, including
the automation of routine tasks, such as database back-up.
• SQLTalk is an interactive SQL utility that helps programmers test and debug
connectivity to all relational databases.
Therefore, ODBC is the preferred way to connect to SQL Server. But in most other
cases, the database vendor recommends the use of a native API like OCI for Oracle,
and CT-LIB for Sybase, rather than ODBC. In such cases, the native API is directly
and fully supported. Unlike other multi-database solutions that take a ‘lowest
common denominator’ approach, Centura connectivity supports the ‘highest common
denominator’ because each database link is engineered as a separate ‘router’. The
specific targeting of each database with custom links ensures maximum integration.
Access to mainframe databases like DB2, and legacy data sources like VSAM, is
directly supported through a companion product, SQLHost.
SQLTalk
SQLTalk is an interactive user interface that allows you to use SQL database
commands. SQLTalk can be used as an interface for other databases besides
SQLBase, such as DB2.
SQLConsole
Use SQLConsole to simplify database administration. Use it to manage database
objects, monitor performance, and automate database maintenance.
Chapter 3
Note: In order to add the Microsoft Calendar Control 8.0, you must have it installed on your
machine. You have it if you installed Microsoft Access during a Microsoft Office 97 install, and
selected Options, and checked Calendar Control.
4. Enter ISLAND, SYSADM, and sysadm in the fields, respectively. Click OK.
The Department Budgets window appears..
Use the push buttons in the toolbar to navigate through the budget records in the
database.
You are now ready to layout the form for this application.
In the lower part of the Controls toolbar, a list of currently registered ActiveX
controls appears.
ActiceX control
3. Select Calendar Control 8.0, and drop this object in the upper left corner of the
form. Resize it so that you can see the calendar.
When you drop the Calendar Control object on the form, the following libraries
are automatically inserted into the outline:
• File Include: C:\CENTURA\AXLibs\ Microsoft Calendar Control 8.0.apl
• File Include: Automation.apl
• File Include: OLE Automation.apl
On the right side of the Properties dialog, there is a group called Show.
Remove all of the checks from the check boxes except for the Month/Year Title.
The Properties dialog looks like this:
Click OK.
5. Select the Child Table Window object in the Controls toolbar.
In the lower part of the Controls toolbar, select BudgetTable.
Drop this on the form under the Calendar Control.
Your form looks like this:
6. Select the cQuickGraph object in the Controls toolbar. Drop this to the right of
the Calendar Control, and resize the cQuickGraph so that you can see the entire
graph.
Click OK.
Note: Note: Resize the push buttons so you can see the arrow bitmaps.
You have just laid out the entire application. You are now ready to code functionality
into it.
Type: sUser
Double-click String in the Coding Assistant.
Type: sPassword
2. Click Application Actions in the Global Declarations section.
Double-click On SAM_AppStartup in the coding assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click SalModalDialog in the Coding Assistant to add it to your outline.
Change: Template, Window_Handle
To: dlgQOLogin, hWndNULL, sDatabase, sUser, sPassword.
This calls the Login QuickObject.
On DRAWNOTIFY
Set cc1.Graph.DataSource = ‘tbl1’
Set cc1.Graph.DataField[0] = ‘col’ || SalNumberToStrX( nMonth, 0 )
Set cc1.Graph.NumDataFields = 1
Call Draw( )
Note: If you do not see NewMonth in the Coding Assistant, switch to Layout view, select the
Calendar object on the form, and switch back to Outline view.
MSACAL_Calendar: ax1
Message Actions
On NewMonth
Paramters
Actions
Call Calendar.GetMonth (nMonth)
Change: Number
To: 1
Set the actions for the Previous push button.
1. Double-click QuickToolTipPushbutton: pbPrev.
2. Click on Message Actions.
Select On SAM_Click in the Coding Assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click Calendar.PreviousMonth to add it to the outline.
There are no parameters.
Set the actions for the Next push button.
1. Double-click QuickToolTipPushbutton: pbNext.
2. Click on Message Actions.
Select On SAM_Click in the Coding Assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click Calendar.NextMonth to add it to the outline.
There are no parameters.
Set the actions for the Last push button.
1. Double-click QuickToolTipPushbutton: pbLast.
2. Click on Message Actions.
Select On SAM_Click in the Coding Assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click Calendar.SetMonth to add it to the outline.
Change: Number
To: 12
3. When the Login dialog appears, enter ISLAND, SYSADM, sysadm in the
datafields, respectively.
4. Click OK to bring up the form window, Department Budgets.
The form looks like this:
Use the navigation buttons to browse the database records. Notice how the calendar,
the graph, and the table are linked.
Chapter 4
Developing N-Tier
Applications Using
CTD and COM
The Component Object Model (COM) is a specification developed by Microsoft for
writing reusable software, software that runs in a component-based environment. It
provides an infrastructure that allows clients and objects to communicate across
process and host computer boundaries. COM clients and objects may be developed
using different programming languages, and can interoperate even when located on
separate machines.
A complete discussion of COM is beyond the scope of this tutorial. If you are not
familiar with COM concepts and principles, Centura recommends that you consult a
COM reference manual before proceeding. Most of the information you need to know
about COM is available in the MSDN (Microsoft Developer Network) Library. See
the Developing with Centura SQLWindows manual for more information on COM
programming in CTD.
This tutorial is divided into the following sections
• Advantages of COM applications
• Overview of the tutorial COM application
• Tutorial COM server
• Tutorial COM client
• Building a COM sever and COM client
• Troubleshooting
• Exercises for the reader
• Running the COM client as a Web application
• Developing Web applications
Note: This application is relatively complicated. To walk through all of the steps needed to
create it would be too time consuming. This tutorial provides some background on COM, and
on developing COM applications in Centura Team Developer. The COM samples are used to
illustrate a variety of COM-related issues and to provide developers with a working COM
application to examine for future projects of their own.
This COM application is a sales order entry system. Once compiled and running, it
appears to function in much the same way as a typical client/server application. Data
is drawn from the ISLAND sample database. The user interacts with the COM client,
selecting companies, creating sales invoices, submitting them to the database, and
listing existing orders. However, much of the business logic of the application is run
from the COM server.
When the client needs to use the functionality provided by the COM server, it first
creates an instance of a COM object on the server. It can then call functions from the
Interface associated with that object. The Interface functions make calls to the
ISLAND database and pass data back to the client. Events fired by the Interface are
handled by a CoClass on the server, which can pass the events back to the COM
client. Using a COM Proxy Class, the client can then handle the event.
Note: To use all features of the tutorial COM application, you need to have installed Centura
Team Developer 2000, the Centura Web Extensions (CWE), SQLBase 7.5.1, and the ISLAND
sample database.
The diagram below illustrates the basic structure of the tutorial COM application,
showing the relationships between push buttons, windows, combo boxes, fields,
COM objects, and the database (note that not all of these relationships are shown
here):
What is an Interface?
An Interface class contains the functionality of a COM server. Any business logic,
database calls, or other functions that you decide to add to a COM server belong in an
Interface. The details of how you have implemented functions in an interface are
largely hidden from clients. A client only knows enough about an interface function
to be able to use it. For a client to be able to use an interface function, it first must
create an instance of the COM object associated with the interface. The client can
then call the interface function as if it were a function defined in the client
application.
Collections
A collection is an easy to use managed list of items. It is extensible, allowing you to
add and remove items. When you designate an Interface as a collection in the COM
Class Wizard, a set of standardized functions are added to the Interface. It is these
functions that turn an ordinary Interface into a collection. The functions (Add, Item,
PropGetCount, and Remove) allow you to manage the collection.
A collection of CoClasses can store or pass row data as a property of a CoClass.
IISOSalesServer in conjunction with IISOListLineItems and IISOInvoiceServer in
conjunction with IISOListOrders act as collections of CoClasses. These interfaces are
used for passing data from the COM server to the client. Each attribute defines an
array data type, and each element of the collection corresponds to a specific row of
data.
Both IISOListOrders and IISOListLineItems contain no functions, only Get
Properties. When this functionality is implemented in the client, each Property is
called. The data is placed in a table and then displayed.
Note: By making the Interface a collection, you make it possible for the COM server to be used
by client applications written in Visual Basic or C++. For more information on when and why
you should use collections, consult a reference on COM and/or C++ programming.
Adding functions and properties. The next dialog of the COM Class Wizard
allows you to add functions and properties to the Interface. The Wizard does not
allow you to completely configure the Interface, but it does allow you to specify, at a
high level, the functions and properties of the Interface. You will need to edit the
Interface further in the Outline to make it complete.
The Remove, Add, and Item functions along with the Count property are added
automatically when you designate that the Interface is a collection.
The sections that follow describe how to add the following functions to the
IISOInfoServer Interface:
• Get CustomerInfo
• Get CompanyIDs
• StopSearch
5. In the Name field type nCompanyID and in the Data Type drop-down menu
select Number(VT_I2). VT stands for Variant Type. I stands for Integer. VT_I2
represents a 2-byte signed integer.
Click OK.
6. Add the following arguments to the function (all of the following arguments
should have a data type of String and should have the Receive box selected.):
• sCompanyName
• sAddress
• sCity
• sState
• sZip
• sCountry
• sContactName
The Add Function dialog box should appear as follows:
Note that the order of these arguments is important. Be sure that the arguments are
ordered as shown above. Use the ↑ button and the ↓ button to change the order of
the arguments.
7. Click OK on the Add Function dialog box when you have finished.
Creating the StopSearch function. This section describes how to create the
StopSearch function for the IISOInfoServer Interface.
1. On the Functions tab, click Add.
The Add Function dialog box is displayed.
2. In the Name field type StopSearch.
3. Select Boolean from the Return Data Type drop-down menu.
4. Click +.
The Add Argument dialog box is displayed.
5. Enter nCompanyID in the Name field.
6. Set the Data Type to Number(VT_I2). VT stands for Variant Type. I stands for
Integer. VT_I2 represents a 2-byte signed integer. Click OK.
7. In the Add Function dialog box, click OK.
Final steps. The following steps describe how to finish creating the Interface in the
COM Class Wizard:
1. In the COM Class Wizard dialog box, click Next.
A summary of the Interface is displayed.
2. Click Finish to build the Interface.
The IISOInfoServer Interface is added to the application.
3. Save this application (the filename and location do not matter). You need to use
it in the next section.
Note: At this stage the IISOInfoServer Interface is not complete. Examine the Outline of the
completed Interface in IslandSALESInfoSVR.app and compare it to the what you just created.
Note what the COM Class Wizard adds and does not add for you.
You have now created the basic outline for an Interface in SQLWindows. The
sections that follow describe what a CoClass is and how to create one using the COM
Class Wizard.
What is a CoClass?
When invoked by a COM client, a CoClass represents a COM object on the server.
Using the CoClass, you can link to any associated Interfaces and use any of the
Interface functions. In the COM server, it is derived from one or more Interfaces and
defines any events related to the associated interfaces.
Note: You can derive CoClasses from multiple Interfaces. You can also derive separate
CoClasses from the same Interface. However, as a novice COM programmer, it is best to derive
each CoClass from a single Interface, for the sake of simplicity.
5. Select IISOInfoServer in the Existing Interfaces list. Click the right arrow.
IISOInfoServer moves to the Derives from list. Click OK.
6. In the COM Class Wizard dialog box, click Next.
7. Select the Events radio button. Click Add.
The Add Event dialog box is displayed.
8. In the name field type evRecordNotFound. Click OK.
9. Add another event. Name the event evResultsNotYetReady. This event
includes a single argument.
10. Click + to add the argument.
11. In the Add Argument dialog box, name the argument nCompanyID and give it
the Number(VT_I4) Data Type. Click OK.
12. Click OK in the Add Event dialog box.
13. Add one last event. Name the event evSearchError. This event has no
arguments.
14. Click Next on the COM Class Wizard dialog box.
Click Finish.
The ISOInfoServer CoClass is added to the application. Unlike the
IISOInfoServer Interface, this CoClass is complete. Nothing more needs to be
added to it in the Outline, except optionally some information in the Description
section.
GUIDs
Various COM components require an associated globally unique identifier (GUID).
CoClasses, Interfaces, functions, events, and Type Libraries all require an associated
GUID. GUIDs ensure that COM clients do not access COM components that have
been altered in a manner that could cause conflicts with the client code. SQLWindows
automatically adds a GUID to any new COM component.
Note that a GUID can have a number of other names depending on what it identifies:
• GUID for a COM Interface is called an Interface Identifier (IID)
• GUID for a CoClass is called a Class Identifier (CLSID)
• In IDL GUIDs can be called Universally Unique Identifiers (UUID)
Updating a GUID. You can update GUIDs in CTD in the following ways:
• Right-clicking the GUID in the application outline and selecting Regenerate
GUID from the pop-up list.
• Selecting Project, Regenerate GUIDs.
The Regenerate Server GUIDs dialog box allows you to regenerate all of the
GUIDs in the COM server
• On the COM Server tab of the Project, Build Settings dialog box, you can
change the type library GUID (this GUID identifies the whole component).
Note: IslandSALESOrderEntry has been configured as both a Windows and Web application.
The web class libraries are included and, when needed, web class function calls have been made
where normally you would use standard SAL function calls. This allows this application to work
either as a Windows .exe or as a Web application you can call from a browser. For more, read
Developing Web applications on page 4-35.
ActiveX Explorer
When you begin to develop a new COM client application, the first thing you need to
do is to generate the Interfaces, CoClasses, and events in ActiveX Explorer. ActiveX
Explorer takes the information from the COM server’s Type library and creates a
COM Proxy Library (.APL file) which contains all the information needed for a COM
client application to be able to use the COM server. The COM Proxy Library (APL)
makes the SAL application aware of the COM server. It also gives the SAL
application the ability to invoke the COM server.
Note: The first time ActiveX Explorer runs, it stores information about all the COM objects on
your machine for future use. This process takes some time.
The table below describes what each icon represents in the ActiveX Explorer:
Icon Description
Interface
CoClass
Event
Function
Get Property
Set Property
As a client application developer, you might not be able to examine the internals of a
particular COM server. However, using the ActiveX Explorer you can discover all
that you need to know to be able invoke the COM server’s objects and use the
server’s functionality.
Generating the COM Proxy Library (APL). When you execute the Generate
Full command in ActiveX Explorer, ActiveX Explorer does the following:
• Creates a Functional Class for each Interface in the type library
• Creates a COM Proxy Class for each CoClass in the type library
• Adds these classes to a new SAL library (APL)
• Includes this new library along with Automation.apl in your current
application’s outline
Functional Classes from the COM Proxy Library (APL). A Functional Class
models each COM server Interface in the SAL programming environment. It makes
available in the COM client application the functions for the associated Interface.
For example, the IslandSALESInfoSVR_IISOInfoServer Functional Class models
the IISOInfoServer Interface in the IslandSALESInfoSVR COM server. If you
examine the IslandSALESInfoSVR_IISOInfoServer Functional Class in the Outline
for IslandSALESOrderEntry.app, you can see that it includes all of the functions of
the associated interface:
• Function: GetCustomerInfo
• Function: GetCompanyIDs
• Function: Item
• Function: PropGetCount
• Function: Add
• Function: Remove
• Function: StopSearch
COM Proxy Classes from the COM Proxy Library (APL). The CoClass in the
COM server represents the COM object. The COM Proxy Class makes it possible to
create an instance of a specific COM object from the COM client. Each COM Proxy
Class is derived from a Functional Class.
For example, the IslandSALESInfoSVR_ISOInfoServer COM Proxy Class is
associated with the ISOInfoServer CoClass that is a component of the
IslandSALESInfoSVR COM server. By declaring this COM Proxy Class in the COM
client (a process that happens automatically when you generate the CoClass in
ActiveX Explorer), you can create an instance of the ISOInfoServer object from the
client. The COM Proxy Class also allows you to link to any interfaces associated with
the CoClass. In the case of IslandSALESInfoSVR_ISOInfoServer, you can access the
IISOInfoServer Interface.
When you derive a class, your new class inherits all the properties of the base class.
Your new class lets you add additional functionality. In this case, it gives you the
ability to handle COM server events in your client application.
Note: Class inheritance is an object-oriented programming feature of SAL. See the Developing
with SQLWindows manual for more information.
Handling events. You handle COM server events in from the COM Proxy Classes.
For example, look under Class Definitions, COM Proxy Class: ISOInfoServer,
Message Actions, Actions in the Outline:
Message Actions
On evRecordNotFound
Parameters
Actions
Call WebMessageBox( "Company/Contact Record could not be
located", "Search Error", MB_Ok )
This code displays an error message box in the client application when the
ISOInfoServer CoClass fires an evRecondNotFound event.
Example A. The code segment that follows illustrates how you create an instance of
an object and call a function through that object from the client application. The
segment is located in IslandSALESOrderEntry.app. Using the Outline, navigate to
cIslandSalesForm: frmSALESORDER, Message Actions, On Web_CreateComplete.
On WEB_CreateComplete
...
¿ If comIslandINFO.Create()
¡ If comIslandINFO.GetCompanyIDs( bOK )
Call svrPopulateCMB( cmbCompanyIDs )
Call SalEnableWindow( pbGetINFO )
Call SalSetFocus( cmbCompanyIDs )
Call SalListSetSelect( cmbCompanyIDs, 0 )
Call frmSALESORDER.CustSelected( )
¬ If NOT WebIsWebMode( )
Call SalCreateWindow( frmLISTORDERS, hWndForm )
Call SalCreateWindow( frmPLACEORDER, hWndForm )
! notice in windows mode can set the parent window as
usual
Call SalCreateWindow( frmINVOICE, frmPLACEORDER )
¿ This line of code creates an instance of the ISOInfoServer object. Before you can
use the functionality provided by an object, you need to create an instance of it.
¡ This line of code calls the function GetCompanyIDs in the IISOInfoServer
Interface. The lines of code that follow obtain the CompanyIDs from the
ISLAND database and uses them to populate a Combo box in
frmSALESORDER.
¬ These final lines of code are related to making the application work as a web
application or a windows application.
Example B. The code segments that follow show how to call the GetCustomerInfo
function and show how the code on the client corresponds to the code on the COM
server.
The first segment is located in IslandSALESOrderEntry.app under cIslandSalesForm:
frmSALESORDER, Contents, cWebButton: pbGetINFO.
cWebButton: pbGetINFO
Message Actions
On SAM_Click
Call frmSALESORDER.CustSelected( )
Call frmSALESORDER.GetCustInfo( )
The pbGetINFO button is the first button a user clicks in this application. After
selecting a Company ID from the scroll list, the user clicks this button to obtain the
information on the corresponding company from ISLAND. In the preceding code
sample, the call of frmSALESORDER.GetCustInfo( ) starts the process of retrieving
company information.
Here is the code for frmSALESORDER.GetCustInfo( ), located under
cIslandSalesForm: frmSALESORDER, Functions,
Function: GetCustInfo:
Function: GetCustInfo
...
Actions
...
If nCompanyIDSelected > 100
Set dfsCompanyName = ""
Set dfsAddress = ""
Set dfsCity = ""
Set dfsState = ""
Set dfsZip = ""
Set dfsCountry = ""
Set dfsContactName = ""
¿ If NOT comIslandINFO.GetCustomerInfo( nCompanyIDSelected,
dfsCompanyName, dfsAddress, dfsCity, dfsState, dfsZip,
dfsCountry, dfsContactName, bOK )
The next code sample shows part of the function, GetCustomerInfo, as it is defined in
the IISOInfoServer Interface in IslandSALESInfoSVR.app. In the Outline view, open
Global Declarations, Class Definitions, Interface: IISOInfoServer, Functions,
Function: GetCustomerInfo.
Function: GetCustomerInfo
Description: Returns Customer Information for Company ID
passed in
Attributes
Returns
Parameters
Number: nCompanyID
Receive String: sCompanyName
Receive String: sAddress
Receive String: sCity
Receive String: sState
Receive String: sZip
Receive String: sCountry
Receive String: sContactName
Static Variables
Local variables
Actions
Set SqlDatabase='ISLAND'
Set SqlUser='SYSADM'
Set SqlPassword='SYSADM'
If SqlConnect( m_hSql )
...
If SqlPrepareAndExecute( m_hSql,
"SELECTcompany_name,
address,
city,
state,
zip,
country,
cont_first_name || ' ' || cont_last_name
FROM company a, contact b
INTO :sCompanyName,
:sAddress,
:sCity,
:sState,
:sZip,
:sCountry,
:sContactName
WHERE a.company_id = :nCompanyID
AND a.company_id = b.company_id"
In the Actions section of the preceding code sample, the actual connection is made to
the ISLAND database and the relevant data is retrieved. Note that the way the tutorial
application is designed, the location of the database and the way in which the data is
retrieved are irrelevant to the COM client.
Note: If you have previously registered the server, un-register the server before attempting to
reregister it. Be sure to first close any applications that might be using the COM server, including
the database. To un-register the server, select Project, Un-Register Server.
Note: The first time you open the ActiveX Explorer, it may take a while to appear. It needs to
read the registry to find all of your registered COM objects. This information is cached for future
use.
3. Select the appropriate type library from the list and click OK.
The ActiveX Explorer is displayed.
4. Right-click in the Classes window pane of the ActiveX Explorer and select all of
the components that you wish to generate.
5. Right-click in the Classes window pane of the ActiveX Explorer and select Check
All Shown from the pop-up menu.
6. Right-click in the Classes window pane of the ActiveX Explorer and select
Generate Full from the pop-up menu. The COM Proxy Library (APL) is
generated. It exposes the functionality of the COM server to the client application.
Note: If a message box is displayed asking whether you would like to regenerate all of the
selected classes, click Yes.
Troubleshooting
This section describes a problem you might encounter when running the tutorial
COM application, along with what you can do to remedy it.
This error message is typically triggered because the new or revised COM server .dll
file has not been registered.
Solution
Register the COM server .dll file.
Note: For information on how to create Centura Web applications, see the Building Web
Applications with Centura manual.
Note: This URL may vary depending on the Web Server you are using. For more information,
check the documentation for your Web Server.
Note: This URL can vary depending on the Web Server you are using. See the Building Web
Applications with Centura manual for more information.
The application is invoked on the web server and the opening screen is displayed.
Note: There is a significant performance penalty when this feature is enabled. Be careful to
disable this feature on shipping code.
Chapter 5
Note: To run the MTS tutorial application, you need to be running Centura Team Developer
2000 on a Windows NT 4.0 or Windows 2000 system. Windows NT 4.0 systems must have the
Microsoft Transaction Server Option Pack 4 installed.
Note: These steps describe the menus as they are specified in Windows NT. The Windows 2000
menus are somewhat different.
Complete the following steps to install the COM/MTS server as a package in MTS:
1. Close SQLWindows, SQLBase, and any other application that might be using the
tutorial COM server.
2. Select Start, Programs, Windows NT 4.0 Option Pack, Microsoft
Transaction Server, Transaction Server Explorer.
3. Expand the MTS tree: Microsoft Transaction Server, Computers,
My Computer, Packages Installed.
4. Select Packages Installed, right-click, and select New, Package.
5. In the Package Wizard, click Create an Empty Package and name the new
package IslandMTS. Click Next.
6. Use the default settings in the Set Package Identity dialog box. Click Finish.
7. Expand the new MTS Island package in the tree view.
8. Select Components, right-click, and select New, Component. The Component
Wizard is displayed.
9. Click Import components that are already registered.
The MTS Server objects are displayed in the right window pane.
Now that you have installed the COM/MTS server components in MTS, MTS can act
as a broker for the objects when called by the COM/MTS client application. Open
IslandSALESOrderEntryMTS.app and run the application in debug mode (or launch
IslandSALESOrderEntryMTS.exe). If you have the Microsoft Management Console
open while you are running the client, the ball graphic spins for each object that is
currently being used by the client.
Note: Each time you revise an COM/MTS server, you should delete the old MTS server
package and then reinstall the revised COM server in a new MTS server package.
7. Select IISOSalesServer from the Existing Interfaces list and click the right arrow.
The selected item moves to the Derives from list. Click OK and then click Next.
8. Click Next. The COM Class Wizard Summary is displayed.
Verify that the information displayed is correct. Click Finish.
9. Repeat the preceding steps to create the following CoClasses for the MTS tutorial
application:
• ISOInfoServerMTS
Derived from IISOInfoServer
• ISOProductServerMTS
Derived from IISOProductServer.
• ISOARPostServerMTS
Derived from IISOARPostServer.
• ISOInvoiceServerMTS
Derived from IISOInvoiceServer
• ISOListOrdersMTS
Derived from IISOListOrders
• ISOListLineItemsMTS
Derived from IISOListLineItems
In the Outline under Global Declarations, Classes, you should now have 7 new
MTS CoClasses.
10. Regenerate all of the GUIDs in the COM server. Select Project, Regenerate
GUIDs. Check all of the items listed and click OK.
6. When you have finished copying the events from the old CoClasses to the new
MTS CoClasses, comment out each of the COM CoClasses.
! CoClass: ISOInfoServer
! CoClass: ISOProductServer
! CoClass: ISOARPostServer
! CoClass: ISOSalesServer
! CoClass: ISOInvoiceServer
! CoClass: ISOListOrders
! CoClass: ISOListLineItems
To comment a line of SAL code, select the line, right click, and select Comment
Items from the popup menu. The graphic below shows how your application
window should appear once you have completed the preceding steps.
In the tree view shown in the left window pane, each Interface should now have a
single corresponding CoClass.
7. Save the file.
Note: If you receive an error message when you attempt to register the server, it may be that a
process on the machine still has a handle to the old COM server. An easy way to ensure that all
of these connections are free is to reboot the system.
You have now changed the tutorial COM Server so that it can function from within an
MTS Server. In the next section, you change the tutorial COM client application so
that it can use the MTS COM Server.
10. Open the main CTD window and select the Outline view. Open Global
Declarations, Class Definitions in the IslandSALESOrderEntryMTS.app
application, and rename the following COM Proxy Classes:
COM Proxy Class: ISOInfoServer
!
COM Proxy Class: ISOProductServer
!
COM Proxy Class: ISOARPostServer
!
COM Proxy Class: ISOSalesServer
!
COM Proxy Class: ISOInvoiceServer
!
COM Proxy Class: ISOListOrders
!
COM Proxy Class: ISOListLineItems
To:
COM Proxy Class: ISOInfoServerMTS
!
COM Proxy Class: ISOProductServerMTS
!
COM Proxy Class: ISOARPostServerMTS
!
COM Proxy Class: ISOSalesServerMTS
!
COM Proxy Class: ISOInvoiceServerMTS
!
COM Proxy Class: ISOListOrdersMTS
!
COM Proxy Class: ISOListLineItemsMTS
11. Since you have now included the new Type Library, you need to change some of
the references in the preceding COM Proxy Classes. These COM Proxy Classes
make it possible to handle events generated by the Interfaces on the MTS COM
server. Each is derived from the COM Proxy Class that is included as part of the
process of generating the Type Library with ActiveX Explorer.
Open COM Proxy Class: ISOInfoServerMTS, Derived From in the Outline.
Change the class reference from:
Class: IslandSALESInfoSVR_ISOInfoServer
To:
Class: IslandSALESInfoSVRMTS_ISOInfoServerMTS
Make the same change to the references of each of the other COM Proxy Classes.
12. Open Global Declarations, Variables and then change the names of the references
for the variables from:
ISOInfoServer: comIslandINFO
!
ISOProductServer: comIslandPRODUCT
!
ISOARPostServer: comIslandARPOST
!
ISOSalesServer: comIslandSALES
!
ISOInvoiceServer: comIslandINVOICE
!
ISOListOrders: IslandORDERS
!
ISOListLineItems: IslandINVOICEITEMS
To:
ISOInfoServerMTS: comIslandINFO
!
ISOProductServerMTS: comIslandPRODUCT
!
ISOARPostServerMTS: comIslandARPOST
!
ISOSalesServerMTS: comIslandSALES
!
ISOInvoiceServerMTS: comIslandINVOICE
!
ISOListOrdersMTS: IslandORDERS
!
ISOListLineItemsMTS: IslandINVOICEITEMS
15. Save and then build the application. A message box is displayed stating that the
build was successful.
16. Confirm that the MTS-enabled COM server and client work correctly. Select
Debug, Go. Walk through the various dialogs of the application to ensure that it
still functions normally.
You have now changed the tutorial COM client application so that it can use the MTS
COM Server. The next step would be to install the MTS COM Server in the MTS
environment as a new MTS server package. For more information see Installing the
tutorial COM/MTS server in MTS on page 5-2. The next section provides some
information on how to create an ASP-based COM client that can use the MTS COM
Server.
System Requirements
The machine running the COM server must meet the following system requirements:
• Microsoft Windows NT 4.0 or Microsoft Windows 2000
Note: If you are running Windows NT 4.0, you need to install Windows NT 4.0 Option Pack 4
• Web Server that can handle ASP pages (Microsoft IIS for example)
• Installation of CTD 2000 that includes the COM tutorial sample applications
The machine running the ASP client must meet the following system requirements:
• Microsoft Internet Explorer 5.01
• Forms 2.0 Control Security Patch, fm2paste.exe (available from the
Microsoft website in the downloads section)
This Patch fixes a bug in how the ASP pages are displayed in Internet
Explorer.
The default.htm page for the ASP tutorial pages is displayed and provides you
with three options:
• Ping Server - Testparameters COM Server
Before attempting to open this ASP page, open testparameters.app in
SQLWindows. Build and then register the server.
Clicking this hyperlink takes you to an ASP page that attempts to connect
to the COM server in the MTS environment. It indicates whether it is
successful or not. For this to work, the COM Server must be registered
(it is automatically registered when it is installed from the CTD 2000
installation CD).
• Ping Database - IslandSALESInfoSVR with MTS
Clicking this hyperlink takes you to an ASP page that attempts to retrieve
data from the ISLAND sample database using the COM server through
MTS. It indicates whether it is successful or not.
• Island SALES Info Application
Clicking this hyperlink takes you to the ASP version of the
IslandSALESOrderEntry client. The tutorial ASP pages that have been
provided with CTD 2000 replicate some of the functionality of the
Windows/CWD version.
• PingDatabase.asp
Tests whether you can access data in the ISLAND database through the
IslandSALESInfoSVR.dll COM server in the MTS environment. Also makes
calls to GetCustomerInfo.asp.
• PingServer.asp
This ASP page tests whether you can access a COM object on your CTD 2000
machine from your web browser.
In the following code sample, the function variables for GetCustomerInfo are set to
null and then the function (GetCustomerInfo through- the objSalesServer object) is
called.
Note: Since all variables in ASP are of data type variant, you should also set to null each data
type before calling any COM function with parameters. For example sString = "", nNumber =
0 etc.
sCompanyName = ""
sAddress = ""
sCity = ""
sState = ""
sZip = ""
sCountry = ""
sContactName = ""
'Call Object
vGetCustomerInfo = objSalesServer.GetCustomerInfo(
nCompanyID, sCompanyName, sAddress, sCity,
sState, sZip, sCountry, sContactName)
Chapter 6
Create Project
Starting Team Object Manager
1. Select Team Object Manager from the Tools menu in SQLWindows.
The Team Object Manager Login dialog prompts you for a Repository, a user
name, and a password.
2. Type the Repository, User Name, and Password into the appropriate fields. Use
TEAMOBJM, demo, and demo, respectively.
3. Click OK.
Note: Team Object Manager may tell you that you are missing the #STARTER project. If so,
follow the defaults in the dialogs that appear to include the #STARTER project.
1. Right mouse click on the Starter Project icon. The project context menu will
now appear.
2. Select the New Project / New option to open the Project Wizard. This will guide
you through the steps required to create your new project.
3. The initial dialog in the Project Wizard appears. Click Next to continue.
4. The next dialog gives you two options. To use as many pre-set options as possible
going forward, select the Express radio button, then click Next.
5. Type the project identity into the Code field. We will name this project
MOLOKAI. Type a more informative name for the project into the Name field.
Type any description you want into the Description field, a multiline text field.
Click Next.
6. In the screen that appears, accept the default in the Project Directory field. Click
Next.
7. This completes the process of setting up a project using the express setup wizard.
Click Finish.
Click OK.
3. Select the Add option in the Files context menu. This enables you to insert
existing files into your project.
Files
4. Click the Files option to bring up the browse dialog. Select qckfinal.app (in the
\Samples directory). Click Add Files to insert this file into the project.
5. Repeat steps 2 - 4 to insert the following files (usually in the \Centura directory):
FORWARD.BMP, LASTREC.BMP, NEWREC.BMP, NEXTREC.BMP,
PREVREC.BMP.
Note: Hold down the Ctrl key as you select these files to add them all at once.
6. Click on the qckfinal.app item in the left pane (that you just added to the project).
At this point, your Team Object Manager desktop looks like this:
You will see a warning box informing you that the application file requires other
files to be included in the project which are not present.
3. Click Close.
4. When the scan for dependencies finishes, select the Scan for Components option
from the same menu. This updates the Repository with information about all the
component parts (functions, windows, classes and named menus) that are
included in your project.
5. Now select the Check Out... option in the same way. This brings up the Check
out file dialog. Click OK to start the check out process.
Note: If the Checkout directory does not exist, you will be asked if you want to create it. Click
Yes.
4. Click mdiIsland in the left pane. Delete the bitmap object from the mdiIsland
form.
5. Select the Island Outfitter Background text object and move it to the left.
6. These three changes are enough to see how the Diff/Merge tool works. Save your
changes in a new file called QCK2.APP by opening the File menu and choose the
Save As option.
7. Close SQLWindows and return to Team Object Manager.
2. Start a new file comparison by clicking the button in the tool bar.
3. Specify the names of the two files we want to compare, qckfinal.app and
qck2.app.
4. Click OK to start the file comparison. When the comparison completes, the Diff/
Merge tool shows the impact of our changes on the original and modified files.
The original file contents are shown on the left side, the new file contents on the
right side. The various changes you made are shown as deletions, modifications
and additions.
5. Press the F4 key to open the Go To Difference dialog. This dialog contains an
ordered listing of each difference between the original and modified files. By
clicking on one of the list entries you can go straight to the place where the change
was made.
Each variation between the two files is listed in the dialog together with a code
that identifies the type of difference. For example, C = Changed Text, D =
Deletion, CA = Changed Attribute, M = Move, A = Add.
6. Close the Diff/Merge tool. Do not save the analysis report contents.
You were able to make changes to the QCKFINAL.APP file and then use the Diff/
Merge tool to review the precise nature and impact of each variation.
Note: Because you saved your changes to another file, you see a warning saying the file has not
been modified, and asking if you would like to unlock the file. Click No.
The four objects below the .app file represent the types of objects that the
application contains.
2. Open the Classes and Windows objects by clicking ‘+’ to see what objects are
present.
3. Click on the ‘+’ symbol next to the Team Roles object. This gives you a view of
the different user classifications that Team Object Manager provides as a default.
Team Object Manager Team Roles are fully configurable, offering maximum
flexibility when structuring your projects.
You have just participated in your first team programming project with Centura! An
intuitive project-oriented user interface made it possible for you to check files in and
out of the Team Object Repository. The Team Object Manager component of Centura
has other powerful features which are fully detailed in the Managing Teams and
Objects with Centura manual supplied with the Centura Bookcase, or found in your
online book collection.
Chapter 7
Centura Bookcase
The Centura Bookcase includes manuals on the following topics:
• Application Development
• SQLBase
• Connectivity
Application Development
Building Web Applications with Centura Learning how to write, deploy, and manage Web
applications.
Extending the Centura Development Environment Discovering the SAL and C++ functions in the CDK
that help you extend your applications.
Using and Extending QuickObjects Understanding how to create complex and sophisticated
applications using the Centura QuickObjects, and how
to access Tuxedo services from Centura.
Managing Teams and Objects with Centura Team Understanding conceptual information and read a how-
Developer to account on Team Object Manager, the multi-
programmer developer tool.
Localizing and Customizing Centura Applications Translating your applications into other languages.
SQLBase
SQLBase Database Administrator’s Guide Managing your SQLBase database, and design
databases and applications.
SQLBase Application Programming Interface SQLBase SQL/API, a set of functions you can call to
Reference access a SQL database.
Replicating Data with SQLBase Exchange Using SQLBase Exchange components, Replication
Studio, Replication Engine, and RepAgent to replicate
data across broad networks.
SQLBase Advanced Topics Guide SQLBase advanced topics, including database design,
SQLBase internals, and SQLBase query optimizer.
Connectivity
Centura Interface for R/3 Integrating your Centura applications with SAP R/3.
Connecting Centura Objects to Databases Connecting your Centura applications to one or more
relational databases, such as Oracle, Microsoft SQL
Server, System 11.x, Informix, and others.
SQLBase OLE DB Data Provider User’s Guide Using SQLBase OLE DB Data Provider to enable
applications to access data irrespective of the data
source or development tool.
SQLHost Installation and Operation Guide Installing and configuring SQLHost software on a
workstation and a SQLGateway machine.
SQLHost Client Developer’s Guide Designing and developing client applications for
SQLHost.