Quick Start Dexterity
Quick Start Dexterity
Quick Start
Release 12
Copyright Copyright © 2014 Microsoft Corporation. All rights reserved.
Limitation of liability This document is provided “as-is”. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using
it.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
Intellectual property This document does not provide you with any legal rights to any intellectual property in any
Microsoft product.
You may copy and use this document for your internal, reference purposes.
Trademarks Microsoft, Dexterity, Microsoft Dynamics, Visual Basic and Windows are trademarks of the
Microsoft group of companies. FairCom and c-tree Plus are trademarks of FairCom Corporation and
are registered in the United States and other countries.
Warranty disclaimer Microsoft Corporation disclaims any warranty regarding the sample code contained in this
documentation, including the warranties of merchantability and fitness for a particular purpose.
License agreement Use of this product is covered by a license agreement provided with the software product. If you
have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at
800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.
QUICK START i
C O N T E N T S
ii Q U I C K S T A R T
INTRODUCTION
Introduction
Welcome to Microsoft® Dexterity, a powerful application development
system. Designed to create Microsoft Dynamics™ GP, Dexterity is ideal for
creating transaction-based business applications, such as accounting and
business management products. If you use Dexterity to create applications
that integrate with other products like Microsoft Dynamics GP, Dexterity
allows you to add to the power of the core applications with solutions fitted
to the needs of your customers.
Before you put Dexterity to work for you, take a few moments to review the
information presented here. It explains the organization of this manual and
provides you with information about the rest of the Dexterity
documentation.
• Part 2, Lessons, shows you how to use Dexterity to create the Inventory
application, and explains the portions of the Dexterity interface that
you’ll encounter while creating the application.
Finding information
We’ve provided a number of tools to help you understand Dexterity and
locate information about the development environment. These tools
include sample applications, online help files, manuals designed to address
specific needs, and a comprehensive index to help you find information
anywhere in the Dexterity documentation.
2 Q U I C K S T A R T
I N T R O D U C T IO N
Manual organization
The Dexterity documentation is divided into several manuals. An overview
of the manuals is shown in the following illustration:
Quick
Start
Dexterity Function
SanScript Dexterity
Programmer’s Library
Reference Utilities
Guide Reference
Comprehensive
Index
Start with the Quick Start manual. Once you’ve become familiar with the
Dexterity development environment, you’ll use the Dexterity
Programmer’s Guide, SanScript Reference, Function Library Reference and
Dexterity Utilities manuals. If you’re creating a stand-alone application,
refer to the Stand-alone Application Guide; if you’re creating an application
that integrates with Microsoft Dynamics GP, refer to the Integration Guide.
A brief description of each manual follows.
QUICK START 3
I N T R O D U C T I O N
Prerequisites
Although the information in the Dexterity manuals will help you use the
Dexterity system, an understanding of basic programming concepts and
database design is also important.
4 Q U I C K S T A R T
I N T R O D U C T IO N
Symbol Description
➥ of table Items; A continuation character indicates that a script
continued from one line to the next should be
typed as one line in the Script Editor.
The light bulb symbol indicates helpful tips,
shortcuts and suggestions.
Convention Description
Part 2, Lessons Bold type indicates a part name.
Chapter 6, “Creating Quotation marks indicate a chapter name.
Fields”
Applying formats Italicized type indicates a section name.
set 'l_Item' to 1; This font is used to indicate script examples.
RUNTIME.EXE Words in uppercase indicate a file name.
Software Development Acronyms are spelled out the first time they’re
Kit (SDK) used.
TAB or ALT+M Small capital letters indicate a key or a key
sequence.
QUICK START 5
I N T R O D U C T I O N
Product support
Dexterity technical support can be accessed using the following methods.
6 Q U I C K S T A R T
PART 1: TOUR OF THE SAMPLE APPLICATION
Part 1: Tour of the Sample
Application
Use this portion of the manual to become familiar with the Inventory
sample application. The information is divided into the following chapters:
Once you’ve become familiar with the Inventory application’s design and
usage, continue to Part 2, Lessons, to learn how to create the Inventory
application.
8 Q U I C K S T A R T
Chapter 1: Overview of the Sample
Application
Use this chapter to become familiar with the Inventory sample application.
To install this and other sample applications, be sure the Sample
Applications component is selected when you install Dexterity.
1. Launch Dexterity.
Double-click the Dexterity icon. Dexterity will open and a dialog box
will appear, as shown in the following illustration.
QUICK START 9
PA RT 1 T O U R O F T HE S AM P L E AP P LI C AT I O N
10 Q U I C K S T A R T
C H A P T E R 1 O V E R V IE W O F TH E S A M P LE A P PL IC A T IO N
In the next chapter you’ll learn to use the sample Inventory application.
Before continuing, be sure you are in Dexterity tools mode.
QUICK START 11
12 Q U I C K S T A R T
Chapter 2: Working with the Sample
Application
Use the information in this chapter to become familiar with the sample
Inventory application. Once you are familiar with the application, you’ll be
ready to re-create the application using Dexterity.
If you create applications that integrate with the another product, you don’t
need to create a main menu form. Forms and windows in your application will
use the main menu form from the main application.
QUICK START 13
PA RT 1 T O U R O F T HE S AM P L E AP P LI C AT I O N
The following illustration shows how the main menu window from the
sample application dictionary will appear.
Dexterity automatically
draws native window
elements.
Prompts accompany
each field to describe the
field’s contents.
14 Q U I C K S T A R T
C H A P T E R 2 W O R K I N G W IT H T H E S A M P L E A P P L I C A T I O N
When all the information is entered in the window, click Save. The Save
button stores the information displayed in the window as a separate
record in the Inventory Data table. The Delete button will remove a
record from the table. The Clear button will clear the contents of the
window without affecting the table or existing records.
QUICK START 15
PA RT 1 T O U R O F T HE S AM P L E AP P LI C AT I O N
Note that the selling price changes from $7.80 to $7.15. The original
selling price was set at the cost plus 20%, so lowering the percentage
lowered the selling price. The window should look like the following
illustration.
Click Save. The changes you made to this item will be saved and the
record will be updated in the Inventory Data table.
16 Q U I C K S T A R T
C H A P T E R 2 W O R K I N G W IT H T H E S A M P L E A P P L I C A T I O N
The Screen Output window will appear. After a few moments, the
report will appear on your screen and should look like the following:
To close the Screen Output window, click the window close box.
A warning dialog box will appear to verify that you wish to delete the
selected record. The warning dialog box will look similar to the
following illustration.
Click Delete to delete the record. The Inventory Maintenance window will
reappear. When you’ve finished exploring the sample Inventory
application, quit Dexterity by choosing Exit from the File menu.
QUICK START 17
PA RT 1 T O U R O F T HE S AM P L E AP P LI C AT I O N
What to do next
Continue to Part 2, Lessons, to create the Inventory application dictionary
step by step. As you review the rest of the information in this manual, use
the completed sample application dictionary to help you understand new
concepts associated with developing your own applications using
Dexterity.
While you are working with the lessons in this manual, use the information
in the Volumes 1 and 2 of the Dexterity Programmer’s Guide, as well as the
SanScript Reference manual to learn more about the resources used to
create the sample application.
18 Q U I C K S T A R T
PART 2: LESSONS
Part 2: Lessons
This part of the manual walks you through creating the sample Inventory
application. Each chapter contains a detailed, step-by-step lesson you can
refer to when creating your own applications.
Each lesson builds upon the previous one as you create the Inventory
application from the bottom to top, starting with data types and moving on
to formats, fields, tables, forms and windows. Therefore, it’s important that
you go through the lessons in the order they are presented.
• Chapter 7, “Creating Tables,” explains how to create the table and key
used in the Inventory application.
• Chapter 8, “Creating Forms,” explains what forms are and how to cre-
ate and use them in an application.
20 Q U I C K S T A R T
Chapter 3: Creating Dictionaries
An application dictionary (a file with the extension .DIC) is the main file that
stores all the unique attributes of your application. When you use Dexterity
to create new windows, tables, reports and fields, you are creating
resources that are stored in the application dictionary.
QUICK START 21
PA RT 2 L E S S O N S
Double-click the Dexterity icon to launch Dexterity. Dexterity will open and
the dialog box used to open existing dictionaries or create new dictionaries
will appear.
In this dialog box, mark the option to create a new dictionary that contains a
Main Menu form. Click the lookup button next to the Dictionary Name
field to open a file dialog. This dialog box includes a field in which you can
enter the name of the new dictionary.
22 Q U I C K S T A R T
C H A P T E R 3 C R E A T I N G D I C T I O N A R I E S
Be sure to place this dictionary in a folder other than the one containing the sample
Inventory application you installed with Dexterity.
Enter INVENT.DIC as the name for this dictionary, and click Save. The
name and location of the new dictionary will appear in the Dictionary
Name field. Click OK. The application dictionary will be created at the
location you specified in the dialog box. Once the Dexterity toolbar and
Resource Explorer window appear, you’ll be ready to begin creating
resources for the application.
What to do next
You’ve just created the dictionary that will store all the resources for the
Inventory application. At this point, the Dexterity tool bar should be
showing and the dictionary name, INVENT.DIC, should be displayed in the
window title bar.
This is the window that each of the following lessons assumes you are starting
from. Each lesson will also return you to this position.
Continue on to the next chapter where you’ll begin creating resources for
the Inventory application, starting with data types.
QUICK START 23
24 Q U I C K S T A R T
Chapter 4: Creating Data Types
The initial step in creating applications with Dexterity is to build a
database. You start with the data types your application will use.
Data types define a Data types specify the characteristics of fields in your application. Without
field’s ability to store, a data type, a field doesn’t have the ability to store, control or display
control or display information. In this respect, most of a field’s functionality is based on the
information. data type it uses, including the field’s data storage capabilities in a table
and its display characteristics when added to a window.
You’ll need to create a total of seven data types for the Inventory
application. First, you’ll need four data types for the four different kinds of
data stored by the Inventory application (part numbers, item descriptions,
prices and a supply status). You’ll also need to create data types for the
three push buttons (Save, Clear and Delete).
QUICK START 25
PA RT 2 L E S S O N S
After starting Dexterity and opening the Inventory dictionary, be sure the
Resource Explorer window is displayed. If it isn’t, click the Open Resource
Explorer button on the Dexterity toolbar to open it.
The left pane in the Resource Explorer lists the various types of resources
that can be part of a dictionary. Several types of resources are combined into
a category called “Base”. Data types are in the base category. Select the Base
category in the left pane of the Resource Explorer. Click the plus sign to
expand the Base group. Notice that the third item displayed is Data Types.
Select the Data Types item. The right pane of the Resource Explorer will
display any data types that have been created for the dictionary. Since no
data types have been created yet, the list will be empty.
To create a new data type, click the New button in the Resource Explorer
toolbar. The Data Type Definition window will appear.
26 Q U I C K S T A R T
C H A P T E R 4 C R EA T IN G DA TA T Y P E S
You are now ready to enter the data types for the fields that will be used to
store data. To create the data type to be used by the Part Number field,
follow these steps:
3. Enter 5 in the Keyable Length field. When you enter the keyable length
and press TAB to leave the field, the Storage Size field will be filled in
automatically.
When you’ve entered this information, the Data Type Definition window
should look like the following illustration.
The name used for this data type, Part_Number_String5, readily identifies
this as the data type to be used for the Part Number field we’ll create in
Chapter 6. It also clearly identifies the control type and keyable length of
the data type.
By selecting String as the control type, you’ve specified the function of the
data type and how it will store and display data. By specifying 5 as the
keyable length, you limited the number of characters a user can type in a
field using this data type. Once you did that, Dexterity automatically
assigned the number of bytes needed to store fields using the data type.
QUICK START 27
PA RT 2 L E S S O N S
The control type is the defining characteristic of a data type. Dexterity has
over 20 control types; the most common are listed in the following table.
28 Q U I C K S T A R T
C H A P T E R 4 C R EA T IN G DA TA T Y P E S
Using the same procedure, create the data type for the Description field. For
this data type, enter the following information:
Create the data type for For the data type for the Cost and Selling Price fields, enter the following:
the Cost and Selling
Price fields. Data Type Name Currency7
Control Type Currency
Keyable Length 10
The currency field will allow users to enter values up to 7 digits in length,
such as $99,999.99. However, to create a currency field that allows 7 digits to
be entered, you must set the keyable length to 10. This is because Dexterity
always reserves five digits to the right of the decimal separator for currency
amounts even if the last three digits won’t be displayed. To have seven
usable digits, three extra digits are needed for a total of ten. When you’ve
finished entering the data, click Add.
Create the data type for Next, create the data type for the Status field. Enter the following without
the Status field. clicking Add:
Enter the static values Since this data type is a list box, it needs static text values for the items the
for the data type. user will be able to select. Be sure that Text appears in the Static Values field.
If it doesn’t, select Text from the Static Values drop-down list. Then click the
Static Values lookup button to display the Static Text Values window. Enter
the following items one at a time in the New Value field, clicking Insert after
you type each item.
In Stock
On Order
Back-ordered
QUICK START 29
PA RT 2 L E S S O N S
When you’ve finished, the Static Text Values window should look like the
following illustration.
Click OK to save the static values, then click Add in the Data Type
Definition window.
Create the data type for Now you’ll create the data types for the three push buttons. For the Save
the Save button. button, make the following entries in the Data Type Definition window
without clicking Add:
Enter the static value To enter Save as the static text value that appears on the push button, be
for the data type. sure that Text - Picture appears in the Static Values field, then click the Static
Values lookup button to open the Static Text Values window. In the Button
Items window, type Save in the field for Up caption.
30 Q U I C K S T A R T
C H A P T E R 4 C R EA T IN G DA TA T Y P E S
Click OK to close the Button Items window and save the value. The Data
Type Definition window will be displayed, as shown in the following
illustration.
Create the data type for Using the same procedure, create the Push_Button_Clear and
the Clear button. Push_Button_Delete data types. For the Push_Button_Clear data type, enter
the following information:
QUICK START 31
PA RT 2 L E S S O N S
Create the data type for For the Push_Button_Delete data type enter the following information and
the Delete button. click OK to save the data type:
When you’ve finished creating the data types, the Resource Explorer will
list all of the new data types and appear as shown in the following
illustration.
In this chapter you’ve learned how to create the data types needed for the
Inventory application, including how to add static text to push button and
list box fields.
32 Q U I C K S T A R T
Chapter 5: Creating Formats
Formats are the extra characters, spacing and attributes that can be applied
to a data type to format data when it is entered or displayed. Formats are
stored as separate resources, but are applied to data types to define how
information is displayed at runtime.
Refer to Chapter 7, A single format resource can be used by several data types. Perhaps the
“Formats,” in Volume easiest way to understand formats and how they’re used is to view them as
1 of the Dexterity Pro- data “masks” that simply change the look of the information in a field
grammer’s Guide for without changing the actual information stored in the field. For example, a
more information string data type for a phone number can have a format applied to it so a
about formats. field using the data type will display (555) 123-4567, instead of 5551234567,
which is stored in the phone number field in a table.
Formats can be used for currency, string, numeric and composite data
types. If the format is for use with a string or composite data type, it can
also have a format string. Depending upon the format type, different
formatting options are available. The Format Definition window, shown in
the following illustration, is used to set the characteristics of a format.
QUICK START 33
PA RT 2 L E S S O N S
Select the Part_Number_String5 data type in the right pane of the Resource
Explorer and click the Open button in the Resource Explorer toolbar. The
Data Type Definition window will appear.
Create the format for Click the Format lookup button to open the Format Lookup window. The
the Part_Number_ lookup button is located to the right of the Format field. Click New to create
String5 data type. a new format; the Format Definition window will appear. Enter the
following information:
The capital Xs are used as place holders in the format string. They designate
positions in which data will appear. Any other characters specified in the
format string, such as the dash between the second and third X, will appear
as part of the format applied to the data.
34 Q U I C K S T A R T
C H A P T E R 5 C R E AT IN G FO R M AT S
Click Insert; the window will look like the following illustration.
Click OK to save the new format. Its name will appear in the format field of
the Data Type Definition window as shown in this illustration.
Create the format for Now you’ll create and apply a format to the Currency7 data type. Open the
the Currency7 data Currency7 data type by selecting it in the Resource Explorer and clicking
type. Open in the toolbar. Click the Format lookup button to open the Format
Lookup window, and click New to create a new format. In the Format
Definition window, enter the following information:
QUICK START 35
PA RT 2 L E S S O N S
The Fill option allows you to specify whether a space, zero or asterisk will
be displayed in unused positions to the left of the decimal separator.
Regardless of what is specified here, unused positions to the right of the
decimal separator will be displayed as zeros. For example, a currency field
that displays 7 digits, displays 2 decimal digits and uses an asterisk as the
fill character will be displayed as ***12.00 when the field has the value 12.
When you’ve finished, the window should look like the following:
Click OK to save the format definition. The format name will appear in the
Format field in the Data Type Definition window. Click OK to save the
changes to the data type.
In this chapter you’ve learned about adding formats to data types, and
you’ve created formats for the Part_Number_String5 and Currency7 data
types you created in the previous chapter.
36 Q U I C K S T A R T
Chapter 6: Creating Fields
For more information This chapter will show you how to create fields for the sample Inventory
about each type of application. Fields you create using Dexterity represent individual pieces of
field, refer to Chapter information that can be used by your application dictionary. Dexterity
8, “Global Fields,” in allows two kinds of fields, global and local.
Volume 1 of the
Dexterity Global fields can appear in any of your application’s windows and can be
Programmer’s Guide. stored in tables. Local fields can only appear in windows that are part of the
form in which they are created.
QUICK START 37
PA RT 2 L E S S O N S
To create the Part Number field, enter the following information in the Field
Definition window:
You’ll use the field name when you refer to the field in scripts. The physical
name is used as the column name in a SQL table.
Notice that when you move to the Physical Name field, it’s automatically filled in
with the value specified as the field name. Notice also that the Array Size field value
defaults to zero, indicating the field is not an array.
Click Add to save the Part Number field definition and leave the Field
Definition window open so you can create another field.
38 Q U I C K S T A R T
C H A P T E R 6 C R E A T IN G F IE LD S
Using the same method, create the Description field. Enter the following
information and click Add:
Enter the following information for the Cost field and click Add:
Enter the following information for the Selling Price field and click Add:
Enter the following information for the Status field and click Add:
Create the push button Now create the fields for the three push buttons. For the Save Button field,
fields. enter the following information and click Add:
Enter the following information for the Clear Button field and click Add:
QUICK START 39
PA RT 2 L E S S O N S
Since the Delete Button is the last field you need to create for the Inventory
application, click OK to save the field definition and close the Field
Definition window.
In this chapter you’ve learned to create fields using the Field Definition
window, and you’ve created the fields you will need for the Inventory
application.
40 Q U I C K S T A R T
Chapter 7: Creating Tables
Understanding how data is stored in tables will help you better visualize
how your application will process and store information.
Fields
QUICK START 41
PA RT 2 L E S S O N S
Table
Each table requires at least one key. A key is a field or combination of fields
within a record that is used to store, retrieve and sort records. Typically, the
value of the key field or fields is unique for each record so a particular
record can be located easily.
A key is like a category you can use to locate a particular item. For instance,
to locate a particular customer in the customer name and address table, you
could search the table alphabetically using the customer name column. In
this case, you’re using the customer name field as the key. However, since
two or more customers could have the same name, a unique field such as
the Customer ID also might be used as a key field.
42 Q U I C K S T A R T
C H A P T E R 7 C R E A TI N G T AB LE S
Fields
Key 1 Customer ID Customer Address State
City
Key 2 Name
Table
This table has five fields: Customer ID, Customer Name, Address, City and
State. It also has four records, each containing one Customer ID, Customer
Name, Address, City and State field. The table has two keys. The first key is
composed of the Customer ID field. Because no two customers can have the
same Customer ID, this key ensures each customer is uniquely identified.
The second key is composed of the Customer Name field. This key allows a
customer record to be easily located, based upon the customer’s name.
QUICK START 43
PA RT 2 L E S S O N S
To create the table for the Inventory application, be sure the Resource
Explorer window is displayed. If it isn’t, click the Open Resource Explorer
button on the Dexterity toolbar to open it. Select the Tables category in the
left pane of the Resource Explorer. The right pane of the Resource Explorer
will display any tables that have been created for the dictionary. Click New
to create a new table; the Table Definition window will appear. Enter the
following information without clicking OK:
You’ll notice that once you enter the table name and move to the next field,
Dexterity enters default values for the Display Name and Physical Name
fields. The display name is the name that will appear when the table is
referred to in the Report Writer and Modifier. The physical name is the
name for the table used by the database. It defaults to an eight-character
name that can be used by any supported database type.
The Series field allows you to categorize and group related tables. For
example, because the Inventory application is a stand-alone application,
you’ve selected 3rd Party as the series. Had this application integrated with
another product such as Microsoft Dynamics GP, you would have chosen
the series used by the module your application integrated with.
44 Q U I C K S T A R T
C H A P T E R 7 C R E A TI N G T AB LE S
Add fields to the table. The Global Fields list displays the fields you created in the previous
chapter. Add the following fields to the table one at a time by selecting each
in the Global Fields list and clicking Insert to place it in the Table Fields list.
Part Number
Description
Cost
Selling Price
Status
When you’ve finished, the Table Definition window should resemble the
following illustration.
QUICK START 45
PA RT 2 L E S S O N S
The data should be sorted by part number, so select the Part Number field
in the Table Fields list and click Insert to place it in the Key Segments list.
No options need to be selected for this key. The Keys window should
resemble the following illustration.
Click OK to save the key and return to the Table Definition window. The
key’s name will appear automatically in the drop-down list in the Keys
section of the window. Click OK to save the table definition. The table’s
name will appear in the Resource Explorer.
In this lesson you’ve learned how to use the Table Definition and Key
Definition windows to define a table and its keys.
46 Q U I C K S T A R T
Chapter 8: Creating Forms
Dexterity allows you to define your application’s interface, through the use
of forms and windows. Understanding how to use forms and windows will
help you design an intuitive, logical interface, allowing users to easily enter,
view and change information.
After you create data types, fields and tables, you can begin setting up your
application interface by first defining the forms, and then the windows
your application will use. Although forms and windows are stored as
separate resources in Dexterity, both work together to give structure to the
tasks you’re designing your application to complete.
Creating windows is A form groups related objects and resources, such as windows, menus,
discussed in the next scripts and tables, that function together for a common purpose. A single
chapter. Form menus form may have several windows that can be displayed and used separately.
are discussed in
Chapter 12, “Creating For example, you could create a form that uses one window to store
Menus.” Form scripts information about customer addresses and another window to store your
are explained in notes about the customer. Together, both windows allow you to maintain
Chapter 10, “Adding customer records. The information entered in the windows is stored in
Scripts.” tables attached to the form. The overall structure of the form is shown in the
following illustration.
Form
Windows
in the form
Table
buffers
QUICK START 47
PA RT 2 L E S S O N S
Applications that integrate with Microsoft Dynamics GP don’t need a Main Menu
form. Integrating applications use the Main Menu form from the main dictionary.
For information on the The window associated with the Main Menu form is usually a standard
types of windows you window or a tool bar window, often containing push buttons or button
can create using drop lists used to open other forms in the application.
Dexterity, refer to
Chapter 9, “Creating Since Dexterity requires a Main Menu form, it automatically adds one to
Windows.” each new dictionary. However, you’ll have to attach your own tables to the
form, and define your own windows, menus, scripts and other objects for
the form. You’ll do this in subsequent chapters.
48 Q U I C K S T A R T
C H A P T E R 8 C R E A TI N G F O R M S
In this lesson you will create a new form and attach the Inventory_Data
table to it.
To create a new form for the Inventory application, be sure the Resource
Explorer window is displayed. If it isn’t, click the Open Resource Explorer
button on the Dexterity toolbar to open it. Select the Forms category in the
left pane of the Resource Explorer. Notice that the Main Menu form is
already listed in the right pane of the Resource Explorer. Click New to
create a new form; the Form Definition window will appear
When you’ve finished, the Form Definition window should resemble the
following illustration.
Attach the Click the Tables tab to bring it to the front. The New button shown in the
Inventory_Data table to previous illustration will be replaced by the Attach button.
the form.
QUICK START 49
PA RT 2 L E S S O N S
Click the Attach button to open the Table Lookup window, shown in the
following illustration. This window lists all tables that have been defined in
the current dictionary.
Select the Inventory_Data table and click OK. The Table Lookup window
will close, and the Inventory_Data table will be listed in the Tables tab of
the Form Definition window.
Verify the table Make sure the Inventory_Data table is selected in the Tables tab of the Form
options. Definition window. The Open, Detach and Options buttons will be enabled.
Click the Options button to open the Table Options window. Set the Open
Options as shown in the following illustration.
When you’ve made any necessary changes, click OK to close the Table
Options window. To save the new form, click OK in the Form Definition
window; the name of the form will appear in the Resource Explorer.
In this chapter you’ve learned how to create a form, attach tables to the
form, and set the options for that table when it’s accessed by the form.
50 Q U I C K S T A R T
Chapter 9: Creating Windows
Dexterity supports four A window is the main method of communication between the user and
kinds of windows: your application. It consists of the visual area displayed on the screen that
standard, modal, can contain editable fields, interactive controls such as push buttons, and
palette and tool bar. static items such as prompts. Dexterity supports several types of windows.
The most common four are: primary, modal dialog, palette and tool bar.
• Primary windows are the most common type of window and appear
with all operating system controls, such as close boxes and minimize
controls.
• Modal dialogs don’t contain any operating system controls and can’t be
resized. These windows can be used when you require the user to com-
plete an action in the window before closing the window.
• Toolbar windows are displayed across the top or down the left side of the
screen, expanding automatically to fit the size of the screen. Only one
tool bar window can be open at a time. A toolbar window can’t be
closed and always appears in front of other windows at runtime.
When you display the Form Definition window with the Windows tab
selected, all of the windows in that form will appear in the tab’s list area.
When you add windows, each will be added to the top of the list if no
window is selected, or directly below any highlighted window in the list.
The first window is considered the form’s main window; the order of the
remaining windows isn’t critical. If a user closes a form’s main window, the
entire form will be closed. Windows are unique to a single form, so they
can’t be shared among multiple forms.
QUICK START 51
PA RT 2 L E S S O N S
The window for the Inventory_Maintenance form will display the part
number, description, cost, selling price and ordering status. It must also
provide a way to enter and retrieve information.
Before beginning this lesson, be sure you’ve created the forms for the
Inventory application as described in the previous lesson.
To create the window for the Main Menu form, be sure the Resource
Explorer window is open. Display the forms that have been created in the
dictionary. Select the Main Menu form from the forms list, and click the
Open button in the Resource Explorer toolbar to open the Form Definition
window.
You can also open a form by double-clicking its name in the Resource Explorer.
52 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
Create the window for With the Windows tab in the foreground, click New to open the Window
the Main Menu. Layout window. The Window Layout window, and its accompanying
Toolbox and Properties windows, will appear as shown in the following
illustration. If the Properties window doesn’t appear, you can open it by
choosing Properties from Layout menu.
When the Window Layout window first opens, the entire window is
selected, and window-related properties appear in the Properties window.
As you move the pointer from the Toolbox to the Window Layout and
Properties windows, the window in which the pointer is currently located
will become active.
QUICK START 53
PA RT 2 L E S S O N S
Specify the name of With the entire window selected and the Object tab selected in the
the window that will be Properties window, click the Name property in the property list. The Name
used when referring to property will appear at the top of the tab with its default value, Window1.
the window in scripts. Replace that value with Main_Menu_Window and press ENTER to save
your change.
Specify the window’s Using the same procedure, change the Title property’s value to Main
title. Menu. This is the value that will appear in the window’s title bar at
runtime.
Be sure that the following properties located in the Object tab are set as
follows:
AutoOpen True
CloseBox False
Resizeable False
WindowType Primary
Next, click the Visual tab to view the properties related to the appearance of
the window. Be sure that the following properties located in this tab are set
as follows:
BackColor True
ControlArea False
These properties indicate this will be a standard window that will open
when the form is opened. The window will have a colored background, and
users won’t be able to resize the window.
Now that you’ve set the window’s properties, you’re ready to use the
Toolbox to add objects to the layout area.
First, you’ll need to add text to the window to identify the application. To
do this, click the text tool (shown at left) in the Toolbox. When you move the
pointer to the layout area, the appearance of the pointer will change. It will
appear as the plus sign (+) followed by the letter “A”.
Click in the middle of the layout area. When the blinking insertion point
appears, type the following:
Inventory Application
54 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
When you’ve finished typing, click the arrow tool (shown at left) in the
Toolbox, and use it to select the text you’ve just entered in the layout area.
Once the text is selected, set the following properties under the Visual tab in
the Properties window:
Font Helvetica 24
FontColor Dark Blue
When setting the color, you will need to display the Color tab in the
FontColor window. After you’ve finished, the Properties window should
appear as shown in the following illustration:
You’ll need to resize the text field, as the space previously allocated for it in
the window layout is insufficient to display the text using the newly-
selected font. When you’ve finished resizing the text field, the layout area
should appear as shown in the following illustration:
QUICK START 55
PA RT 2 L E S S O N S
Create a push button Next, create a local push button for this window. It will be used to open the
for the window. Inventory_Maintenance form you created in the previous lesson.
To create the local push button, be sure the Layout tab is selected in the
Toolbox. Then, select Local Fields from the drop-down list located in the
center of the Toolbox. Click New to open the Local Field Definition window.
Enter the following information without clicking OK:
Add static text to the To enter a static value for the push button, click the Static Values lookup
push button. button. The Button Items window will open. Enter the following
information as the “Up” caption.
56 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
When you’ve finished, the Button Items window should look like the
following illustration.
Click OK to save the static value and click OK in the Local Field Definition
window to save the local field. The local field name should appear in the
list in the Toolbox. Click its name in this list, and drag it to the layout area.
In a window layout, fields can appear with their field names or as they appear when
the application is run. The remainder of this manual displays the fields with their
field names. To display field names, be sure the Show Field Names item is marked in
the Layout menu.
QUICK START 57
PA RT 2 L E S S O N S
Position the window. Choose Position Window from the Layout menu. A window that’s the same
size of the window you’re creating will open. Move the window to the
center of the screen and click OK to set the opening position of the window.
You could also position the window using the Position-Left and Position-Top
properties. However, to do this, you’ll have to know the coordinates of the desired
window position.
Preview the window. To see how the window will appear at runtime, choose Preview from the
Layout menu. A new window will appear in the foreground. The title bar
will contain the word Preview, followed by the window title that will
appear in the window at runtime. When you’ve finished previewing the
window, close the window using the window’s close box.
If you’re satisfied with the appearance of the window, close the layout
window and save your changes. Click OK in the Form Definition window
to save the form.
Create the window for Next, you need to create the window for the Inventory_Maintenance form.
the Inventory_ Select Inventory_Maintenance from the list of forms in the Resource
Maintenance form. Explorer and click the Open button on the Resource Explorer toolbar. With
the Windows tab in the foreground, click New to open the Window Layout
window.
With the entire window selected and the Object tab selected in the
Properties window, set the following properties to the specified values:
Name Inventory_Maintenance
Title Inventory Maintenance
AutoLinkTable Inventory_Data
AutoOpen True
CloseBox True
Resizeable True-Automatic
WindowType Primary
Next, click the Visual tab to view the properties related to the appearance of
the window. Be sure that the following properties located in this tab are set
as follows:
BackColor True
ControlArea False
58 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
If you plan to allow These settings indicate that this will be a standard window that has a close
users to use the box and is resizeable. It will have a light gray background and open when
Modifier with a stand- the form is opened. The window will be auto-linked to the Inventory_Data
alone application, refer table to allow the Modifier to access fields from the table. The Modifier is a
to your Dexterity customization tool that you can distribute with your application. It allows
licensing agreement users to make modifications to your application, such as changing prompts.
for information about
distributing the When you’ve finished setting these properties, the Object and Visual tabs of
Modifier. the Properties window should appear similar to ones shown in the
following illustration.
The numeric values in the above illustration, such as the Position-Top and Size-
Height properties, may be different than the ones that appear on your screen. These
differences are normal and are not a problem.
Add fields to the layout Now you’re ready to add fields to the window layout. Be sure Global Fields
area. is selected in the Toolbox’s drop-down list. Each global field defined in the
dictionary will appear in the tab’s list area. Drag each field, in the order
listed below, to the layout area and position them as shown in the following
illustration. You may find it necessary to resize the window using the resize
handles.
QUICK START 59
PA RT 2 L E S S O N S
For detailed To align fields in the Layout area as precisely as shown in the previous
information about each illustration, use the Tile tools located in the Arrange tab of the Toolbox, as
tool in the Toolbox, shown in the following illustration.
search the online help
for Toolbox.
To align the Part Number, Description, Cost and Selling Price fields, select
all four fields and click the Toolbox’s Arrange tab to bring it to the
foreground. Enter 10 in the Space field, and click the Tile Vertically tool to
space them 10 pixels apart. To evenly space the Save, Clear and Delete
buttons, select all three buttons and use the Tile Horizontally tool to space
them 13 pixels apart.
To select multiple fields in the layout area, use the arrow tool to draw a box around
the desired fields. You can also select multiple fields by holding down the SHIFT key
and clicking each desired field in the layout area.
60 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
Set the field properties Most of the properties for each field are set by default to the values you’ll
for each field. want to use. However, there are some properties you’ll need to set. First,
you should set the Appearance property under the Visual tab for each of the
non-button fields.
You can set the properties for multiple fields by selecting those fields in the layout
area and then moving the cursor to the Properties window. Only properties the
selected fields have in common will be displayed.
Appearance 3D Border
BackColor System-Window Background
FontColor System-Window Text
Next, you’ll need to set the Required property under the Object tab for the
Part Number and Description fields.
Required True
Label the fields. Use the text tool to add a prompt next to or above each field in the window.
Use the field’s name, followed by a colon(:), as its prompt.
Once you’ve created all the prompts, use the Align tools on the Arrange tab
to align the prompts with their fields.
Use the line tool (shown at left) to draw a separator between the push
buttons and the rest of the fields in the window. Once you’ve drawn the
line, select it, and be sure the following properties under the Visual tab in
the Properties window:
Appearance 3D Border
LineColor System
When you finish, the window should resemble the following illustration:
QUICK START 61
PA RT 2 L E S S O N S
Preview the window. Choose Preview from the Layout menu to see how the window will appear
at runtime. Note any problems that you find, such as misaligned fields, an
incorrect window title or problems with the line you drew using the line
tool. When you’ve finished previewing the window, close the preview
window to return to the Window Layout area and make any necessary
changes.
Set the tab sequence. The next step is to set the tab sequence for the fields. Choose Set Tab
Sequence from the Layout menu. The first field in the tab sequence will be
highlighted. If the Part Number field isn’t highlighted, double-click it, then
press the TAB key to move to the next field, Description. If the tab doesn’t
move the highlight to the Description field, double-click the Description
field. Continue this process until pressing the TAB key highlights each field
in the order shown in the following list:
Part Number
Description
Cost
Selling Price
Status
Save Button
Clear Button
Delete Button
The initial tab sequence is determined by the order in which you placed the fields on
the window. If you placed the fields in the window in the order suggested, the tab
sequence should have been correct the first time.
Once you’ve set the tab sequence in the above order, choose Set Tab
Sequence from the Layout menu again to unmark the menu item.
Link fields to their text Now link the fields with their prompts. By linking fields, the status of the
prompts. field is indicated by its prompt. For example, if the field is disabled, the text
linked to the field will appear in gray, indicating data can’t be entered in the
field.
The cursor changes To link fields to their prompts, choose Link Prompt from the Tools menu.
appearance when You’ll know when the Link Prompt mode is turned on, as the cursor will
you’re in Link Prompt appear as an arrow next to a box containing the letters ABC when it is
mode. positioned in the layout area.
62 Q U I C K S T A R T
C H A P T E R 9 C R E A T I N G W I N D O W S
Click the name of the field to link and drag the pointer to the prompt
associated with it. A dotted line will appear showing the link. Release the
mouse button. A dark flashing line will indicate the link was made, as
shown in the following illustration.
When you’ve linked the Part Number, Description, Cost, Selling Price and
Status fields to their prompts, choose Link Prompt from the Tools menu to
end the linking process.
Set the opening The last step is to set the default opening position for the window, just as
position of the you did for the Main Menu window. Choose Position Window from the
window. Layout menu. A window the same size as the one you’re creating will
appear. Move it to the center of the screen. Click OK to save the location.
Close the layout window and save your changes. Click OK in the Form
Definition window to save the changes to the form.
QUICK START 63
64 Q U I C K S T A R T
Chapter 10: Adding Scripts
For more information The Dexterity development system has its own programming language,
about the sanScript sanScript, that you’ll use to control how your application operates. Unlike
language, refer to Part many traditional languages that require you to write long sequences of
1, sanScript, in program code, sanScript is written in small segments, or scripts, that are
Volume 2 of the attached to objects in an application dictionary, such as fields, menus,
Dexterity windows and forms. Scripts are run as the user interacts with the objects the
Programmer’s Guide. scripts are attached to.
For information about
specific commands, This script-based approach and sanScript’s English-like instructions are
refer to the SanScript designed to make Dexterity applications easier to write than applications
Reference manual. written with other languages. If you’ve had experience writing programs in
other languages such as Pascal or BASIC, you’ll find many concepts are
similar in sanScript.
Refer to Chapter 3, The three most common kinds of scripts in Dexterity are pre, change and
“Attaching Scripts,” in post scripts:
Volume 2 of the
Dexterity • Pre scripts can be attached to forms, windows and fields. Form or win-
Programmer’s Guide dow pre scripts run just as the form or window is opened. Field pre
for more information scripts run when focus moves to the field.
about the different
types of scripts in • Change scripts can be attached to fields only. Field change scripts run
Dexterity. when focus leaves the field if the value in the field has changed. If a
change script is attached to a push button, it runs when the button is
clicked.
• Post scripts can be attached to forms, windows and fields. Form or win-
dow post scripts run just as the form or window is closed. Field post
scripts run when focus leaves the field, regardless of whether the field’s
value has changed.
QUICK START 65
PA RT 2 L E S S O N S
• Delete the current record from the table when the Delete button is
clicked.
You can also open a window’s Layout window by double-clicking the window
name.
Attach a script to the When a user clicks the Inventory Button at runtime, the
Inventory push button. Inventory_Maintenance form should open and display the
Inventory_Maintenance window. Since the act of clicking the button
changes the Inventory Button field, you need to attach a change script to the
push button.
66 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
You can open the change script for a field by double-clicking that field in the layout
area. However, you must use the Script tab of the Properties window to access a
field’s pre or post script.
When you’ve finished, the Script Editor window should appear as shown
in following illustration.
Notice that the text you typed in appears in two colors. The different colors
indicate the various elements of the syntax, like keywords, names and
comments. The colors reduce errors when you type scripts and also make
them easier to read.
QUICK START 67
PA RT 2 L E S S O N S
Click Compile to verify and save the script. If there are any problems in the
script, they will be listed at the bottom of the Script Editor window.
Compiler errors are problems in a script that prevent it from being compiled, such
as syntax errors. Compiler warnings are less serious problems that won’t prevent a
script from being compiled, but should be resolved.
If any compiler errors are listed, be sure you have entered the script exactly
as shown and that the Inventory_Maintenance form created previously has
the correct name. To check the spelling of the form name, click the Names
button to open the Names window, which lists the names of all forms,
windows, tables and fields defined in the application. In the Names
window, click the Forms button to list the names of the forms in the
Inventory application.
68 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
If there are no errors, click Close to close the Script Editor window. Close
the Layout window and save the changes. Click OK in the Form Definition
window to save the form.
Test the Inventory Now you’ll be able to run the Inventory application to test the windows
application windows and script you’ve created. Choose Test Mode from the Debug menu. The
and the script you tool bar will disappear and the main window that you created will open, as
created. shown in the following illustration.
Test the Inventory Enter some data in the fields and click the buttons. No processing will occur
Maintenance window. since you haven’t attached any scripts to these buttons yet. Test the tab
sequence. Choose Show Required Fields from the Help menu. The prompts
for the Part Number and Description fields should be displayed in boldface
type. This shows you which fields must contain entries before you can save
a record.
QUICK START 69
PA RT 2 L E S S O N S
If the push buttons or the status list box appear without text values, you
may not have given them static values. Refer to Chapter 4, “Creating Data
Types,” for information about adding static values.
When you’ve finished testing the window, close it. Choose Test Mode from
the Debug menu to exit test mode. If the windows appeared and functioned
properly, you’re ready to attach the remaining scripts.
Add the Pathname For the sample application to work properly, you must add code that will
procedure script that tell the application where to look for data. This is done by adding a
tells the application procedure script with the special name “Pathname” to the application
where to look for data. dictionary.
In the Resource Explorer, display the procedures and functions that have
been defined for the dictionary by clicking the Scripts node in the Resources
Tree.
Procedure Pathname
in integer dict_id;
in integer table_series;
in integer table_group;
out string data_path;
This sanScript code specifies that the application should look in the
same location as the application dictionary for the data files.
70 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
Attach scripts to the In the Resource Explorer, display the forms that have been defined for the
buttons in the dictionary. Double-click the Inventory_Maintenance form to open its Form
Inventory_Maintenance Definition window. With the Inventory_Maintenance window highlighted
window. in the Windows tab of the Form Definition window, click Open.
Add the Clear button First, add a script to the Clear button. The following steps describe how to
script. design and add the script for the Clear button:
• The script should run when the Clear button is clicked, so it will be
a change script.
The release table statement allows the application to read another item
from the table. The restart form statement clears the fields in the
window so they can accept new data.
QUICK START 71
PA RT 2 L E S S O N S
Double-click the Clear button in the layout area. The Script Editor will
open. The script name will be entered automatically. Script names are
constructed from the current window name, field name and the script
type, such as CHG for a change script.
Click Compile to verify and save the script. If there are no errors, click
Close to close the Script Editor window. The name of the script will
appear next to the Change property under the Script tab in the
Properties window, indicating a change script is attached to the push
button.
72 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
Add the Save button Next, design and add the script for the Save button using the same
script. procedure outlined for the Clear button.
• The script should run when the button is clicked, so the script will
be a change script.
QUICK START 73
PA RT 2 L E S S O N S
The first part of the “if...end if” structure uses the required() function to
find out whether all the fields you specified as required have data in
them. If they don’t, a warning indicating this will appear. If the
required fields have been entered, the second part of the “if...end if”
structure copies the information in the fields from the window to the
table buffer, and then saves the information to the table and clears the
window.
Click Compile to verify and save the script. If no errors occur, click
Close to close the Script Editor window.
You will receive a warning indicating that a literal string was used. Literal
strings can cause problems with making international versions of an
application. For this sample application, it’s OK to include literal strings.
74 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
Add the Delete button Next, design and add the script for the Delete button using the same
script. procedure.
• The script should run when the Delete button is clicked, so the
script will be a change script.
The “if...end if” structure uses the ask() function to verify that the user
wants to delete the item. ASKBUTTON1 is a predefined Dexterity
constant signifying the first button in the dialog box displayed by a
function such as ask(). If the user clicks the first button, Delete, the item
will be removed from the table and the Inventory Maintenance window
will be cleared. If the user clicks Cancel, the alert message dialog box
will close and no other action will be taken.
QUICK START 75
PA RT 2 L E S S O N S
In the Resource Explorer, display the forms that have been defined for
the dictionary. Double-click Inventory_Maintenance form; the Form
Definition window will appear. Open the Inventory_Maintenance
window and double-click the Delete button in the layout area. The
Script Editor window will open and the script name will be entered
automatically.
Click Compile to verify and save the script. If no errors occur, click
Close to close the Script Editor window.
Add the script to Since no testing can be done until items can be retrieved from the table, the
retrieve records. following script to retrieve information should be added next. Again, use
the same procedure to design and add the script.
76 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
• In all cases, prevent the Part Number field from being modified.
• Because the script needs information from the Part Number field, it
should be attached there.
• The script should run when a new part number is entered (when
the Part Number field changes), so the script should be a change
script.
Notice that field names that include spaces must be enclosed in single quotes to
compile properly.
QUICK START 77
PA RT 2 L E S S O N S
The first part of the script evaluates the part number entered and
attempts to retrieve a record from the table with that part number. The
second part of the script uses an “if...end if” structure to determine
whether there was a problem retrieving the item. If there were no
problems reading the table, this means an item was found and the
information is copied to the window. If there was a problem, the script
assumes the item couldn’t be retrieved because it doesn’t exist and the
window will be left empty to be filled in by the user.
Enter the following script. The continuation character (➥) indicates that
the following text should be typed on the same line as the previous text.
Some of the statements are lengthy. You may have to scroll to the right
in the Script Editor window to see the text you enter.
{Set the value of the key field in the table buffer.}
'Part Number' of table Inventory_Data = 'Part Number' of window
➥ Inventory_Maintenance;
{Release the lock on any record currently in the table buffer.}
release table Inventory_Data;
{Attempt to retrieve the record from the table.}
change table Inventory_Data by Inventory_Data_Key1;
Click Compile to verify and save the script. If no errors occur, click
Close to close the Script Editor window.
78 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
Add the window pre Now you’ll add the script to disable the Delete button that was mentioned
script. previously. Use the same procedure to design and add this script.
• The best location to attach this script would be the Inventory Main-
tenance window itself, since the action isn’t the result of changing a
particular field or pushing a button.
This single statement disables the Delete button until the enable field
statement runs.
QUICK START 79
PA RT 2 L E S S O N S
In the Resource Explorer, display the forms that have been defined for
the dictionary. Double-click the Inventory_Maintenance form; the Form
Definition window will appear. Double-click the
Inventory_Maintenance window to open its layout window. With the
entire window selected, click the Script tab in the Properties window.
Double-click the Pre property to open the Script Editor window and
attach a pre script. The script name will be entered automatically.
Click Compile to verify and save the script. If no errors occurred, click
Close to close the Script Editor window. The name of the script will
appear next to the Pre property, indicating that the script is attached.
Close the Window Layout window, saving your changes.
Add the window post One more issue must be addressed with a script. You’ve been closing the
script. Inventory Maintenance window using the close box. If you were entering
information and closed the window without having saved the current
entry, your information would be lost. A script that verifies whether the
information needs to be saved before the window closes would solve this
problem. The design and content for this script is given in the following
steps:
80 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
• The script should run when the window closes, so the script will be
a window post script.
QUICK START 81
PA RT 2 L E S S O N S
The first part of the “if...end if” structure uses the changed() function to
see if any items in the inventory window have changed. If no changes
were made, the window will close. If changes were made, the ask()
function is used to check whether the user wants to save changes. If the
user clicks Yes, the same routine used in the save script checks whether
the required information has been entered, then it saves the data. If the
user clicks Cancel, the window remains open and unchanged.
82 Q U I C K S T A R T
C H A P T E R 1 0 AD D IN G S C R IP T S
Click Compile to verify and save the script. If no errors occurred, click
Close to close the Script Editor window. The name of the script will
appear next to the Post property, indicating that the script is attached.
Close the Window Layout window, saving your changes.
In this chapter you’ve learned about pre, change and post scripts.
You’ve also learned how to attach scripts, how to use the Script Editor
window, and how to use some common sanScript commands.
QUICK START 83
84 Q U I C K S T A R T
Chapter 11: Creating a Lookup
Lookups allow a user to view multiple fields from multiple records in a
table. Usually, a user can select a record from a lookup and return it to the
window from which the lookup was accessed.
To easily display multiple lines of data from a table, lookups use scrolling
windows. Scrolling windows never appear by themselves in a Dexterity
application like primary windows. Like fields, they must be added to the
layout area of an existing window, where you can change how the scrolling
window will operate by setting the scrolling window’s properties or
attaching scripts to the window.
QUICK START 85
PA RT 2 L E S S O N S
Name Inventory_Lookup
Series 3rd Party
Create the Click the Tables tab, and then click Attach to link the Inventory_Data table
Inventory_Lookup to the form. The Table Lookup window will appear, containing a list of all
form. tables in the application. Select the Inventory_Data table and click OK. The
Table Lookup window will disappear, and the Form Definition window
should appear as shown in the following illustration.
86 Q U I C K S T A R T
C H A P T E R 1 1 C R E A T I N G A L O O K U P
Create the Click the Windows tab, and then click New to create a new window for the
Inventory_Lookup form. With the new window selected in the Window Layout window, set
window. the following properties under the Object tab in the Properties window:
AutoLinkTable Inventory_Data
AutoOpen True
CloseBox True
Name Inventory_Lookup
Title Inventory Lookup
WindowType Primary
Once you’ve set the above properties, click the Visual tab, and set the
following properties:
BackColor True
ControlArea False
Add the scrolling In the layout window, use the scrolling window tool to draw a scrolling
window to the layout. window as shown in the following illustration:
QUICK START 87
PA RT 2 L E S S O N S
When you’ve drawn the scrolling window, the Scrolling Window Options
window appears automatically. Enter the following information in the
specified order. A Link Table must be specified before you can specify a
Link Key.
You can move the small line item boundary by selecting Mark Small Line Item from
the Tools menu and then clicking the desired location in the scrolling window. For
the Inventory_Lookup_Scroll, you won’t have to move the small line item.
With the entire scrolling window selected in the layout area, set the
following properties under the Object tab in the Properties window:
DefaultDblClick True
WindowType Browse Only
88 Q U I C K S T A R T
C H A P T E R 1 1 C R E A T I N G A L O O K U P
Add the fields to the Drag the Part Number and Description fields from the list of global fields in
scrolling window. the Toolbox to the scrolling window and place them above the small line
item. You’ll need to resize the fields to fill the width of the entire line. When
you’ve finished, the layout area should appear as shown in the following
illustration.
Select both fields and set the following properties under the Visual tab:
Appearance 2D Border
Border False
When you’ve finished, close the layout window for the scrolling window
and save the changes.
Close the Window Layout window and the Form Definition windows,
saving changes to the new form and window. They must be saved before
you attach scripts. Reopen the Inventory_Lookup form and the
Inventory_Lookup window.
QUICK START 89
PA RT 2 L E S S O N S
Create the Select To create the Select button, click the Layout tab in the Toolbox, and select
button. Local Fields from the drop-down list in the center of the Toolbox. Click New
to open the Local Field Definition window, and enter the following
information:
Specify Text - Picture as the static type, and click the Static Values lookup
button. In the Button Items window, insert the following text for the Up
Caption:
Select
Click OK to save the text and close the Button Items window. Then click
Add to add the local field and leave the Local Field Definition window
open.
Create the Cancel Enter the following information to create another local field:
button.
Field Name Cancel Button
Array Size 0
Data Type Local
Control Type Push Button
Specify Text - Picture as the static type, and click the Static Values lookup
button. In the Button Items window, insert the following text for the Up
Caption:
Cancel
Click OK to save the text and close the Button Items window. Click OK to
save the new local field and close the Local Field Definition window.
90 Q U I C K S T A R T
C H A P T E R 1 1 C R E A T I N G A L O O K U P
Drag the local fields to the window layout, and use the line tool to draw the
separator line, as shown in the following illustration.
Attach a window pre Next you’ll attach scripts to the two new buttons and the window. With the
script. entire window selected in the layout area, click the Script tab in the
Properties window. Double-click the Pre property to open the Script Editor.
The script name will be entered automatically. Enter the following script:
This script fills the scrolling window with information from the linked
table. Click Compile to verify and save the script. If no errors occur, click
Close to close the Script Editor window.
Attach a script to the Double-click the Select button in the layout area to open the Script Editor
Select button. window. The script name will be entered automatically. Enter the following
script:
This script copies the part number of the item selected in the scrolling
window to the part number field of the Inventory Maintenance window so
the information can be retrieved. Click Compile to verify and save the
script. If no errors occur, click Close to close the Script Editor window.
QUICK START 91
PA RT 2 L E S S O N S
Attach a script to the Following the same procedure used for the Select button, apply the
Cancel button. following change script to the Cancel button:
Click Compile to verify and save the script. If no errors occur, click Close to
close the Script Editor window.
Set the Select button to Select the Select button in the layout area. Click the Object tab in the
be the default. Properties window, and set the following property:
Default True
This property makes pressing the ENTER key, or double-clicking a line in the
scrolling window produce the same result as clicking the Select button.
To finish the scrolling window, choose Position Window from the Layout
menu. A window the same size as the Inventory_Lookup window will
open. Move it to the lower middle part of the screen and click OK. The
lookup window will open in that position at runtime.
Close the layout window and save your changes. Click OK to close the
Form Definition window.
Create the Lookup Now that you’ve created the lookup window to display all of the part
button. records entered in the sample application, you must create a mechanism to
open the lookup window. Most applications provide two ways to access the
lookup window. The first is a local push button on the Inventory
Maintenance window.
Specify Text - Picture as the static type, and then click the Static Values
lookup button. In the Button Items window, insert the following text for the
Up Caption:
92 Q U I C K S T A R T
C H A P T E R 1 1 C R E A T I N G A L O O K U P
Click OK to save the static value and close the Button Items window. Click
OK to save the new local field and close the Local Field Definition window.
Drag the local field to the window and place it to the right of the Part
Number field. Resize the button to a 20-pixel by 20-pixel square, using the
Size coordinates at the bottom of the Toolbox as a guide. The Inventory
window should resemble the following illustration.
Attach a script to the A script must be attached to the Lookup button to open the lookup
Lookup button. window. Double-click the Lookup Button field in the layout window to
open the Script Editor window and create a change script. Enter the
following script:
Click Compile to verify and save the script. If no errors occur, click Close to
close the Script Editor window.
QUICK START 93
PA RT 2 L E S S O N S
Test the scrolling The scrolling window is now complete. Close all the windows and save
window. changes. Choose Test Mode from the Debug menu to test the lookup
window. When you click the Lookup button, the Inventory Lookup
window containing the scrolling window should appear, displaying
records for all the parts you entered. When you highlight one of the records
and click the Select button, the part should be displayed in the Inventory
Maintenance window. You also can select a part by double-clicking it or by
highlighting it and pressing ENTER. The Inventory Lookup window with the
sample data installed with Dexterity is shown in the following illustration:
When you’ve finished testing the scrolling window, exit test mode.
Associate the lookup The second method you’ll provide for accessing the lookup window will be
window with the Part to associate the Lookup item in the Help menu with Part Number field.
Number field. This causes the Inventory Lookup window to open if the Lookup menu
item is selected when the focus is on the Part Number field.
Lookups can be associated with fields using the Lookup Form field in the
Field Definition window or the Local Field Definition window. If a lookup
form has been designated for a global field, the Lookup menu item will
open the designated form if the focus is on any occurrence of that field in
the application.
In the Resource Explorer, display the fields that have been created in the
dictionary. Do this by selecting the Base category in the left pane of the
Resource Explorer, clicking the plus sign to expand the Base group, then
selecting the Fields item. Select the Part Number field and click Open.
94 Q U I C K S T A R T
C H A P T E R 1 1 C R E A T I N G A L O O K U P
Click the Lookup Form lookup button to open the Form Lookup window,
which contains a list of the forms in the Inventory application. Select
Inventory_Lookup from the list and click OK. Inventory_Lookup will
appear in the Lookup Form field in the Field Definition window. Click OK
to close the Field Definition window.
Test the Lookup menu Choose Test Mode from the Debug menu, and open the Inventory
item. Maintenance window. With the focus on the Part Number field, choose
Lookup from the Help menu. The Inventory Lookup window should
appear. Choose Test Mode from the Debug menu again to return to tools
mode.
In this chapter you learned to design and create a scrolling window. You’ve
also learned to access that scrolling window from a script attached to a push
button and from the Help menu’s Lookup item.
QUICK START 95
96 Q U I C K S T A R T
Chapter 12: Creating Menus
Refer to Chapter 14, Each form you create can have its own set of menu items that can be
“Form-based Menus,” accessed by the user at runtime. Menus are found across the top of the
in Volume 1 of the screen in your application’s menu bar. Each of the selections associated
Dexterity with a particular menu is called a menu item, and each menu item can have
Programmer’s Guide a script attached to it. The menus attached to a form appear only when a
for more information window attached to the form is active.
about using menus in
your application. This chapter will explain how to add the following menu to the Inventory
application.
QUICK START 97
PA RT 2 L E S S O N S
To begin adding the menu, use the Resource Explorer to display the forms
you created for the Inventory application. Open the Form Definition
window for the Inventory_Maintenance form. Click the Menus tab, and
then click New to open the Menu Definition window shown in the
following illustration.
Add the Markup menu. Enter the following information in the Menu Definition window without
clicking OK:
Click New to add a new menu item. Enter the following information:
98 Q U I C K S T A R T
C H A P T E R 1 2 C R E A T I N G M E N U S
Click New to add another new menu item. Then enter the following
information:
When you’ve finished, the Menu Definition window should look like the
following illustration:
Notice than an ampersand (&) is included in the menu’s display name and
in each of the menu items you entered. The ampersand signifies that the
character immediately following is to be used as an access key. Access key
characters will appear underlined at runtime.
An access key can be used in combination with the ALT key as a keyboard
equivalent. For example, the keyboard combination of ALT + U will display
the Markup menu, just as clicking the Markup item on the menu bar would.
Dexterity also allows you to create a second keyboard equivalent for menu
items, called a shortcut key. Shortcut keys can be used regardless of the
operating system used to run the application. For example, the 10% menu
item you just defined could be activated by the keyboard sequence CTRL + 1.
QUICK START 99
PA RT 2 L E S S O N S
Add scripts to the Next, you’ll attach scripts to the menu items. Select the 10% menu item and
menu items. choose Application Script as the action to perform. The Scripts button will
become enabled. Click the Scripts button to open the Script Editor window.
If you’ve selected the correct item, the following script name will be
automatically entered:
Inventory_Maintenance_MENU_Markup_ITEM_&10%
This script adds 10% to the value in the Cost field and stores the result in
the Selling Price field. Click Compile to verify and save the script, and then
click Close to close the Script Editor window.
Using the same procedure, attach the following script to the 20% menu
item. If you’ve selected the correct item, the following script name will be
automatically entered:
Inventory_Maintenance_MENU_Markup_ITEM_&20%
This script adds 20% to the values in the Cost field and stores the result in
the Selling Price field. Click Compile to verify and save the script, and then
click Close to close the Script Editor window. Click OK to save the menu
and close the Menu Definition window.
Before testing the menu, three other scripts must be added or modified in
the Inventory application. The items in the Markup menu should be
accessible only when the focus is on the Selling Price field. This prevents the
user from inadvertently changing the selling price. The window pre script
for the Inventory Maintenance window should be modified to disable the
menu items. A pre script should be added to the Selling Price field to enable
the menu items once the focus moves to the Selling Price field. Similarly, a
post script needs to be added to the field to disable the menu items when
the focus leaves the field.
100 Q U I C K S T A R T
C H A P T E R 1 2 C R E A T I N G M E N U S
Add statements to the The Form Definition window for the Inventory_Maintenance form should
window pre script. already be open. Click the Windows tab and open the
Inventory_Maintenance window. With the entire window selected, click the
Script tab in the Properties window. Double-click the Pre property to open
the Script Editor window and edit the existing window pre script, which
contains only one statement. Add the following statements to the end of the
script:
These statements disable the items in the Markup menu. Click Compile to
verify and save the script, and then click Close to close the Script Editor
window.
Add a pre script to the Select the Selling Price field in the layout area. Double-click the Pre
Selling Price field. property in the Properties window to attach a field pre script. Enter the
following script:
This script enables the two items in the Markup menu when the focus
moves to the Selling Price field. Click Compile to verify and save the script,
and then click Close to close the Script Editor window.
Add a post script to the Next, double-click the Post property to attach the following post script to
Selling Price field. the Selling Price field:
This script disables the two menu items when the focus leaves the Selling
Price field. Click Compile to verify and save the script, and then click Close
to close the Script Editor window.
Now you’re ready to test the menu. Close the layout window and the Form
Definition window. Be sure to save the changes, and then enter test mode.
Open the Inventory Maintenance window; you should see the Markup
menu on the menu bar. Both of the items in the menu should be disabled
(displayed in gray).
Retrieve one of the items from the Inventory_Data table and move the focus
to the Selling Price field. The two items in the Markup menu should be
enabled. Choose 10% or 20% from the menu and note that the value in the
Selling Price field was calculated based upon the value in the Cost field and
the menu item you chose. When the focus leaves the Selling Price field, the
two menu items should be disabled.
In this chapter, you learned to how to add a menu to a form, how to create
shortcut keys and access keys for the menu, how to add scripts to menu
items, and how to enable and disable menu items.
102 Q U I C K S T A R T
Chapter 13: Creating a Report
For more information Dexterity has a built-in report writer that allows you to create reports based
about reports, refer to on the data in your application’s tables. This chapter covers the most basic
Chapter 32, “Report aspects of the Dexterity Report Writer. You’ll learn how to create a report,
Writer Overview,”, in design a report layout, and provide access to reports from within a
Volume 1 of the Dex- Dexterity application.
terity Programmer’s
Guide. The Dexterity Report Writer allows you to create reports and ship them
with your application dictionary. Refer to your Dexterity licensing
agreement for information about your access to the runtime version of the
Report Writer. Depending upon the terms of your agreement, you may be
able to send the runtime version of the Report Writer to your customers,
along with your application. This will allow them to create their own
reports, or modify those you’ve created.
Reports can contain numerous sections. The following table describes the
most commonly used report sections:
Section Description
PH Page Header. Items placed in the page header are printed at the top
of every page.
RH Report Header. Items placed in the report header are printed at the
beginning of every report, after the page header, if one is included on
the first page of the report.
B Body. Items placed in the body of the report are printed after all
headers have been printed.
RF Report Footer. Items placed in the report footer are printed at the end
of every report, after the body, but before the page footer, if one is
included on the last page of the report.
PF Page Footer. Items placed in the page footer are printed at the
bottom of every page.
Each report created using the Dexterity Report Writer must have one table
designated as its main table. This is usually the table that contains most of
the fields to be displayed in the report. Other tables for which relationships
have been defined with the main table may also be attached to a report, and
data in those tables may also be displayed in the report. Since the Inventory
application only has one table, selecting a main table for this report is an
easy choice.
When you select Inventory Data as the main table, the table’s only key is
automatically entered in the Using Key field.
By unmarking these check boxes, you prevent the Page Header and Page
Footer that you’ll define for the report from being printed on the first page
and last page of the report, respectively.
104 Q U I C K S T A R T
C H A P T E R 1 3 C R EA T IN G A R EP O R T
If a key for the main table won’t sort the report the way you want, Dexterity
allows you to create a different sorting order. Since the key for the Inventory
Data table contains only the Part Number field and we want to sort this
report by the Status field, we need to specify an alternate sorting order.
Specify the desired To specify the desired sorting order, click Sort in the Report Definition
sorting order. window. The Sorting Definition window will appear, allowing you to select
fields from any of the tables associated with the report as the fields upon
which the report will be sorted.
The Report Name and Report Table fields will already be set. Select Status
in the Table Fields list and click Insert. The Sorting Definition window will
appear as follows:
Click OK to save the sorting order and close the window. Click Layout to
open the Report Layout window, shown below:
106 Q U I C K S T A R T
C H A P T E R 1 3 C R EA T IN G A R EP O R T
Add fields to the report Drag the following fields from the fields list to the layout area and place
layout. them in a row at the top of the body section:
Part Number
Description
Status
Cost
Selling Price
You may have to resize the Report Layout window and scroll horizontally
to place all the fields.
The blue guides mark the maximum text width for your current printer. To
make the fields in the layout fit within the guides, set the drawing options
for each field to use a 10-point font instead of a 12-point font. To do this,
select all the fields and choose Report Drawing Options from the Tools
menu; select a 10-point font and click OK to save your changes and close
the window. Adjust the width of each field to account for the smaller font.
After all of the fields have been arranged in the layout, resize the body
section by dragging its label up to the bottom of the fields to remove any
extra space. When you’ve finished, the layout should resemble the
following illustration.
Add the report title, Now you need to add a header to display the report’s title, labels for each
labels and separator column of data that will appear on the report, and a line to separate the
line. labels from the data. Since this information should only appear on the first
page of the report, you’ll add it to the report header section.
Using the Text and Line tools, add a title, labels and the separator line to the
report header section as shown in the following illustration. Use the
Drawing Options window (displayed by choosing Report Drawing Options
from the Tools menu) to specify an appropriate font, style and color. Use the
tools on the Arrange tab to align the labels.
Add the page number In case the report spans multiple pages, you’ll need a way to label the order
to the page header. of the pages. This can be accomplished by including the page number on
each page of the report. Add the page number to the page header section.
Since the report header section you just defined appears on the first page only,
there’s no need for the page number to appear on the first page. That’s why you
unmarked the First Page Header option in the Report Definition window.
108 Q U I C K S T A R T
C H A P T E R 1 3 C R EA T IN G A R EP O R T
Select the Page Number tool from the Toolbox and place a page number in
the page header section. Use the Text tool to add the page number label.
When you’ve finished, the layout window should look like the following
illustration.
Close the layout window and save your changes. Click OK in the Report
Definition window to save the report.
Preview the report. Now you’ll preview the report. Select the Inventory Report in the Resource
Explorer. Choose Print Report in the Report Destination button drop list on
the Resource Explorer toolbar. The Report Destination window will appear.
Be sure only the Screen option is marked and click OK. After a few
moments, the report will be displayed on the screen.
After you’ve looked at the report, close the Screen Output window. If
necessary, reopen the Report Layout window and make changes to the
report layout. When you’re satisfied with the report, close the Report
Definition window, saving your changes.
Attach a print script to Next you’ll need to provide a way for users to print the report from within
the Inventory_ the Inventory application. To do this, add a print script to the
Maintenance window. Inventory_Maintenance window.
Click Compile to verify and save the script. Click Close to close the Script
Editor window. Close the layout window for the Inventory_Maintenance
window, saving your changes. Close the Form Definition window.
110 Q U I C K S T A R T
C H A P T E R 1 3 C R EA T IN G A R EP O R T
Test the print script. Enter Test Mode and open the Inventory Maintenance window. When you
choose Print from the File menu, the Report Destination window should
appear, allowing you to choose where you want to print the report. Select
Screen or Printer and click OK; the report should print to the location you
specified. If your report printed properly, you’ve successfully re-created the
Inventory sample application.
In this chapter you’ve learned about the different sections of a report and
how to define a graphics report using the Report Definition window.
You’ve also learned how to create a sorting order for a report and how to
change the drawing options for text and graphical items, such as lines,
added to a report.
What to do next
You may want to develop a small Dexterity application on your own to
practice the concepts you learned in this manual. For more information
about specific Dexterity windows, search for the window’s title in the
online help. For more information on specific resources, refer to the chapter
on that resource in Volume 1 of the Dexterity Programmer’s Guide. For
more information about sanScript, refer to Volume 2 of the Dexterity
Programmer’s Guide. For information about specific sanScript commands,
refer to the SanScript Reference and the Function Library Reference.
If you’re developing applications that will link with other products, refer to
the Integration Guide to learn more about the programming standards and
conventions for integrating products. If you’re developing stand-alone
applications, refer to the Dexterity Stand-alone Application Guide. To learn
about the utilities available for Dexterity, refer to the Dexterity Utilities
manual.
Format string size of the list box field when it’s added Modal window
A data “mask” used for string and to the layout window. An integer A window that contains no operating
composite formats. The format string position – not the static text – for the system controls and can’t be resized.
allows extra characters to appear in a corresponding selection in a list box is Modal windows are used when you
field without affecting the way data in stored when the selection is saved to a require the user to perform an action
the field is stored. table. before continuing.
114 Q U I C K S T A R T
G L O S S A R Y
Inventory application (continued) local fields (continued) modal windows, defined 114
Inventory Lookup window 15, 85 creating 56 Modifier, defined 114
Inventory Maintenance window defined 114 mouse symbol 5
14, 58 described 37
Inventory Report, illustration 17, push buttons 56 N
110 local variables new symbol 5
Inventory report, printing 16 defined 114
Main Menu, illustration 14 in scripts 81 P
main window, illustration 55 lookup buttons page footers, described 103
Markup menu creating 92 page headers, described 103
illustration 97 defined 114 page numbers, adding to a report 108
using 16 position 92 palette windows, described 51
opening 10 lookup forms Pathname procedure, described 70
creating, lesson 86-95 physical names
K defined 114 defined 114
Key Definition window 46 described 85 for global fields 38
key segments, defined 114 for fields 95 for tables 44
keyable length, defined 114 opening, based on field definition positioning
keys 95 fields in reports 107
defined 114 returning data from 91 fields in windows 59-60
described 42 using scrolling windows 85 windows 58
for tables 46 Lookup menu item 94 post scripts
illustration 43 defined 114
M described 65
L Main Menu form pre scripts
launching, Dexterity 9 defined 114 defined 114
layout windows, defined 114 described 48 described 65
lessons main tables for reports 104 prerequisites, for learning Dexterity 4
Adding scripts 66-83 main window for forms 51 previewing
Creating a lookup 86-95 manuals, see documentation reports 109
Creating a report 104-111 margin notes 5 windows 58, 61
Creating a table 44-46 Menu Definition window 98 primary windows
Creating data types 26-32 menu items defined 114
Creating dictionaries 22-23 ampersands in names 99 described 51
Creating fields 37-40 defined 114 printing reports 109-110
Creating formats 34-36 disabling 100 procedures (resource), Pathname 70
Creating forms 49-50 enabling 101 product support, for Dexterity 6
Creating menus 98-102 menus programs, see dictionaries
Creating windows 52-63 access keys 99 prompts, linking to fields 62-63
light bulb symbol 5 ampersands in names 99 properties
line tool 61 creating, lesson 98-102 defined 114
linking prompts to fields 62-63 defined 114 for fields 60
list boxes described 97 for lines 61
defined 114 menu items 99 for scrolling windows 88
static values for 29 scripts 99 for text 55
Local Field Definition window 56 shortcut keys 99 for windows 54
local fields modal dialogs, described 51 Properties window 53
adding static text 56
118 Q U I C K S T A R T
I N D E X
120 Q U I C K S T A R T