TD Introducing Team Developer
TD Introducing Team Developer
Copyright © 2023 Open Text. All rights reserved. OpenText is a trademark or registered trademark of Open
Text. The list of trademarks is not exhaustive of other trademarks, registered trademarks, product names,
company names, brands and service names mentioned herein are property of Open Text or other respective
owners.
Disclaimer
No Warranties and Limitation of Liability. Every effort has been made to ensure the accuracy of the features
and techniques presented in this publication. However, Open Text Corporation and its affiliates accept no
responsibility and offer no warranty whether expressed or implied, for the accuracy of this publication.
Warning: This software is protected by copyright law and international treaties. Unauthorized reproduction or
distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be
prosecuted to the maximum extent possible under the law.
2
Table of Contents
Preface .............................................................................................................................................................................. 7
Audience .......................................................................................................................................................................................7
Requirements .............................................................................................................................................................................7
Contents ........................................................................................................................................................................................7
Chapter 1 – Using SQLWindows ............................................................................................................................... 9
Installing Team Developer .....................................................................................................................................................9
Installing and Using Team Developer from Remote Clients..............................................................................9
Tutorial for SQLWindows .................................................................................................................................................... 10
Creating AccountInfo.app: Overview ..................................................................................................................... 12
Creating the Login Dialog ........................................................................................................................................... 13
Coding the Login Dialog ...................................................................................................................................................... 16
Defining Variables .......................................................................................................................................................... 16
Coding the Application Start-up and Exit Functions ......................................................................................... 17
Defining Parameters ...................................................................................................................................................... 18
Coding the Data Fields .................................................................................................................................................. 19
Coding the OK Push Button......................................................................................................................................... 19
Coding the Cancel Push Button ................................................................................................................................. 20
Coding the Dialog Box to Open on Start-up .......................................................................................................... 21
Running the Application ..................................................................................................................................................... 21
Creating the Form Window........................................................................................................................................ 22
Populating the Form Using SQL and SAL...................................................................................................................... 25
Populating the Data Fields .......................................................................................................................................... 25
Populating the Child Table Window ........................................................................................................................ 27
Completing the Application ............................................................................................................................................... 28
Add Navigation Controls ..................................................................................................................................................... 29
SAL for Navigation Buttons ................................................................................................................................................ 29
Coding the First Push Button ..................................................................................................................................... 30
Coding the Prev Push Button ..................................................................................................................................... 30
Coding the Next Push Button ..................................................................................................................................... 31
Coding the Last Push Button ...................................................................................................................................... 31
Running the Application ..................................................................................................................................................... 32
Chapter 2 – Desktop and Components ................................................................................................................ 34
SQLWindows ............................................................................................................................................................................ 34
SQLWindows Desktop .......................................................................................................................................................... 35
3
Toolbar ............................................................................................................................................................................... 36
Database Explorer ................................................................................................................................................................. 42
Visual Toolchest Class Library .......................................................................................................................................... 44
Windows Explorer Controls ....................................................................................................................................... 44
Calendar Controls........................................................................................................................................................... 44
Color Palette Controls ................................................................................................................................................... 44
Dynalibs: Dynamic Linked Objects ................................................................................................................................. 44
Team Object Manager ........................................................................................................................................................... 45
Team Object Repository .............................................................................................................................................. 46
Visual Diff and Merge .................................................................................................................................................... 46
Object Browser ................................................................................................................................................................ 47
Data Model Viewer......................................................................................................................................................... 48
QuickObjects ............................................................................................................................................................................ 48
Create Your Own QuickObjects ................................................................................................................................. 49
Web Access QuickObjects ............................................................................................................................................ 49
QuickEmail ......................................................................................................................................................................... 50
QuickReport ..................................................................................................................................................................... 50
QuickTabs ........................................................................................................................................................................... 51
QuickGraph ....................................................................................................................................................................... 51
SQLBase Database Engine .................................................................................................................................................. 51
Database Utilities ............................................................................................................................................................ 51
Native Connectivity to SQL Databases ........................................................................................................................... 52
ODBC Connectivity to SQL Databases ..................................................................................................................... 52
SQLTalk ............................................................................................................................................................................... 52
SQLConsole ....................................................................................................................................................................... 52
Chapter 3 – Using ActiveX Objects ........................................................................................................................ 53
Look at the Finished Application .................................................................................................................................... 53
Prepare the Login................................................................................................................................................................... 54
Create the Form Window.................................................................................................................................................... 55
Add a Calendar Control, Table, and Graph................................................................................................................... 56
Drop the Visual Controls ..................................................................................................................................................... 59
Code the Application ............................................................................................................................................................ 60
Define Contents for the Graph .................................................................................................................................. 62
Add an ActiveX Control ................................................................................................................................................ 63
Set the Actions for the Push Buttons ............................................................................................................................. 64
Run the Application .............................................................................................................................................................. 65
4
Chapter 4 – Developing N-Tier Applications Using TD and COM ............................................................... 67
Advantages of COM Applications..................................................................................................................................... 67
Overview of the Tutorial COM Application .................................................................................................................. 68
Running the Tutorial COM Application .................................................................................................................. 68
Tutorial COM Server ............................................................................................................................................................. 69
Creating Interfaces and CoClasses .......................................................................................................................... 69
COM Server Issues ......................................................................................................................................................... 75
Tutorial COM Client ............................................................................................................................................................... 76
Using COM Server Functionality from the Client .............................................................................................. 77
Building a COM Server and COM Client ........................................................................................................................ 83
Building a COM Server ................................................................................................................................................. 83
Building and Running the COM Client ................................................................................................................... 84
Troubleshooting ..................................................................................................................................................................... 85
OLE Automation Run-time Error............................................................................................................................. 85
Exercises .................................................................................................................................................................................... 85
Chapter 5 – Using Team Developer and COM+ ................................................................................................. 86
Running the Tutorial COM Server in COM+ ................................................................................................................ 86
Installing the Tutorial COM+ Server in COM+ .................................................................................................... 87
Converting the COM Tutorial Application to Use COM+........................................................................................ 88
Converting the COM Server to Use COM+ ............................................................................................................. 88
Modifying the Client to Use the Server ................................................................................................................... 93
Creating an ASP Client for a COM Server...................................................................................................................... 95
System Requirements .................................................................................................................................................. 95
Running the Tutorial ASP Pages .............................................................................................................................. 95
Overview of the Tutorial ASP Pages ....................................................................................................................... 96
Calling a COM Server from an ASP Page ............................................................................................................... 97
Chapter 6 – Managing Teams and Objects.......................................................................................................... 98
Managing Teams and Objects ........................................................................................................................................... 98
Team Object Repository .............................................................................................................................................. 98
Requirements .......................................................................................................................................................................... 98
Create a Project....................................................................................................................................................................... 99
Starting Team Object Manager ................................................................................................................................. 99
Creating a New Project ................................................................................................................................................ 99
Bring an Application into the Repository ................................................................................................................. 102
Adding qckfinal.app to the Project....................................................................................................................... 102
Checking Out a File from the Repository .................................................................................................................. 104
5
Editing the Checked-Out File.................................................................................................................................. 105
Diff/Merge Tool ................................................................................................................................................................... 105
Change qckfinal.app and Save as qck2.app ...................................................................................................... 105
Compare the Two Files ............................................................................................................................................. 107
Checking a File Back into the Repository.................................................................................................................. 109
Short Tour of the Team Object Manager Interface ................................................................................................ 110
Chapter 7 – More Information............................................................................................................................. 112
Gupta Books Online ........................................................................................................................................................... 112
Application Development ........................................................................................................................................ 112
SQLBase .......................................................................................................................................................................... 113
Connectivity .................................................................................................................................................................. 113
Appendix – Installing the Tutorial COM/MTS Server in MTS ................................................................... 114
6
Preface
The purpose of this document is to help you install Team Developer on your workstation and to get you
started building applications and managing projects.
Audience
This document is intended for first-time Team Developer users, users looking to try the new features of Gupta
Team Developer, or for those evaluating Team Developer for use within their organization. This document
helps you become familiar with the Team Developer interface and programming tools.
Requirements
This manual assumes you have experience with:
• Intel-compatible Personal Computers
• Microsoft Windows
• A programming language such as C, Java, or Basic
• SQL (Structured Query Language) and relational databases
• COM (Common Object Model) programming
• DLLs (Dynamic Link Libraries)
• LANs (Local Area Networks)
Contents
This manual contains software installation procedures, explanations of Team Developer concepts, and
tutorials explaining the basics of SQLWindows programming. After using the manual, you will be ready to use
Team Developer to write your own applications.
• Chapter 1 – Using SQLWindows
Shows you how to start building applications with Gupta SQLWindows. Includes a tutorial that shows you
how to build a simple Windows application using SQLWindows.
• Chapter 2 – Desktop and Components
Introduces the Gupta user interface and the various tools included with SQLWindows.
• Chapter 3 – Using ActiveX Objects
Explains how to use an ActiveX object in a SQLWindows application.
• Chapter 4 – Developing N-Tier Applications Using TD and COM
7
Introduces COM programming in SQLWindows and guides you through the process of creating a simple
COM-based application using the sample COM application provided with Gupta Team Developer.
• Chapter 5 – Using Team Developer and COM+
Describes how to modify a SQLWindows developed COM application so that it can be deployed using
COM+ (previously MTS). It uses the sample COM+ application provided with Gupta Team Developer to
illustrate this process. It also shows you how to develop an ASP-based COM client for a SQLWindows-
based COM server.
• Chapter 6 – Managing Teams and Objects
Introduces Team Object Manager, which enables you to track large-scale projects involving teams of
developers.
• Chapter 7 – More Information
Provides information on the Gupta Bookcase and Gupta Books Online.
8
Chapter 1 – Using SQLWindows
This chapter introduces you to developing applications with SQLWindows, a client/ server application
development and deployment environment for Microsoft Windows. For information on the SQLWindows
desktop, see chapter 2, “Desktop and Components.” There you can learn about the outline tab and the tools
you use in this chapter such as the Coding Assistant and the Attribute Inspector.
SQLWindows lets you code and layout applications in an integrated graphical environment:
SQLWindows includes the following features:
• Drag-and-drop user interface design
• Multiple source code and user interface views
• Context-sensitive coding assistant
• Online help for all functions
• Interactive debugging
9
In the sql.ini file in the Team Developer directory, replace "localhost" with the hostname or IP address of the
server machine. This enables remote clients to properly connect to SQLBase, as well as use the tools available
through the Team Developer "Tools" menu.
Register and activate the product before performing remote installs.
Client setup
From a remote machine, map a drive letter and location corresponding with installation on the server
machine. Find and run SetupClient.bat in the Team Developer directory. This installs registry entries, program
group entries, and Add/ Remove Programs entries.
• register.htm is a reminder for registration of the product. This is created in the temp folder of the remote
client.
• SetupTDClient.reg and SetupRBClient.reg update registry entries for file associations. Double click on
these registry files to run them. These are created in the temp folder of the remote client.
The PATH environment variable on the remote machine is not updated as part of the installation. You may
need to modify the PATH to point to the program directory on the mapped drive. For example add
"C:\;C:\Program Files (x86)\Gupta\Team Developer 7.4;" to the PATH environment variable. To access
environment variables, right-click My Computer and select Properties. In the Advanced tab, click the
Environment Variables button.
If the PATH is not modified, issues, such as not being able to access the online help, could arise.
Please register and activate the product.
You cannot run Team Developer both locally and via network on the same machine unless you appropriately
set registry entries like the INIFilePath, as well as address the file associations.
10
6. Click OK. SQLBase, SQL Database, is launched and the Account Information Form is displayed.
7. Click the First, Next, Previous, and Last push buttons to scroll through the available data.
This application draws information from a sample database called ISLAND that is included with SQLBase.
The ISLAND database includes account and product information for a fictitious company called Island T-
Shirts. The Account Info application allows you to examine the clients and invoices listed in the ISLAND
database. The table shows the active orders for the company name on the screen. The data fields show
the status of the account.
8. Select Close from the System menu in the title bar of the Account Information window.
11
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.
9. To begin, select New from the File menu. Select newapp.app as the template for your application. Click
OK. The Templates dialog box is displayed.
12
Creating the Login Dialog
To create the login dialog box for the application, follow these steps:
1. Right-click the Windows folder in the left hand pane. Select New > Dialog Box. A standard dialog window
appears.
2. 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.
13
3. Select Controls from the Tools menu to bring up the Controls toolbar. Select the standard Data Field
control from the Controls palette, move your cursor over the dialog, and click to drop the data field on the
dialog box.
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. Next, drop a third standard data
field under the second. In the Attribute Inspector, change the Data Field name from df3 to dfPassword.
Arrange the data fields and resize the dialog as shown below:
14
6. Label the data fields. Select the standard Background Text control from the Controls palette.
7. Drop a Background Text box next to each of the data fields. Label them as follows:
Database
User Name
Password
Your dialog should appear as shown below:
8. Select the Standard Push Button control from the Controls toolbar.
9. Place the push button object at the bottom of the dialog box and type OK. With the push button selected,
open the Attribute Inspector. Change the push button name from pb1 to pbOK.
10. Select the Standard Push Button control from the Controls palette again. Drop a 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 should now appear as shown below:
15
You must 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 this dialog, you must create
the form window.
Click 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 pop-up menu. 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 appears as shown below:
Defining Variables
To define the global variables for the application, follow these steps:
1. Click the Outline tab in the right pane.
In the left pane, select Application1. The outline for the entire application is displayed in the right pane.
2. Double-click Global Declarations in the right pane, and then click Variables.
Select Coding Assistant from the Tools menu.
In the Coding Assistant, double-click Sql Handle to add it to the Variables section of your outline.
Type hSql in the outline.
3. In the Coding Assistant, double-click Boolean to add it to your outline.
Type bConnect in the outline.
Your outline should appear as follows:
16
Coding the Application Start-up and Exit Functions
To code the start-up and exit functions, follow these steps:
1. Under Global Declarations, click Application Actions.
In the Coding Assistant, double-click On SAM_AppStartup.
2. Double-click If in the lower part of the Coding Assistant.
Select Sal Functions from the drop-down menu in the Coding Assistant. The Coding Assistant displays the
available functions.
Start typing SalModalDialog in the text box below the drop-down box in the upper part of the Coding
Assistant to locate this function. Notice that the function name appears highlighted in the function list.
Press Enter when SalModalDialog becomes highlighted.
17
Double-click Call in the lower part of the Coding Assistant.
Start typing SalCreateWindow in the text box below the drop-down 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.
Replace the Template, Window_Handlehighlighted text with frm1, hWndNULL.
4. Select On SAM_AppStartup. The code you select in the outline determines where SQLWindows inserts
the next call.
5. 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.
6. 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.
Note: If the Coding Assistant does not already display “SAL Functions” or “SAL+User Functions” in the
uppermost combo box after you double-click Call, you should drop down the combo box and select
one of those two values and begin typing SQLDisconnect in the text box.
Defining Parameters
To define the parameters for the data fields, follow these steps:
1. Under the dlgLogin section in the outline, select Window Parameters .
In the Coding Assistant, double-click String, 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 should appear as follows:
Window Parameters String: strDefDatabase String: strDefUser String:
strDefPassword
18
Coding the Data Fields
To code the data fields in the Login dialog box, follow these steps:
1. Under Dialog Box: dlgLogin, Contents, double-click Data Field: dfDatabase in the outline so that Message
Actions is showing.
Select Message Actions under the Data Field: dfDatabase section.
Double-click ON SAM_Create in the Coding Assistant.
Double-click Set in the lower part of the Coding Assistant.
2. In the outline, after Set, type dfDatabase = strDefDatabase.
The statement should appear as follows:
Set dfDatabase = strDefDatabase
3. Repeat steps 1 and 2 for dfUser (Set dfUser = strDefUser) and dfPassword (Set dfPassword =
strDefPassword).
The outline should appear as follows:
Data Field: dfDatabase
Message Actions
On SAM_Create
Set dfDatabase = strDefDatabase
Set dfUser = strDefUser
Set dfPassword = strDefPassword
19
Now you call a function to change the cursor back from an hour glass to show that the application is no longer
busy.
8. Double-click Call in the Coding Assistant.
Start typing SalWaitCursor in the text box below the list combo box in the upper part of the Coding
Assistant to find this function.
Press Enter when SalWaitCursor becomes highlighted.
Call SalWaitCursor( Boolean ) appears in your outline. Boolean is already highlighted. Type FALSE over it.
9. Double-click If in the Coding Assistant and type bConnect.
10. Double-click Call in the lower part of the Coding Assistant.
Start typing SalEndDialog in the text box below the list combo box in the upper part of the Coding
Assistant.
Press Enter when SalEndDialog becomes highlighted.
Call SalEndDialog( Window_Handle, Number ) appears in your outline. Window_Handle, Number are
already highlighted.
Type dlgLogin, TRUE over them. Your outline looks like this:
Pushbutton: pbOK
Message Actions
On SAM_Click
Set SqlUser = dfUser
Set SqlPassword = dfPassword
Set SqlDatabase = dfDatabase
Call SalWaitCursor( TRUE )
Set bConnect = SqlConnect ( hSql )
Call SalWaitCursor( FALSE )
If bConnect
Call SalEndDialog( dlgLogin, TRUE )
20
Coding the Dialog Box to Open on Start-up
To code the Login dialog box to open on application start-up, follow these steps:
1. Click Message Actions under Dialog Box: dlgLogin.
Double-click On SAM_Create in the Coding Assistant.
2. Double-click Call in the Coding Assistant.
Start typing SalCenterWindow in the text box below the list combo box in the upper part of the Coding
Assistant to find this function.
Press Enter when SalCenterWindow becomes highlighted.
Call SalCenterWindow( Window_Handle ) appears in your outline. Window_Handle is already
highlighted. Type hWndForm over it.
3. Double-click Call in the Coding Assistant.
Double-click SalSetDefButton in the Coding Assistant.
Call SalSetDefButton( Window_Handle ) appears in your outline.
Window_Handle is already highlighted. Type pbOK over it. Your outline looks like this:
Message Actions
On SAM_Create
Call SalCenterWindow( hWndForm )
Call SalSetDefButton( pbOK )
You have just finished building and coding your Login dialog and:
• 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.
21
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.
The application compiles. Your Database Login dialog appears.
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):
23
Company ID dfCOMPANY_ID Number
Company Name dfCOMPANY_NAME String
Date of Invoice dfINVOICE_DATE Date/Time
Date Paid dfDATE_PAID Date/Time
Status dfSTATUS String
Amount Paid dfAMOUNT_PAID Number
Employee ID dfEMPLOYEE_ID String
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.
24
Populating the Form Using SQL and SAL
This section describes had to add code to the various elements of the form window, including the data fields
and child table window.
25
: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.
26
Populating the Child Table Window
To add the code necessary to making the child table window functional, follow these steps:
1. In the outline, double-click Child Table: tblINVOICE_ITEM. Click Window Variables.
Double-click Sql Handle in the Coding Assistant. Type hSqlTable for the variable name in the outline.
2. Click Functions, then double-click Function in the Coding Assistant and type PopulateChildTable.
3. Click Actions.
Double-click Call in the Coding Assistant.
Double-click SalTblReset in the Coding Assistant
Call SalTblReset( Window_Handle )is added to the outline.
Replace Window_Handlewith tblINVOICE_ITEM.
Press Enter.
4. Double-click Call in the Coding Assistant.
Double-click SalTblPopulate in the Coding Assistant.
Call SalTblPopulate( Window_Handle, Sql_Handle, String, Number )is added to the outline.
Replace ( Window_Handle, Sql_Handle, String, Number ) with
( tblINVOICE_ITEM, hSqlTable, 'SELECT
INVOICE_NO,
ITEM_NO,
STYLE_ID,
STYLE,
COLOR,
QUANTITY,
ITEM_PRICE
FROM INVOICE_ITEM
WHERE INVOICE_NO = :dfINVOICE_NO', TBL_FillNormal )
5. Click Message Actions for ChildTable:tblINVOICE_ITEM.
Double-click On SAM_Create in the Coding Assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click SqlConnect in the Coding Assistant.
Call SqlConnect( Sql_Handle )is added to the outline.
Replace Sql_Handlewith hSqlTable.
6. Click On SAM_Create in the outline. This puts you at the correct level of indentation for your next
function call.
7. Double-click On SAM_Destroy in the Coding Assistant.
Double-click Call in the lower part of the Coding Assistant.
Double-click SqlDisconnect in the Coding Assistant
Call SqlDisconnect( Sql_Handle)is added to the outline.
Replace Sql_Handlewith hSqlTable.
The outline looks like this:
27
Completing the Application
To call a function to populate the data fields, follow these steps:
1. Click Form Window: frm1. Click Message Actions.
In the Coding Assistant, double-click On SAM_CreateComplete.
Double-click Call in the lower part of the Coding Assistant.
Double-click PopulateFormWindow in the Coding Assistant.
Call PopulateFormWindow ( ) is added to the outline.
There are no parameters needed, so this call is complete.
2. Click Form Window: frm1 again.
Double-click Functions.
Double-click Function: PopulateFormWindow.
Double-click Actions.
Click the statement Call SqlFetchNext( hSql, nFetch ).
Press Insert. This inserts a new line.
Type:
Call tblINVOICE_ITEM.PopulateChildTable( )
This makes a call to the Populate function of the Child Table, so that the Child Table is populated.
28
Add Navigation Controls
1. Right-click on frm1 in the left pane. Select Preview Window.
2. In the Attribute Inspector for the form, change Accessories from No to Yes.
3. Select a standard push button from the Controls palette and drop the push button on the left corner of
the toolbar. Type First in the Object title field.
4. In the Attribute Inspector for the push button, name the push button pbFirst. Go to File Name: and
click the ellipse (...). The Open dialog box appears. Find toprec.bmp (you may need to navigate up one
directory). Click Open.
Repeat steps 3-4 for three more push buttons you add to the toolbar:
• Next (pbNext, Next, nextrec.bmp)
• Previous (pbPrev, Prev, prevrec.bmp)
• Last (pbLast, Last, lastrec.bmp)
The competed form appears as follows:
29
Coding the First Push Button
To code the First push button, follow these steps:
1. In the outline, double-click Pushbutton: pbFirst.
Click Message Actions.
In the Coding Assistant, double-click On SAM_Click, and double-click Call in the lower part.
2. In the Coding Assistant, double-click PopulateFormWindow.
Your code for this push button looks like this:
Pushbutton: pbFirst
Message Actions
On SAM_Click
Call PopulateFormWindow( )
30
Coding the Next Push Button
To code the Next push button, follow these steps:
1. Double-click Pushbutton: pbNext.
Click Message Actions.
In the Coding Assistant, double-click On SAM_Click.
Double-click If in the lower part of the Coding Assistant, and type NOT.
In the Coding Assistant, double-click SqlFetchNext.
SqlFetchNext( Sql_Handle, Number ) is added to the outline.
Replace Sql_Handle, Number with hSql, nFetch and press Enter.
The statement now reads:
If NOT SqlFetchNext( hSql, nFetch )
2. Double-click Call in the lower part of the Coding Assistant.
Double-click SalMessageBox in the Coding Assistant.
Replace String, String, Number with:
'There are no more records', 'End Of Fetch', MB_Ok
3. Click the statement If NOT SqlFetchNext( hSql, nFetch ).
Double-click Else in the upper part of the Coding Assistant.
Press Enter.
Press the Insert key.
Press the ALT + right arrow (to indent the line).
Type Call tblINVOICE_ITEM.PopulateChildTable( )
Your code for this pushbutton looks like this:
Pushbutton: pbNext Message Actions
On SAM_Click
If NOT SqlFetchNext( hSql, nFetch )
Call SalMessageBox( 'There are no more records', 'End of Fetch',
MB_Ok )
Else
Call tblINVOICE_ITEM.PopulateChildTable( )
31
If SqlFetchRow(Sql_Handle, Number, Number ) is added to the outline. Replace Sql_Handle, Number,
Number with:
hSql, nLastRecord - 1, nFetch.
2. Press Enter.
Press Insert (to create a new blank line).
Press ALT +the right arrow key (to indent the outline).
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.
32
Congratulations! You’ve just completed building and running an application. In the chapters ahead, you will
discover the convenience of Gupta ActiveX support for applications and reports, and the power of object-
oriented programming.
33
Chapter 2 – Desktop and Components
This chapter describes the following Team Developer tools:
• SQLWindows
• Database Explorer
• The Visual ToolChest class library
• Dynalibs - dynamically linked libraries
• Team Object Manager
• QuickObjects
• SQLBase database engine
• Team Developer native connectivity
SQLWindows
The most recent versions of Windows 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. Team Developer applications run as native
32-bit applications on Windows XP, 7, 8, Server 2003, Server 2008, Server 2012 or VISTA. You use
SQLWindows to build these 32-bit applications.
SQLWindows has a user interface that closely matches the look and feel of Windows. 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.
34
SQLWindows was designed as a fully 32-bit environment to maximize scalability. It was built using the Win32
interface. SQLWindows or 32-bit applications built with SQLWindows do not run on Windows 3.1.
Programmers who need to deploy applications on Windows 3.1 must build their applications using the 16-bit
version of SQLWindows (i.e. version 1.1.1 ). You can covert 16-bit windows applications to 32- bit SQLWindows
applications, but the reverse is not possible. The most effective way to build scalable and fast applications is to
use Win32 on Windows XP, 7, 8, 2003 Server, 2008 Server, 2012 Server and Vista which Gupta fully supports.
SQLWindows Desktop
You have already been introduced to SQLWindows in Chapter 1 where you built SQLWindows 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.
35
Toolbar
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. Either view can be scrolled vertically with a wheel mouse.
• Use the tab views to see various presentations of different sections of your application code. As you build
an application, SQLWindows 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.
The toolbars provide icons that help you build and edit your application quickly and easily. They also provide
quick access to various components of Team Developer.
36
You can customize your toolbar in SQLWindows. The following picture shows you a typical set of SQLWindows
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.
37
Status bar
SQLWindows has a status bar at the bottom that shows the settings 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.
38
Displaying and using the Controls toolbar
To display the Controls toolbar at any time, press Alt+4 or select Controls from the Tools menu.
1. Click the icons for a data field, push button, picture, or other object.
2. Click the class type, Standard or Quick, from the class list box in the bottom part of the toolbar.
3. Click on the form window and drop the object onto the form.
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 SQLWindows, 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.
39
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.
40
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 the help at any time by pressing F1.
Component wizards
Programmers can get started quickly by using the new Component Wizards. SQLWindows comes with a
number of wizards for easy application building.
41
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, SQLWindows includes easy
to use schema management functionality.
Database Explorer allows you to browse, create or modify database object like tables, views and indexes. You
can also design and format reports.
Because it is based on an intuitive “explorer” metaphor, it makes navigation of database structure very easy. It
also includes full data preview capabilities for quickly reviewing database content. The Database Explorer
works with all popular data sources in the same easy and consistent manner. You can write stored
procedures, queries, edit data and execute SQL scripts, all from one utility.
To bring up the Database Explorer, select Tools, Database Explorer in SQLWindows.
42
To manage stored procedures in SQLBase and Oracle databases, Team Developer’s multi-database stored
procedure manager offers some unique functionality. It allows you to browse, edit, create, compile and debug
stored procedures in popular databases using a consistent and attractive user interface. After the stored
procedure has been fully developed, Team Developer offers a highly productive way to integrate it into
applications. It includes a Stored Procedure Class Wizard for stored procedure access which allow you to
invoke stored procedures and display results without writing any code.
For example, a push button can be created to automatically fire-off a stored procedure, and the data set
retrieved can be displayed in a table window graphical object. This unique capability works in the same easy
and consistent way across popular databases, and is a huge productivity enhancing factor. Now even novice
developers can integrate stored procedures into their Team Developer applications with just a few mouse
clicks.
43
Visual Toolchest Class Library
The Visual Toolchest is a class library (APL file) that links into your SQLWindows applications to provide more
than 250 functions and 17 classes for:
• Windows controls
• Powerful data manipulation
• Table-tree database display
• Font and color control
• Creating customized Windows controls
• Extended keyboard accelerator support
• Expanded file management
• and much more...
The Visual Toolchest class library includes Windows Explorer, calendar, color palette, and split window controls.
Programmers can use these rich visual controls for building intuitive applications, some specially designed to
emulate the Windows look and feel.
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.
44
single MDI frame. This simplifies the problems associated with frequently switching from one program to
another.
You can build objects using SQLWindows, then compile them into object libraries, called Dynalibs, that may
be dynamically loaded by your application at execution time. Dynalibs allow you to manage such an
application by placing parts of a large system into independent dynamic run-time libraries. You can assign
parts of a large project to separate developers and bring them together at run-time.
Applications can share pre-compiled components, resulting in faster development because of greatly reduced
compilation. Application distribution is easy because certain components of a SQLWindows application could
be replaced without requiring the entire application to be recompiled and rebuilt. Providing updates to your
applications can be as simple as distributing a Dynalib.
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 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, Team Developer 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 Team Object Manager, even when you are working with
multiple versions. The project branching feature allows you to work on multiple versions concurrently. For
example, after developing version 1 of an application, you might want to simultaneously work on version 1.1
and version 2.
45
With Team Object Manager 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,
Team Developer allows you to assign and manage roles and privileges for various team members.
46
The Diff and Merge utility goes far beyond difference reports in these ways:
• Graphical comparison of two files to determine where they differ. The Diff tool shows a list of the
differences in a very visual manner. A sample of this work is shown below, demonstrating the way that
the differences between the two files are displayed side-by-side.
• Creation of reverse delta files to store the changes between file revisions. This means that, for example,
an original file and a revision of that file can be stored as one base file, and a list of the changes that
would be necessary to convert the stored file to the previous version. Additional revisions would mean
only additional change lists need be stored, rather than files containing the complete files. This is very
space efficient, and thus allows Team Object Manager to store an unlimited number of revisions for
future recovery.
• Two- and three-way merging of files. Team Object Manager can perform two way merges, combining a
base file and a revised file to produce a unified project version. Three-way merges work in the same way,
combining a base file and two modified files to produce a file containing both sets of changes.
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.
47
Data Model Viewer
The Team Object Repository stores all the information about the structure of your project databases: the
names of the tables (entities) and columns (attributes), the primary and foreign key relationships, and
information about data types, display formats, default values and validation criteria.
Data models are formalized ways of displaying database structure information. The Data Model Viewer is built
around the concept of data models as objects. Data Models are treated just like any other file in the
repository in that they can be branched, shared, or checked in and out, and any number of revisions can be
kept. Multiple data models can be maintained for each project.
In addition to modeling the normal database information (tables, columns, relationships etc.) the Data Model
Tool is designed to include properties that are used by QuickObjects. Extensive facilities are provided to
attach these properties to your database information so that when you use a QuickObject in your application
its property information can be supplied from the model.
The Data Model Viewer offers a powerful graphical interface to the repository, called the Entity Relationship
diagram. The Entity Relationship diagram allows you to graphically view the database model in order to
improve clarity. It does not, however, allow you to change the database schema.
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, Gupta
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
Benefits to using QuickObjects include the following:
48
• You can use QuickObjects right away to build your applications, as explained in Chapter 1.
• QuickObjects are based on object-oriented concepts and are fully extensible. For example, you can take a
QuickObjects class such as a Fetch All Records push button and derive your own specialized Fetch Records
for customers who pay by credit card.
Programmers want to either extend applications by creating their own QuickObjects or modifying the existing
QuickObjects. Read the Using and Extending QuickObjects book for information on QuickObject concepts, the
QuickObject Framework, QuickObject libraries for OLE2, and eMail.
49
HTML is used to create World-Wide Web documents that are subsequently transmitted using HTTP. The
HTML control parses and displays HTML
QuickEmail
pages. The HTML QuickObject lets you integrate Internet Web browser capabilities directly into your
applications. You can drop the control onto a form or dialog.
• cQuickHTTP
HTTP is the language of the World Wide Web. An HTTP request goes to a server, which then replies with
an HTML page. The HTTP QuickObject lets you retrieve HTML page contents without displaying the pages.
Retrieval time is significantly faster because you are not retrieving and displaying graphics and non-
textual data. You can then parse links from a page and extract the textual data without the HTML tags.
• cQuickFTP
The FTP QuickObject lets you perform file operations on a remote FTP server. FTP Servers are similar to
LAN file servers in that they supply files to client machines that request the files. Using this control, you can
write applications that can list files and directories on servers, get and put files on servers, and read and
write files on servers.
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 SQLWindows environment.
WYSIWYG reporting within 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 across tabular
report template that conforms to corporate standards. This report template is, in turn, used by programmers
in several departments:
• In the accounting department, the report would be tied to Product and Revenue tables to create a report
on product revenue by financial quarter and by product.
• In the manufacturing department, the report would be tied to Part and Inventory tables to create a report
on part inventory by month and by warehouse.
QuickReport allow you to create new report templates by integrating with the Report Builder. QuickReports
make it easier to reuse templates, populate report templates with data, and integrate reports seamlessly with
other objects on an application form. The process of using QuickReports to integrate a report into an
application is:
• Report designer builds a report using the Report Builder.
• Report designer builds a QuickReport template from the report, and makes these available to other
programmers. Typical report templates may be horizontal in nature, such as Mailing Label reports; or they
may be vertical in nature, such as Department Salary reports.
• Report assemblers use QuickReports within SQLWindows to build reports- in-forms from these templates.
This involves associating data, in the form of QuickObject data sources, with QuickReport templates.
50
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.
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 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.
Database Utilities
SQLBase Desktop comes with a comprehensive set of graphical tools to manage and administer your desktop
database environment.
51
• 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.
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.
52
Chapter 3 – Using ActiveX Objects
With Team Developer ActiveX support, you can embed objects from other applications in your applications.
This chapter shows you how to build an application that displays database budget information in both table
and graph form, linked to Microsoft Calendar Control 8.0 to display the month.
This chapter describes how to use Team Developer QuickObjects to do the following:
• Use QuickObjects to save yourself coding time by using a pre-defined database login dialog.
• Link and embed Microsoft Calendar Control 8.0 in your application.
• Create a QuickObject graph linked to the calendar and table to display a pie chart.
To add the Microsoft Calendar Control 8.0, it must be installed on your machine. It was installed if you
installed Microsoft Access during a Microsoft Office 97 install, selected Options, and checked Calendar
Control.
4. Enter ISLAND, SYSADM, and sysadm, respectively, in the fields and click OK.
The Department Budgets window opens.
53
Use the push buttons in the toolbar to navigate through the budget records in the database.
54
This brings up the Open file dialog box.
Find qckttip.apl in the Samples directory and click Open.
Press Enter.
Add qckttip.apl to enable tooltips in your application. This lets you define tooltip help for the push button
in your application. In addition, another library, called ttmngr.apl, is automatically added to the Libraries
outline section.
4. In the Coding Assistant, double-click File Include...
Find table.apl in the Samples directory and click Open.
This file provides the class support for the table window and links the Calendar Control, Table, and Graph
together. For a step-by-step description of how to create the table.apl library, see Chapter 3 – Object-
Oriented Programming.
Your outline should look like the following:
Libraries
File Include: qckdvc.apl
File Include: qckttip.apl
File Include: table.apl
File Include: Ttmngr.apl
Global Declaration
Dialog Box: dlgQOLogin
55
Add a Calendar Control, Table, and Graph
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.
1. Select Controls from the Tools menu.
2. Click the ActiveX object (icon has a red X) in the Controls toolbar.
In the lower part of the Controls toolbar, a list of currently registered ActiveX controls appears.
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:\GUPTA\AXLibs\ Microsoft Calendar Control 8.0.apl
File Include: Automation.apl
File Include: OLE Automation.apl
56
4. Right-click the Calendar Control and select Control Properties.
In the General tab, on the left side of the Properties dialog, select Short for Day Length and Month Length.
Set Grid Cell Effect to Flat.
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 should look like the following:
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 should look like the following:
57
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.
7. Right-click the cQuickGraph object.
Select cQuickGraph Properties.
On the 2D Gallery tab, select the Pie graph.
8. Select the Titles tab.
Enter Monthly Budget by Department for the Graph Title.
9. Select the Design tab.
In the Toolbar group, uncheck the Run Time and Design Time checkboxes.
10. Select the QuickGraph tab.
Remove the check mark from the None checkbox in the Values to Graph (Y- axis).
11. Click OK.
Your form should look like the following:
58
Drop the Visual Controls
1. Select the Push Button object in the Controls toolbar.
In the lower part of the Controls toolbar, select the QuickToolTipPushButton. Drop this on the left side of
toolbar.
In the Attribute Inspector, change the name from pb1 to pbFirst.
Locate File Name, and click the ellipses (...).
2. In the Open dialog box, select toprec.bmp (usually in the C:\GUPTA directory).
Click Open. An arrow icon appears on the push button.
Click OK.
4. Repeat the previous three steps three more times to add the following controls:
Previous (pbPrev, prevrec.bmp, Previous)
Next (pbNext, nextrec.bmp, Next)
59
Last (pbLast, lastrec.bmp, Last)
Note: Resize the push buttons so you can see the arrow bitmaps.
61
Define Contents for the Graph
To link the graph to the table window, follow these steps:
1. Double-click Contents.
Double-click cQuickGraph: cc1.
Click Message Actions.
Double-click On DRAWNOTIFY in the Coding Assistant.
Double-click Set in the lower part of the Coding Assistant and type the following:
cc1.Graph.DataSource = ‘tbl1’
Set the graph to display information from the highlighted column in the table, and specify the number of
data fields to graph.
2. Click On DRAWNOTIFY in the outline.
Double-click Set in the Coding Assistant.
In the outline, after Set, type the following:
cc1.Graph.DataField[0] = 'col' || SalNumberToStrX( nMonth, 0 )
This selects one numeric field from a data source.
3. Double-click Set in the Coding Assistant and type the following:
cc1.Graph.NumDataFields = 1
4. Double-click Call in the Coding Assistant and type Draw ( )
Your code should look like the following:
Contents
MSACAL_Calendar: ax1
BudgetTable: tbl1
cQuickGraph: cc1
Message Actions
On DRAWNOTIFY
Set cc1.Graph.DataSource = ‘tbl1’
Set cc1.Graph.DataField[0] = ‘col’ || SalNumberToStrX( nMonth, 0 )
Set cc1.Graph.NumDataFields = 1
Call Draw( )
5. Goto Form Window: frm1.
Double-click Message Actions.
Click On SAM_CreateComplete.
Double-click Call in the Coding Assistant.
Select the Sal + User Functions from the list box in the Coding Assistant.
Double-click SalPostMsg to add it to the outline.
Replace Window_Handle, Number, Number, Number with cc1, DRAWNOTIFY, 0, 0
This posts the information from the Calendar control to the graph so that the graph can be drawn.
Your code should look like the following:
Message Actions
On SAM_Create
62
On SAM_CreateComplete
Call Calendar.PropGetMonth( nMonth )
Call tbl1.SelectColumn( nMonth + 1)
Call SalPostMsg(cc1, DRAWNOTIFY, 0, 0 )
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.
63
MSACAL_Calendar: ax1
Message Actions
On NewMonth
Paramters
Actions
Call Calendar.PropGetMonth (nMonth)
Call tbl1.SelectColumn( nMonth + 1 )
Call SalPostMsg( cc1, DRAWNOTIFY, 0, 0 )
3. When the Login dialog appears, enter ISLAND, SYSADM, and sysadm, respectively, in the data fields.
4. Click OK to bring up the form window, Department Budgets.
The form should look like the following:
65
Use the navigation buttons to browse the database records. Notice how the calendar, the graph, and the
table are linked.
You’ve just written a Gupta application with an embedded ActiveX object! In the next chapter, we’ll take a
close look at the concepts of object-oriented programming by building the table.apl library you used in this
tutorial.
66
Chapter 4 – Developing N-Tier Applications
Using TD 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, Gupta 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 Gupta SQLWindows manual for more information on COM programming in TD.
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
67
• Binary file reuse and file versioning
COM allows you to reuse binary files within an application, across applications, and by other COM servers.
It also includes a built in versioning system.
• Reduces the maintenance requirements for client applications
Changes and enhancements can be made to COM servers without having to update the client applications
that invoke the COM server functionality.
Note: This application is relatively complicated. Walking through all the required steps is beyond the scope
of this document. The tutorial provides some background on COM and on developing COM
applications in Team Developer. The COM samples illustrate a variety of COM-related issues and
provide developers with a working COM application to examine for future projects of their own.
The example 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 the features of the tutorial COM application, the following must be installed: OpenText
Gupta Team Developer, the GUPTA Web Extensions (CWE), SQLBase 12.2, and the Island sample
database.
The tutorial application is mostly self-explanatory. You select a company (select a Company ID number and
click GO), create an order for the company (click Place Order), fill out the order form, submit the order (click
Submit Order), and review the completed invoice. From the first dialog box you can also list all of the invoices
for a particular company (select a company ID, click GO, and click List Orders).
68
The following diagram illustrates the basic structure of the tutorial COM application, showing the
relationships between push buttons, windows, combo boxes, fields, COM objects, and the database (not all
relationships are shown):
69
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.
70
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 is
added to the Interface. These functions 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 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.
The Remove, Add, and Item functions along with the Count property are added automatically when you
designate that the Interface is a collection.
The following sections describe how to add the following functions to the IISOInfoServer Interface:
• Get CustomerInfo
• Get CompanyIDs
• StopSearch
72
sCity
sState
sZip
sCountry
sContactName
The Add Function dialog box should appear as follows:
The order of these arguments is important. Make sure that the arguments are ordered as shown. Use the
- button and the ¯ button to change the order of the arguments.
6. Click OK on the Add Function dialog box when you are finished.
73
Finish creating the interface
17. In the COM Class Wizard dialog box, click Next.
A summary of the Interface is displayed.
18. Click Finish to build the Interface.
The IISOInfoServer Interface is added to the application.
19. Save this application (the filename and location do not matter). You must 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 created. Note what the COM
Class Wizard adds and does not add for you.
The following sections 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. As a novice COM programmer, it is best to derive each CoClass from a single
Interface, for the sake of simplicity.
75
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.
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)
When to change the GUID or version information of COM components. When there are significant changes
to the functionality of a Type Library, CoClass, event, or Interface, you must be sure to update the associated
GUIDs before using the completed COM server in a production application. By updating the GUIDs, you
prevent COM clients from accessing servers with changed properties. Note that when you change the
properties of a CoClass or Interface, you should change the version information in addition to the GUID.
Updating a GUID. You can update GUIDs in the following ways:
• Right-click the GUID in the application outline and select Regenerate GUID from the pop-up list.
• Select 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 is 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 that can be called from a browser (see “Developing Web Applications”).
76
Using COM Server Functionality from the Client
The following sections outline how to use the functionality provided by the COM server from the COM client
using IslandSALESOrderEntry.app as an example.
Here is a summary of how to implement the functionality of a COM server from a COM client (all of these
steps must be completed in the SQLWindows workspace for the COM client):
1. Start ActiveX Explorer and select a COM server type library.
2. Examine the Interfaces and CoClasses in ActiveX Explorer to determine how you will use the COM server.
3. Use ActiveX Explorer to generate an APL with a hierarchy of COM proxy classes that invokes the methods
of the server. ActiveX Explorer includes this APL in your current application.
4. If you want to handle events from the COM server, edit your application to add new COM proxy classes
that are derived from the CoClasses in the APL.
5. Declare global variables for each of the COM server CoClasses.
6. Using the global variable associated with the CoClass, instantiate the COM object in the client code.
7. You can now invoke Interface functions or retrieve property values from the COM object.
ActiveX Explorer
When you begin to develop a new COM client application, the first thing you must 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) that 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.
Examining the Interfaces and CoClasses. Once a type library is generated, you can examine its Interfaces,
CoClasses, and events using ActiveX Explorer.
Follow these steps:
1. In SQLWindows, open the IslandSALESOrderEntry.app application.
2. Select Tools, ActiveX Explorer.
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.
3. In the ActiveX Explorer Library Selection dialog box, select the IslandSALESInfoSVR 1.0 Type Library and
click OK.
As shown below, the ActiveX Explorer allows you to examine all of the public features of a Type Library, all
of the features you must know in order to invoke the COM server’s objects in your application.
The Classes window pane lists all of the Interfaces, CoClasses, and events available in the Type Library.
Right-clicking in the Classes window opens a pop-up menu that allows you to show or hide the
various COM components in the server and it also allows you to generate an APL source file that
represents the information in the Type Library.
If you select an item in Classes, the item’s member elements are displayed in the Members window
pane. For example, if you select the IISOProductServer Interface, its functions and properties are
displayed.
77
If you select an item from the Members window pane, the GetProductInfo function for example, then
the function’s parameters, returns, attributes, and derivations are displayed in the lower window
pane.
Right-clicking in the lower window pane opens a pop-up menu that allows you to toggle between SAL
syntax and generic COM syntax.
ActiveX Explorer uses the following icons:
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 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.
78
• Adds these classes to a new SAL library (APL).
• Includes this new library along with Automation.apl in your current application’s outline.
If you open Global Declarations, Class Definitions in the outline of IslandSALESOrderEntry.app, you can see
the Functional Classes and COM Proxy Classes associated with IslandSALESInfoSVR 1.0 Type Library.apl (listed
in blue because they are included in the application):
Functional Class: IslandSALESInfoSVR_IISOARPostServer
Functional Class: IslandSALESInfoSVR_IISOInfoServer
Functional Class: IslandSALESInfoSVR_IISOProductServer
Functional Class: IslandSALESInfoSVR_IISOSalesServer
Functional Class: IslandSALESInfoSVR_IISOInvoiceServer
Functional Class: IslandSALESInfoSVR_IISOListLineItems
Functional Class: IslandSALESInfoSVR_IISOListOrders
79
COM proxy classes
In the previous section, you examined the Functional Classes and COM Proxy Classes that are included in the
outline when you generate the Type Library in ActiveX Explorer. You must take an additional step if you want
the client application to be able to handle events from the COM server. You must create subclasses for the
COM Proxy Classes.
To handle COM server events, you must declare each CoClass in the server as a COM Proxy class under Global
Declarations, Classes in the Outline:
COM Proxy Class: ISOInfoServer
Derived From
Class: IslandSALESInfoSVR_ISOInfoServer
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.
80
Declare global variables for each of the IslandSALESInfoSVR CoClasses
Having created COM Proxy Classes to handle events, the next step is to declare the following variables for
each COM Proxy Class under Global Declarations, Variables:
ISOInfoServer: comIslandINFO
!
ISOProductServer: comIslandPRODUCT
!
ISOARPostServer: comIslandARPOST
!
ISOSalesServer: comIslandSALES
!
ISOInvoiceServer: comIslandINVOICE
!
ISOListOrders: IslandORDERS
!
ISOListLineItems: IslandINVOICEITEMS
Once declared, you can use comIslandINFO, comIslandPRODUCT, comIslandARPOST, comIslandSALES,
comIslandINVOICE, IslandORDERS, and IslandINVOICEITEMS to call functions in an interface or retrieve
property values. The next section illustrates how this is done in IslandSALESOrderEntry.app.
81
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 )
À This line of code calls the function GetCustomerInfo in the IISOInfoServer Interface and obtains the
company contact information from the database.
The first argument in this function call, nCompanyIDSelected, is defined as a SetProperty (the Company ID is
passed to the server). The remaining arguments are defined as GetProperties (the Company information
associated by the Company ID is passed back to the client).
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
82
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. 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.
83
developer of a client application can understand and invoke the functionality of this server based on the
information in the type library.
6. Register the server.
Select Project > Register Server. SQLWindows registers the COM server in the Windows registry. All of the
COM component in the server are registered: Interfaces, CoClasses, functions, and events.
A dialog is displayed indicating that the registration was successful.
Note: If you previously registered the server, un-register the server before attempting to re-register it. Make
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 the components you want 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.
84
Troubleshooting
This section describes a problem you might encounter when running the tutorial COM application, along with
what you can do to remedy it.
Exercises
The following exercises can help give you a better sense of how COM applications are structured and can
show you how to get COM applications to function properly using SQLWindows:
• In IslandSALESOrderEntry.app, there is a function called ValidOrder defined under cIslandSalesForm:
frmPLACEORDER.
Exercise: Remove the ValidOrder function from the client, add it to the COM server, and then call the
function from the client to perform the original task. You must regenerate the COM server Type Library,
reregister the server, and generate a new proxy class using ActiveX Explorer.
• To limit the complexity of the tutorial COM application, all of the Interfaces were located in the same
COM server. For a real-world application, you might not structure the application in this manner.
Exercise: Separate each Interface and associated CoClass into its own COM server and then rework the
COM client to invoke the COM objects from the separated COM servers.
• The ISLAND database includes multiple sales contacts for each company. However, the tutorial application
does not allow you to pick which contact to place an order with.
Exercise: Add the functionality needed to allow a user to list and select which sales contact to place an
order with based on the Company ID.
• A common need for most businesses is the ability to keep track of inventory.
Exercise: Create a new COM client application for monitoring product inventory levels in the ISLAND
database. Include a function that allows you to add/order inventory when you are running low.
85
Chapter 5 – Using Team Developer and
COM+
COM allows you to separate the business logic of an application from the application interface. The business
logic is moved to COM objects running in COM servers. This application architecture makes it possible to
allow large numbers of client applications to access a single centralized COM server remotely. COM+ helps to
make centralized COM servers work more efficiently and effectively.
For TD developed COM servers, COM+ acts as a communications broker between COM objects. It handles
requests from remote COM clients to the COM objects it manages, along with requests between COM
objects. COM+ can also handle transactions for COM clients created in environments such as ASP.
Microsoft created COM+ (formerly Microsoft Transaction Server or MTS) in an attempt to simplify the
development of large distributed applications. It is part of a category of programs known as middleware,
multi-tier, or N-tier applications.
This chapter is divided into the following sections:
• Running the tutorial COM server in COM+
• Converting the COM tutorial application to use COM+
• Creating an ASP client for a COM server
Note: To run the COM+ tutorial application, you must be running Gupta Team Developer on Windows
8.1/10, Windows Server 2012 R2 or later systems must have the Microsoft Transaction Server Option
Pack 4 installed.
Note: The provided samples still retain the “MTS” acronym for purposes of backward compatibility with
earlier versions of Team Developer. MTS is the old acronym (from Windows NT and Microsoft
Transaction Server) for what is now COM+ in more recent versions of Windows.
As with the standard COM server, the COM+-enabled COM server is automatically registered when it is
installed from the TD installation CD. In order to use the COM+-enabled server from within COM+, you only
need to install the server as an application in COM+.
86
Installing the Tutorial COM+ Server in COM+
The steps that follow show how to install the tutorial COM+ server as an application in COM+. For detailed
instructions on how to use COM+ , consult the Microsoft documentation.
Note: These steps describe the menus as they are specified in Windows 2000. The Windows NT menus are
somewhat different. Those menus can be found in Appendix A.
87
The COM+ Server objects are displayed in the right window pane.
Now that you have installed the COM+ server components in COM+, COM+ can act as a broker for the objects
when called by the COM+ 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/COM+ server, you should delete the old COM+ server package and then
reinstall the revised COM server in a new COM+ server package.
88
4. Close IslandSALESInfoSVRMTS.app in SQLWindows.
5. Navigate to \GUPTA\AXLibs using Windows Explorer and delete IslandSALESInfoSVRMTS 1.0 Type
Library.apl.
6. Open IslandSALESInfoSVR.app in SQLWindows.
7. Unregister IslandSALESInfoSVR.dll by selecting Project, Un-Register Server.
8. Save IslandSALESInfoSVR.app as IslandSALESInfoSVRMTS.app overwriting the existing file in the
\Tutorial directory.
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
89
ISOListOrdersMTS Derived from IISOListOrders
ISOListLineItemsMTS Derived from IISOListLineItems
In the Outline under Global Declarations, Classes, you should now have seven 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.
5. There are a number of references in the application to the original COM CoClasses. These references
must be changed to the new COM+ CoClasses.
Search for each instance of the original CoClass names and replace them with the new names:
Rename from:
ISOSalesServer
ISOInfoServer
ISOProductServer
ISOARPostServer
ISOInvoiceServer
ISOListOrders
90
ISOListLineItems
Rename to:
ISOSalesServerMTS
ISOInfoServerMTS
ISOProductServerMTS
ISOARPostServerMTS
ISOInvoiceServerMTS
ISOListOrdersMTS
ISOListLineItemsMTS
You can use the Edit, Replace dialog box to complete this process quickly.
6. When you finish copying the events from the old CoClasses to the new COM+ 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 following graphic shows how your application window should appear once you complete the
preceding steps.
91
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. To ensure that all of these connections are free,
reboot the system.
You have now changed the tutorial COM Server so that it can function from within an COM+ Server. In the
next section, you change the tutorial COM client application so that it can use the COM+ Server.
92
Modifying the Client to Use the Server
To modify the COM tutorial application to work with the COM+ server, follow these steps:
1. Open IslandSALESOrderEntry.app from the Tutorial directory.
2. Save the file as IslandSALESOrderEntryMTS.app, overwriting the existing file in the Tutorial directory.
3. In the Outline under Libraries, comment out IslandSALESInfoSVR 1.0 Type Library.
4. Select Tools, ActiveX Explorer. The ActiveX Explorer Library Selection dialog box opens.
5. Click Browse, select the IslandSALESInfoSVRMTS.tlb file located in the Tutorial directory, and click Open.
6. A message box is displayed asking whether you would like to register the Type Library. Click Yes.
7. If the Interfaces are not displayed, right-click in the Classes window pane and select Show Interfaces
from the pop-up menu.
8. Right-click in the Classes window pane and select Check All Shown from the pop-up menu.
9. Right-click in the Classes window pane and select Generate Full from the pop- up menu.
10. Close the ActiveX Explorer.
11. Open the main TD window and select the Outline view. Open Global Declarations, Class Definitions in
the IslandSALESOrderEntryMTS.app application, and rename the following COM Proxy Classes:
Rename from:
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
Rename 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
12. Because you have now included the new Type Library, you must change some of the references in the
preceding COM Proxy Classes. These COM Proxy Classes make it possible to handle events generated by
93
the Interfaces on the COM+ server. Each is derived from the COM Proxy Class 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.
Change from:
Class: IslandSALESInfoSVR_ISOInfoServer
Change to:
Class: IslandSALESInfoSVRMTS_ISOInfoServerMTS
Make the same change to the references of each of the other COM Proxy Classes.
13. Open Global Declarations, Variables and change the names of the references for the variables.
Change from:
ISOInfoServer: comIslandINFO
!
ISOProductServer: comIslandPRODUCT
!
ISOARPostServer: comIslandARPOST
!
ISOSalesServer: comIslandSALES
!
ISOInvoiceServer: comIslandINVOICE
!
ISOListOrders: IslandORDERS
!
ISOListLineItems: IslandINVOICEITEMS
Change to:
ISOInfoServerMTS: comIslandINFO
!
ISOProductServerMTS: comIslandPRODUCT
!
ISOARPostServerMTS: comIslandARPOST
!
ISOSalesServerMTS: comIslandSALES
!
ISOInvoiceServerMTS: comIslandINVOICE
!
ISOListOrdersMTS: IslandORDERS
!
ISOListLineItemsMTS: IslandINVOICEITEMS
14. Select Project, Build Setting.
15. Change the Target Name to IslandSALESOrderEntryMTS.exe and click OK.
16. Save and then build the application. A message box is displayed stating that the build was successful.
17. Confirm that the COM+enabled COM server and client work correctly by selecting 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 COM+ Server. The next step is
to install the COM+ Server in the COM+ environment as a new COM+ server application. For more
information, see “Installing the Tutorial COM+ Server in COM+”. The next section provides some information
on how to create an ASP-based COM client that can use the COM+ Server.
94
Creating an ASP Client for a COM Server
COM servers can be used by any client that conforms to the COM specification, regardless of the
programming language it was developed in. Included with the COM tutorial files is a set of ASP pages that
replicate much of the functionality of IslandSALESOrderEntry.exe. These samples demonstrate how to use the
functionality provided by a TD-developed COM server from an ASP page.
When installed by the TD installation CD, the ASP pages are copied to \wwwroot\GUPTA\Tutorial if the install
machine has an Internet Server. If the install machine does not have an Internet Server, the files are installed
to \GUPTA\Tutorial\ASP.
System Requirements
The machine running the COM server must meet the following system requirements:
• Microsoft Windows NT 4.0, 2000, or XP
If you are running Windows NT 4.0, you must install Windows NT 4.0 Option Pack 4.
• Web Server that can handle ASP pages; for example, Microsoft Internet Information Server
• Installation of TD that includes the COM tutorial sample applications
The machine running the ASP client must meet the following system requirements:
• Microsoft Internet Explorer 5.01 or higher
• 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.
95
The default web page (default.htm) for the ASP tutorial pages is displayed and provides you with three
options:
• Ping Server – Testparameters COM Server
Clicking this hyperlink takes you to an ASP page that attempts to connect to the COM server on the TD
machine. This ASP page is designed to test whether a COM server on the TD machine is accessible or not.
The ASP page indicates whether it is successful or not.
• Ping Database – IslandSALESInfoSVR with COM+
Clicking this hyperlink takes you to an ASP page that attempts to retrieve data from the ISLAND sample
database using the COM server through COM+. 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 are provided with TD replicate some of the functionality of the Windows/ CWD version.
96
This ASP page replicates the opening screen of the IslandSALESOrderEntry.exe client application. It allows
you to select a company, list contact information on that company, and then either to list the invoices
currently associated with that company or to create a new invoice.
• PingDatabase.asp
Tests whether you can access data in the ISLAND database through the IslandSALESInfoSVR.dll COM
server in the COM+ environment. Also makes calls to GetCustomerInfo.asp.
• PingServer.asp
This ASP page tests whether you can access a COM object on your TD machine from your web browser.
'response.write "Invoking MTS SAL COM Server from the ASP SalesInfo page!<br>"
set objSalesServer = Server.CreateObject("IslandSALESInfoSVRMTS.ISOInfoServerMTS.1")
! If the server fails to create, then execution will stop on the preceding line
'response.write "Created ISLAND Sales Order Information Server
- With MTS<br>"
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: Because 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, and so on.
97
Chapter 6 – Managing Teams and Objects
This chapter discusses team programming. Team programming helps you manage projects with many
programmers, including sharing code and standardizing programs.
This chapter explains how to bring the application (from the \Samples directory) into the Team Object
Repository, and how a programmer manages code through check-in and check-out and other version control
features. This is accomplished with Team Object Manager, the team programming component.
Requirements
Team Object Manager must be installed on your machine. For instructions, see the Gupta Team Developer
Setup.
The Team Object Repository must be installed. From the Start menu on your machine, select GUPTA\Team
Developer\Setup Repository Wizard. The Wizard helps you specify configuration information and install the
TEAMOBJM repository. For the following tutorial, specify QuickInstall, specify TEAMOBJM as your repository,
and then accept the defaults to install the repository.
98
Create a Project
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 might tell you that you are missing the #STARTER project. If so, follow the
defaults in the dialogs that appear to include the #STARTER project.
99
1. Right mouse click on the Starter Project icon. The project context menu appears.
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. The initial dialog in the Project Wizard appears.
3. 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 and click Next.
5. Type the project identity into the Code field. 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 and click Next.
100
6. In the screen that appears, accept the default in the Project Directory field and click Next.
7. Click Finish.
101
A dialog box appears to let you know the project was successfully created.
8. Click OK.
102
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 \GUPTA 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 the qckfinal.app item in the left pane (that was just adde to the project).
The Team Object Manager desktop looks similar to the following:
103
Checking Out a File from the Repository
To check out the qckfinal.app from the Repository to your local workstation, follow these steps:
1. Click the qckfinal.app item. Eight tabs are displayed in the view window.
2. Right-click the qckfinal.app icon to bring up the context menu. Select the Scan, Scan for Dependencies
option. This links the application file with the bitmaps you included in the project.
A warning box is displayed to let you know that the application file requires other files to be included in
the project which are not present.
3. Click Close.
104
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. Select the Check Out... option. This brings up the Check out file dialog.
6. 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.
Diff/Merge Tool
Diff/Merge compares two SQLWindows files and reports on the differences. To use this tool, follow these
steps.
106
5. Select the Island Outfitter Background text object and move it to the left.
6. Save your changes in a new file called QCK2.APP by opening the File menu and selecting the Save As
option.
7. Close SQLWindows and return to Team Object Manager.
107
2. Start a new file comparison by clicking the button in the tool bar.
3. Specify the names of the two files to be compared, qckfinal.app and qck2.app.
108
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.
109
Note: Because you saved your changes to another file, a warning appears to let you know that the file was
not modified and asksif you would like to unlock the file. Click No.
3. Type an explanatory comment into the Notes field and click OK.
The file is checked in and now there are two revisions of the file. The earlier one is stored as a delta file for
space efficiency.
The four objects below the .app file represent the types of objects the application contains.
2. Open the Classes and Windows objects by clicking + to see what objects are present.
3. Click 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.
110
Team Object Manager Team Roles are fully configurable, offering maximum flexibility when structuring your
projects.
Team Object Manager provides an intuitive, project-oriented user interface that makes it possible for you to
check files in and out of the Team Object Repository. It has other powerful features that are fully detailed in
the Managing Teams and Objects with GUPTA manual supplied with the GUPTA Bookcase or found in the
online book collection.
111
Chapter 7 – More Information
Team Developer is a full-featured, robust development environment. To help you learn about and use all the
components, the entire documentation suite is available on your CD in the online book collection. To view the
books, select GUPTA Books Online from the GUPTA program group.
Application Development
Book Contents
New Features in Team Developer Features that are new to this version of Team Developer
Developing with SQLWindows Description and examples of how to use the interface features
Building Web Applications with GUPTA How to write, deploy, and manage Web applications
Extending the GUPTA Development Discovering the SAL and C++ functions in the CDK that help you
Environment extend your applications
Connecting Gupta Objects to Databases How to use Gupta’s routers to connect to non-Gupta databases
Business Reporting How to create reports from GUPTA SQLWindows using the
Report Builder component
Using and Extending QuickObjects How to create complex and sophisticated applications using
QuickObjects
Managing Teams and Objects with GUPTA Understanding conceptual information and how to use Team
Team Developer Object Manager, the multi- programmer developer tool
Localizing and Customizing GUPTA How to translate applications into other languages
Applications
112
SQLBase
Book Contents
SQLBase Guide to New Features Descriptions of features that are new to this particular version
of 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 access a SQL
Reference database
SQLBase SQL Language Reference Entering SQL commands in a Windows environment and
performing database management functions
SQLBase SQLTalk Command Reference SQLTalk commands
Connecting to SQLBase Using SQLBase drivers and data providers to connect any client
application in any language to SQLBase
SQLConsole Guide Using SQLConsole to simplify database administration, manage
database objects, monitor performance, and automate
database maintenance
SQLBase Advanced Topics Guide SQLBase advanced topics, including database design, SQLBase
internals, and SQLBase query optimizer
Connectivity
Book Contents
Connecting GUPTA Objects to Databases Connecting your GUPTA applications to one or more relational
databases, such as Oracle, Microsoft SQL Server, System 11.x,
Informix, and others
Connecting to SQLBase Using SQLBase drivers and providers for JDBC, ODBC, OLE DB,
and .NET, with any compatible application development tool
SQLHost Installation and Operation Guide Installing and configuring SQLHost software on a workstation
and a SQLGateway machine
SQLHost Application Services Developer’s Using SQLHost/Application Services (SQLHost/AS) to create
Guide server applications
SQLHost Client Developer’s Guide Designing and developing client applications for SQLHost
113
Appendix – Installing the Tutorial COM/MTS
Server in MTS
You can install the tutorial COM/MTS server as a package in MTS and Windows NT. For detailed instructions
on how to use MTS, consult the Microsoft documentation.
The following steps describe the menus as they are specified in Windows NT. The Windows 2000 menus are
somewhat different, and are described in chapter 5.
To install the COM/MTS server as a package in MTS, follow these steps:
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.
Expand the MTS tree: Microsoft Transaction Server, Computers, My Computer, Packages Installed.
Select Packages Installed.
Right-click and select New, Package.
In the Package Wizard, click Create an Empty Package, name it IslandMTS, and click Next.
3. Use the default settings in the Set Package Identity dialog box and click Finish.
Expand the new MTS Island package in the tree view.
Select Components.
Right-click and select New, Component. The Component Wizard is displayed.
4. Click Import components that are already registered.
5. Select the following components:
IslandSALESInfoSVRMTS.ISOARPostServerMTS
IslandSALESInfoSVRMTS.ISOInfoServerMTS
IslandSALESInfoSVRMTS.ISOProductServerMTS
IslandSALESInfoSVRMTS.ISOSalesServerMTS
IslandSALESInfoSVRMTS.ISOInvoiceServerMTS
IslandSALESInfoSVRMTS.ISOListOrdersMTS
IslandSALESInfoSVRMTS.ISOListLineItemsMTS
By checking the Details checkbox, you can confirm that the components you select are coming from the
correct DLL. The default is \GUPTA\Tutorial\IslandSALESInfoSVRMTS.DLL.
6. Click Finish.
114
The MTS Server objects are displayed in the right window pane.
Now that the COM/MTS server components are installed in MTS, MTS can act as a broker for the objects
when called by the COM/MTS client application.
7. Open IslandSALESOrderEntryMTS.app and run the application in debug mode (or launch
IslandSALESOrderEntryMTS.exe).
If the Microsoft Management Console is open while the client is running, the ball graphic spins for each
object that is currently being used by the client.
Each time you revise an COM/MTS server, you should delete the old MTS server package and reinstall the
revised COM server in a new MTS server package.
115