Desktop Design Form

Description

An Alpha Anywhere User Guide to the Desktop.

Name
Description
A Conditional Object Example

This topic refers to the AlphaSports sample database provided with Alpha Anywhere.

About Forms and Browses

Much of the ease of use and simplicity of Alpha Anywhere comes from the fact that forms and browses are bound to tables or sets. A form allows you to view a single record from a table. A browse displays multiple records. Schematically, they are illustrated below.

Accented Characters

Alpha Anywhere will store and display accented characters in text and memo fields. However, it does not support accented characters in field labels, scripts, and in utilities that process scripts. The best way to put accented characters into labels and onto forms is as bitmaps. The following image shows a button on a form.

Adding Users from the Desktop

All users who login to your web application have to be first registered in the user table. If you have fields other than UserID in the Enter / Edit Web Users dialog, you must first add them to the user table ("mytable") with a conventional desktop form or browse.

Changing Custom Menus and Toolbars at Runtime

At runtime, the custom drop-down and right click menus or toolbars for any of the form modes ( View, Query by Form, and Find by Form ), or for a browse can be dynamically changed by setting the appropriate form or object property. For example, to change the drop down menu for a form called "Customers" to "menu2", you would execute the following Xbasic command:

Circular Tabbing on a Form

In many circumstances you will want to have the cursor return to the first tab stop on a form when the user presses TAB on the last tab stop on a form.

Creating a Maximized Application with a Menu

Many application developers would like to present their software with all traces of Alpha Anywhere hidden and with access to Windows tightly controlled. This example demonstrates a technique using the sample AlphaSports database.

Creating Alpha Anywhere Help Text

This topic refers to the AlphaSports sample database provided with Alpha Anywhere. The following procedure assumes that the developer has opened the form in the Form Editor and has created all the reference scripts. Follow these instructions to create an Alpha Anywhere Help file.

Creating Alpha Anywhere Help Text - AlphaSports

Alpha Anywhere supports three types of help systems:

Creating and Assigning a Startup Form

The term Startup Form refers to the form which automatically appears when a workspace is opened. You can use any form from any table or set as a Startup Form.

Creating and Using a Conditional Object

A conditional object is a multi-level rectangular frame used to conditionally display and hide groups of objects. Conditional objects behave like tabbed objects, except that instead of tabs, each page is automatically selected by Alpha Anywhere based on the expressions you enter. A page is selected when the expression evaluates to TRUE. If no expression evaluates to true, the default page is shown.

Creating Custom Menus

Alpha Anywhere lets you create your own custom menus. You can attach custom menus to forms, browses, and print preview windows. These menus are called drop-down menus. You can also attach custom right-click menus to:

Creating Menu Forms

With Action Scripting, it is very easy to create a main menu form that navigates to the various forms within your application. A good example of a main menu form is found in the AlphaSports sample database.

Creating the InvoiceItemsPie Form

The InvoiceItemsPie form demonstrates the use of the charting capability added to Alpha Anywhere. A SimpleChart ActiveX control allows you to place bar and pie charts onto forms and control their properties with Xbasic. To create a form similar to the InvoiceItemsPie form:

Creating Wallpaper for Your Application

What is "wallpaper" and creating wallpaper:

How to Design a Custom Menu

Covers designing a custom menu, inserting an item in a menu, new menu entries, pre-defined menu items, etc..

Designing an Application for Alpha Anywhere Runtime

When you design an application that you intend to run with the Alpha Anywhere Runtime, you should make sure that you keep the following in mind:

Displaying a Form as a Dialog Box

A dialog box is a window that is displayed to the user. The dialog box typically asks the user for some input. The dialog box is modal, meaning that the user must first close the dialog box before proceeding. There are several techniques in Alpha Anywhere for displaying dialog boxes, such as designing a message box (which uses the UI_MSG_BOX() function), designing an XDialog box (which uses the UI_DLG_BOX() function), or prompting for input (which uses the UI_GET_TEXT() function). Another way in which you can display a dialog box is by opening a form as a dialog box.

Displaying the Main Menu

When you open the Invoice database, Alpha Anywhere automatically displays the main menu. Main Menu is a form based on the Invoice Menu table. You can specify that a particular form in the database is automatically opened when the database is opened with the following procedure.

How to give Desktop Application Forms and Reports Dynamic Internationalization

A developer asked about how you can dynamically change the labels on forms and reports depending on the user's preferred language. This video shows how this is easily done using the dynamic properties feature.

Editing Objects

Before you can change an object's properties, move, resize, or delete it, you must first select it. You select a single object by clicking on it with the Selection tool from the toolbar; you select multiple objects by either holding down the SHIFT key while clicking on each object with the selection tool, or by using the selection tool to draw a rectangle (lasso) around the objects to be selected.

Editing System Menus

You can customize several system menus in Alpha Anywhere. Customizing a system menu is different than defining a custom menu for a form or browse. When you define a custom menu for a form or a browse, just that form or browse uses the customized menu. However, when you customize a system menu, then all forms and browses (including those for which custom menus have not been defined) will use the customized system menu in place of the built-in system menus. To customize the default system menu:

Editing System Toolbars

You can customize the following system toolbars:

Filter Builder

When selecting records for a form, browse, report, mail labels, letters, or when performing operations, Alpha Anywhere uses a filter expression to determine which records to include. Filter Expressions evaluate to a TRUE or FALSE value. as Alpha Anywhere scans through a table, it selects the records where the filter expression evaluates to TRUE; it ignores the records where the filter expression evaluates to FALSE.

Find by Form

The Find by Form dialog box is available on forms only, and lets you type search criteria directly into the same form you are viewing. Find by Form does not filter out records that do not meet your search criteria, or put records in order. It simply displays the next or previous matching record.Find by Form opens a blank record for you to enter search criteria. For example, if you are looking for a record for a person with the last name " Jenkins ," type " Jenkins " in the LASTNAME field.To use Find by Form :

Find by Key

The Find by Key dialog is available in both forms and browses, and lets you find the first record whose key value most closely matches a key value you specify. The Find by Key dialog does not require that you have at least one predefined index. If there are no indexes, it will allow you to search by record number or within a specified field.

Find Text

The Find Text... command displays the Locate dialog box, which is available in both forms and browses. The dialog box lets you find the next or previous record containing the text, number, date, or series of characters you specify. You can keep the dialog open while you work on your form or Browse. When finding text, Alpha Anywhere displays the record and that contains the first match and places the cursor on the field that contains the match.

Follow Changes and Enters

The Follow Changes/Enters function repositions the record pointer when you change or add a key value in the current index. The requirements are that:

Form Editor Control Library

When you are editing a Layout (e.g. Form, Report, etc.), you can select one or more controls and then place them in a 'Control Library' on the Toolbox. Controls in the Control Library can be placed on any Layout. This video shows how you can add controls to the Control Library, and then use controls that you previously added to the Control Library.

Form Events

A form's OnInit event occurs when a form is loaded. On the Customer Information form the OnInit event runs Xbasic code that initializes the display.

Form Headers and Footers

You can now define headers and footers for your Forms. Any content in a header or footer section will always stay on screen even if the form is too large to fit in the current window.

Form Layout - Mouse Cursor Property

You can now set a property for all objects on Form layout to control the mouse cursor when the mouse is over that object. The property can be set using the Dynamic Properties Pane. The property can also be dynamic - so that actual image used for the cursor can be dynamically computed.

Genies

A Genie is a series of dialog boxes that guide you through performing a task. For example in the Control Panel, if you select the New button while on the Forms tab, the New Form genie appears to help you create a new form. Creating a New Form with the Genie:

Linking to a External Help File Topic

There are two different ways the user can retrieve a help topic in a compiled HTML help file (.CHM format) or Windows help file (.HLP format).

Managing Style Properties

When in design mode clicking Stylesheets > Apply or Create a Stylesheet... > Manage Styles displays the Manage Styles dialog box. Below are the various object properties that you can be set in the Manage Styles dialog box. The Preview tab displays the properties of the selected control type.

Methods for Opening Forms and Browses

Using Xbasic you can open a form or a browse layout and you can  control which records are displayed in the layout. You can open forms as regular modeless windows, or as modal windows. Browses can only be opened as modeless windows.

Modal and Modeless Data Entry

Alpha Anywhere gives you three choices for data entry on Forms and Browses: modal, modeless, and parent-modal.

Navigation

In older versions, .fetch_first(), .fetch_prev(), .fetch_next() and .fetch_last() all navigate at the level of the top table in the Form (i.e. the parent table of the Set on which the Form is based). This means that if a user included fields from child one-to-many tables on the Form (but did not include an embedded browse for the one-to-many child table), there was no way to easily navigate the records in the one-to-many child tables. Version 10 added support for an optional 'table' parameter to all the .fetch_*() functions. This allows navigation of a specified child table. You can also use the special psuedo-table called '' to navigate through records in the currently selected table.

Object Explorer

Clicking View > Object Explorer when a Layout window (e.g. Form, Report, Label, Letter, Browse) has focus (in either run, or design mode) displays the Object Explorer window. This utility allows to you identify the components of a layout and examine all of their properties.

OnKey Events on Forms

Handling key events, macro recorder example, and an application help example.

Placing a Conditional Object

A conditional object is a multi-level rectangular frame used to conditionally display and hide groups of objects. Conditional objects behave like tabbed subforms, except that instead of tabs, the object has multiple layers, which appear and disappear based on the expressions you enter. A layer appears when its expression evaluates to TRUE. If no expression evaluates to true, the default layer appears.

Placing a Control on a Form

For specific instructions, refer to:

Placing Bitmaps on a Form

You can place images directly on a Form, Report, Letter, or Label layout. For example, you can insert your company logo on a Letter layout to give the Letter a more professional look. To place an image on a form:

Placing Hotspots

The placement of a hotspot on a form invokes the Button Genie. A hot spot is like a transparent button; when you click on it, a script is executed. When you move your cursor over a hot spot, the mouse pointer changes to a hand. You might place a hot spot over an image to give it an OnClick event. Or you could use a hot spot as a hidden control about which only you, the developer, knows. To create a Hotspot object:

Placing Hyperlinks, Mail-to Links, and FTP Links on a Form

There are two easy ways to put hyperlinks, mail-to links, and FTP links on a form.

Placing Lines and Frames

Lines and frames can make layouts more visually appealing and easier to read. Tools for creating these objects can be found on the Toolbox , discussed earlier in this chapter. For more information on using these tools, refer to the following subsections.

Placing Subforms

A subform is a form placed inside another form. By using a subform, you can fit more objects into a smaller area, without making the form illegible. For example, you have an invoice form in which you want to place information about the customer in the upper right corner. When you view an invoice-record, you want to see, at a glance, the invoice's billing information. In addition, you want to ability to see other data, such as the invoice's shipping information, but you do not want to overcrowd the Form. One solution is to use subforms.

Prompting for User Input

When you use variables in an expression, you can use a special type of variable that prompts you for a value when the expression is evaluated. These variables, called Ask variables, can be used just like any other variable. When Alpha Anywhere encounters an Ask variable, an input dialog box appears requesting that you type in a value. The expression result will depend upon the value you enter. The outcome of a query, the filter expression for an export, and the value of an update expression are all examples of operations and expressions which can be based on an Ask variable.

Put a Button on a Form to Open Another Form Showing Selected Records

This example shows how you can put a button on a form that will open another form and show a selected record. Your database should contain a form called "CustomerFormCompact," which shows the customer's address (as shown below) in a rich text object. This object is not editable. So you cannot change the customer's address on this form. You will put a button on the form to open another form (called "CustomerEdit," which has been pre-created for you) where you can edit the address.

Put a Button on a Form to Send a Customized Email

This lesson demonstrates how you can use Action Script to send out a customized email message. The goal is to send an email message to a customer asking it to confirm that its correct address.

Desktop Queries

An Alpha Anywhere User Guide to the Desktop.

Querying and Sorting Child Tables on a Form

Assume you have a set with a one-many link, as shown below:

Quick Import for a Form or Browse

A new option the the Records menu for a Form or Browse allows you to import data from an Excel file or a comma delimited ascii file directly into the current table (i.e. the table that the open Browse or Form is based on). The file you are importing must have field names in the first row that match field names in the current record.

Reading From and Writing to the Data Dictionary

Alpha Anywhere's data dictionaries are actually tables; you can manipulate them just like any other table. To access the data dictionary of the current table or set directly, you can use the DICTIONARY.OPEN() method to obtain an object pointer to the dictionary.

Relative Addresses

Some examples and descriptions of relative addresses.

Running a Script with a Function Key

You can use the OnKey event to trap any keystroke and run a script. For example, the following code on the OnKey event will trap the F2 key and run a user defined function.

Sales_People Form

The Sales_People form illustrates how you can have a Windows Bitmap (.BMP) or JPEG (.JPG) image field in a table, just as you would have a text or numeric field.

Selecting and Opening a Form

This example provides a script that you can place under the OnPush event of a button on a form. It displays a list of other forms in your database. After you select another form and click OK, the script closes the current form and opens the selected form.

Selecting the Appropriate View of Your Data

Alpha Anywhere uses form and browse layouts for entering and reviewing information stored in tables and sets. Each layout provides different features and tools for editing data. In Form View, you typically work with one record at a time. A form is a window containing fields from the table, and field values for the particular record you are viewing. In the example below, the form displays one record, which corresponds to a single row of data from a table. Each table and set has at least one form called the Default Form. The Default Form contains every field in the table or set. Form View:

Setting Form Properties

The Form Properties dialog box lets you set these form properties:

Setting Form Restrictions

A list of the types of form restrictions that you can set.

Setting the Tab Order

The tab order controls the order in which the cursor moves on the form between fields, buttons, tabbed controls, and browse objects. By default, the tab order is set so that the cursor moves from object-to-object in the order in which they were placed. There two ways to set the tab order: by Example or by Table.

Settings

Clicking View > Settings displays the Settings dialog box. This dialog box allows you to set many preferences that affect the way that Alpha Anywhere operates. A_Viewsettings.Dbf, which you may want to distribute with an application, contains a cases of the definitions for the panes on the dialog.

Specifying a Window

You can specify which window you want to operate on in one of two ways:

Startup Form Design Examples

While there are no limitations to which form is the Startup Form, often the Startup Form is designed specifically to introduce your application, present a main menu, or limit access to the rest of the application by means of a password-protected button.

Synchronizing Form and Embedded Browse Record Navigation

When you place an embedded browse on a form, you will discover that clicking the Next Record and Previous Record icons on the toolbar produce different results, depending on whether the form or the embedded browse has focus.

The Customer Information Form

The Customer Information form provides the user with a way to add, edit, and delete customer records. The form demonstrates the following controls and techniques.

The CustQueryReport Form

The CustQueryReport form provides the user with methods for querying and selecting records for printing.

The Edit_Customer_Info Form

The Edit_Customer_Info form provides a basis for several illustrations of the use of Action Scripting to filter the records that a form will display. Each of the following four procedures execute their queries when buttons are clicked.

The Inventory Form

The Inventory form is based on the Invoice set, which maintains a parent-child relationship between the Product and Vendor tables, as illustrated below:

The Invoice Form

The Invoice form demonstrates the following controls and techniques:

The InvoiceItemsPie Form

The InvoiceItemsPie form demonstrates the use of the charting capability. A SimpleChart ActiveX control allows you to place bar and pie charts onto forms and control their properties with Xbasic.

The InvoiceReportMenu Form

The InvoiceReportMenu form presents the user with a variety of choices for printing invoices. The RADIO1 option button stores a value into a form variable named option. The conditional object COND1 responds to the change of the value of option by displaying one of four pages. Each page captures user input and stores it in one or more form variables.

The Items Form

The Items form allows the operator to enter a new item record. However, the operator should only use the form when the number of the parent invoice is known.

The Main Menu Form

The Menu Menu form illustrates two types of menuing techniques and the recommended architectural approach for attaching scripts to buttons.

The Vendors Form

The Vendors, Details, and Products tabs of the Vendors form each display a selection of fields from the Vendors set. Because the records are coming from a set, which links the data from the Vendor and Product tables, selecting a record in the browse on the Vendor tab automatically displays the appropriate records on the Details and Products and tabs.

The Window Bar

An optional Window Bar appears at the bottom of the Alpha Anywhere screen.

Understanding Levels in a Form

If a form is based on a set, and has one or more embedded forms or browses, then when you perform an action on a record in that form, you need to specify which record on the form you want to manipulate. The actions that you can perform on a record include:

Using a Dialog as a Search Form

Assume you have a grid that shows all the records of a table, such as the following.

Using a Form

Covers opening an existing form, opening the default form, navigating within a form, record selector, form status bar, and more.

Using the Form Editor

Form design overview and using the form editor.

Using the Navigator

The Navigator is a modeless dialog box that displays all the fields on a form or browse in a tree control. With the Navigator you can instantly navigate to any field on the form or browse. To use the Navigator while in a form or browse:

Using the New Form Genie

When you create a new form for a table or set, the New Form Genie lets you create customized form layouts in a fraction of the time that it would take to manually layout out a new form. The New Form Genie lets you: