Xdialog

Description

Guides relating to Xdialog.

Name
Description
A Genie Style Dialog with Tabs

This script shows how you can create a Genie style Xdialog that also has tabs allowing quick access to individual pages of the Genie.

A Simple Owner-Draw List Box

In this example, we will add a bitmap to the entries in an array. First consider the following simple dialog box that displays a list box of drive letters. This dialog does not display bitmaps in the list box.

A Tutorial in Xdialog

A dialog, or dialog box, is used throughout Windows programs to interact with the user. A dialog can be used to gather information from the user, or to present information to users. Xdialog is an extremely powerful and flexible language for describing a standard Windows dialog box. In fact, testament to the power and flexibility of Xdialog is the fact that much of what's new in Alpha Anywhere is written using Xdialog.

Accelerator Keys

You may create an accelerator key by placing an ampersand "&" before a character in a text label or in the name of a pane or frame. Pressing ALT and the indicated key moves focus to the control.

Action Scripting - Xdialog Genie

The Xdialog Genie in Action scripting has several powerful new controls.

Adding a Mask to an Xdialog Field

If you would like to add a mask that formats a field, the following script provides a template. The mask is applied when the user changes focus from (or leaves) the text field.

Adding Help To a Dialog Box

You can add pop-up help to a dialog box using the {Help} command. The pop-up help is accessed from a standard Windows help file (.hlp or .chm). You need a third party product, such as RoboHelp? to create Windows help files. The pop-up help is displayed when the user presses the F1 key. The pop-up help can also be displayed when the user presses a button on your dialog.

Adding Right-Click Context Menus

The following example shows how to respond to right click events.

Address Dialog - Adding Blank Lines

To space out the vertical distance between controls on an Xdialog, you can insert blank lines using the '{lf};' command. This is analogous to pressing Enter on a blank line in a word processor to leave extra space between paragraphs.

Address Dialog - Column Formatting

Just as one would use the tab character in a word processor to line up columns of data, one would use the '|' directive in an Xdialog box to line up columns of controls. The following dialog looks ugly because the edit controls do not line up. There is a simple mechanism in UI_DLG_BOX()that is designed specifically for this - columns. Column boundaries are specified by a ?|' character, and should be added between controls you want to line up vertically: For example, consider the following dialog box:

Address Dialog - Margins

Margins are controlled with the {xmargin=} and {ymargin=} commands which specify the right/left margins of the dialog box, and the top/bottom margins of the dialog box. The syntax for commands is:

Address Dialog - Spacing of Controls

The spacing of controls on a dialog is controlled by the height and width of a "standard" row and column. The size of this "standard" row and column is, in turn, controlled by the default font used for static text on the dialog. Using the {Ysize=} and {Xsize=} commands, you can alter the spacing of controls on a dialog. The syntax for these commands is:

ADO/ODBC Form Genie

The ADO/ODBC Form Genie creates an Xdialog dialog box that can be used to read, write, and browse through ADO and ODBC compliant databases. The form is highly customizable and can be displayed in traditional browse and form formats, as well as a new hybrid format, called a repeating form.

ADO Record Set Genie

The ADO Record Set Genie allows you to create an Xdialog form that is bound to an ADO data source. The Xdialog form will allow you to view, edit, delete, and enter records. The genie is available while the Code Editor is open. Select Code > More Genies > ADO Record Set to display the ADO Genie. The genie leads you through the process of:

Advanced Formatting Dialog Box

Background color tab, columns tab, fonts tab, row numbering.

Advanced Text Properties Dialog

You use the Advanced Text Properties dialog to define a sequence of statements that will display text, data, buttons, or images.

Anchor Buttons - Exact Positioning of Buttons

This example uses the {A} and {T} to define anchor points and their horizontal locations to exactly position buttons. The button statement O={@@} says that the formatting is embedded. The button statement B=M says that the button has a standard format with raised edges.

ASK Variables

When you use variables in an expression, you can use a special type of variable that asks you for its value when the expression is evaluated. These variables, called ASK variables, can be used just like any other variable. When Alpha Anywhere encounters the 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, or the value of an update expression are all examples of operations and expressions which can be based on an ASK variable.

Auto-Advance to Next Control When Current Control is Full

The Text "+" directive causes the cursor to advance to the next control when the current control is full. In the case of the state text control below, the "2" in [%+%2.3state] defines the maximum number of characters that the control will accept.

Auto-Selecting Text in a Text Box

By default, when a user tabs into a text box on a dialog, the existing text in the text box (if any) is not selected. You can specify that the existing text should be selected. This allows the user to easily overwrite the text when they type the first character of a new entry.

Bar Graph

This example shows how to use the Microsoft Office Chart ActiveX Control.

Building Connection Strings

Load a default value for the connection string.

Calling the Generic Find/Replace/Goto Dialog Box

This script illustrates how to use the A5_GENERICSEARCHREPLACE() function with the contents of a text box. The beginning of the script defines the title of the dialog box and the text that it will display. Note that the text is placed into .text sub-element of the ptext pointer variable.

Cell Spillover

In the examples that we have looked at so far, Alpha Anywhere does not make any attempt to use space in adjoining cells, if those cells are unoccupied. In certain circumstances it might be advantageous to make Alpha Anywhere do this. For example, consider the following script, which has been decomposed into cells. In this example, cell spillover is turned off (the default mode for all Xdialog dialog boxes). Because the text description in the first row is so long, the first column must be widened to make room for the whole string. The cell to the right of the text string, however, is empty, and could be used as overflow space for the text string.

Closing Modeless Dialog Boxes Automatically

In some situations, when you open a modeless Xdialog box from a button or command on a form or browse, you will want the Xdialog box to close automatically when its "parent" form or browse is closes, or looses focus.

Xbasic Code Library

The Xbasic Code Library is a dockable toolbar that stores and organizes an unlimited number of Xbasic and Xdialog code snippets, retrieving and inserting them into your project with just a couple of keystrokes. To display the Code Library :

Colored Dynamic Text

Unlike the example in the Colored Static Text topic, the color for the text to be displayed in the dialog is contained in the variable font_color. The background color is also determined by a variable, background_color, but it is hard coded to "Win3d".

Colored Static Text

This example shows how to use the Static Text O Directive. The {F} operator specifies font, size, and style. The {B} operator specifies background color. The {C} operator specifies foreground color. The {I} operator inserts an image.

Column Mapping Dialog

The Column Mapping dialog allows you to specify whether the values used in a SQL INSERT statement will come from a:

Computing the Size of an Embedded Dialog

This script demonstrates how the size of a parent dialog box can be automatically calculated with the UI_INFO_DLG_DEF_CLIENT_HEIGHT()and UI_INFO_DLG_DEF_CLIENT_WIDTH()functions so that the embedded dialog box that it contains can be displayed correctly, without clipping any portion of the embedded dialog box. This statement creates some content for the embedded list box.

Conditional Expression Builder

The Conditional Expression Builder allows you to associate an expression that references one or more fields in the table with a display statement (in Xdialog syntax) that may contain static text, text computed from table fields, any type of font formatting, buttons, and images. You compose the display statement interactively. You have have multiple expressions that apply different display statements for different conditions. Alpha Anywhere uses the first condition that satisfies the expression and ignores any other conditions that may also satisfy the expression. For example, if you have the following expressions and the lastname field contains the value "Pierce".

Conditionally Disabling Controls

It is a common requirement on a dialog to control whether certain dialog controls are grayed out (i.e. disabled) if a certain condition is true. For example, you may not want to let the user click the OK button if they have not correctly filled in the dialog. Alpha Anywhere allows you to disable controls on the dialog using the '?' character inside the specification for a control. You include a logical expression after the '?'. If the expression is .T. then the control is enabled. If the expression is .F., the control is displayed as grayed out. For example, the following dialog disables the OK button if the Filename text box has not been filled in:

Conditionally Displaying Panes on a Tab Control

The panes in a tab control can be turned on and off, depending on whether a condition is true. To conditionally show a pane in a tab control, use the following syntax for the tab control:

Conditionally Replacing controls

In the preceding example we saw that the space that would have been taken up by controls that are conditionally displayed is taken up even if the controls are not displayed. In certain circumstances, you may want to replace one set of controls with another set of controls, depending on the value of a conditional expression. The {start_pos} command can be used to reset the starting position of the current cell to the top-left of the previous cell. The syntax for the command is:

Controlling Insertion Point and Selected Text in a Text Object

This example shows how you can control the insertion point and selected text in a text control on an Xdialog box. Normally, when you place a text control on an Xdialog box, you bind the control to a character variable. For example:

Controlling the Font of Static Text

You can set the font of static text on a dialog using the {font=} command. After changing the font, the size of a character column changes to the new font's representation of a column. The syntax of the {font=} command is:

Controlling the Layout of Controls

This lesson discusses the various commands and techniques that you can use to control the layout of your dialog boxes.

More on Controlling the Layout of Dialogs

This lesson presents additional commands and techniques that you can use to control the layout of your dialog boxes.

Controls in Xdialog

Pages about Xdialog Controls.

Creating a Genie Dialog Box

This next example shows how a "genie" dialog can be created.

Customer Information Input

This topic describes the process of creating a property sheet that accepts user input into a series of variables.

Customize Xdialog Genie Dialog Boxes

Alpha Anywhere provides a powerful tool for developers who use Action Scripting to create Xdialogs. When you create an Xdialog with Action Scripting, you now have the ability to modify the Xdialog design in a way completely compatible with Action Scripting. In other words, you can change the design of the dialog box without compromising the ability to edit or reprocess the Action Script.

Define Choices Dialog Box

The simple steps used to define the Choices Dialog:

Define Parameters Dialog Box

The Define Parameters dialog allows you to define Parameters (i.e. variables), whose value will be prompted for at run-time. For example, you might define a parameter called which_state, and then you could define a filter expression as:

Define Picture Dialog Box

The steps involved in defining a picture dialog box.

Define Text Dialog Box

Steps from defining a text dialog box.

Define Variable Dialog Box

The Variable Definition dialog box is available when defining a table or a layout. Use this dialog to define local, session, or global variables that you want to be visible to a table (and its layouts) or just a layout (form, browse, report, letter, or label).

Deriving the Font to Use Dynamically

The following example demonstrates some additional aspects of owner-draw strings. This example displays a list of font names. The entries in the list box are each displayed in the font specified by the entry name.

Dialog Box for User Sign-in

The following Xdialog script was submitted by Tom Henkel, Senior Systems Analyst Bergen County Board of Social Services. This sample is part of the code used to control access to a large (300+ user) network of Alpha Anywhere users.

Dialog Boxes

Dialog boxes are common in Windows and other software applications, and are typically used for either displaying information, or eliciting a response from a user.

Display an Xdialog Box

Procedure for displaying an xdialog box:

Display Xdialog Form based on ADO/ODBC Data

Many applications require a view of external data contained in ADO or ODBC compliant databases. The Display Xdialog Form based on ADO/ODBC Data action allows you to quickly build a dialog box that reads and displays data from compliant databases, such as MySQL, Oracle, and Microsoft Access.

Displaying Data from a Pointer Array in a Dialog Box

Assume that you want to display a list box showing the company names in a array. To do this, the syntax for the list box would be:

Displaying Data in Columns

In lesson 8 we saw how a tabbed list box could be used to display data in columns. The following example shows another approach. This approach may be slightly more verbose, but it gives you extremely fine control over how the data is lined up, and ultimately, it is probably easier to understand.

Displaying Dynamic Help When Clicking on a Label

Create 'hot labels' in Xdialog boxes. When the mouse is over the label, the label is underlined, indicating that the label can be clicked. When you click the label, a popup window appears, in which you can define help. Use HTML syntax to create beautifully formatted help. Even use a CSS style sheet to define a consistent look.

Displaying Time Variables

The following example uses the F directive within a Text Box control to format and display date and time values.

Drive Select Dialog Box

The following script displays a list of disk drives on your computer.

Dynamic Dialog Box Titles

It is possible to dynamically change the title of an Xdialog. First, we use indirection to title the dialog box "Fred".

Edit Variable Dialog Box

Steps for editing variable dialog box.

Embedded Dialog Boxes

Xdialog allows you to embed one dialog inside another dialog box. This is a very powerful concept because it allows you to create extremely complex dialog boxes using a very modular approach. The Settings dialog in Alpha Anywhere (accessed by selecting View > Settings from the menu) is an example of an Xdialog box that relies on embedded dialog boxes. Explaining how embedded dialog boxes work is easiest by looking at a working example. Consider the following script:

Embedded HTML in Xdialog

It is easy to embed HTML into Xdialog. You can simply use the {html}, or {htmlIE} command, rather than defining and placing the Internet Explorer ActiveX control in your Xdialog.

Examples on Disk

All of the examples presented in this book are available on disk. In the "Learning Xdialog" folder off your main Alpha Anywhere program folder, you will find the "Learning Xdialog" database. Open this database. The main menu appears where you can select the scripts. Of course, this main menu is itself a dialog box created using Xdialog.

Explorer Style Dialog Box

A description and example on how to use the explorer style dialog box.

Font Dialog

The Font Dialog allows you specify a font face, point size, and font attributes. In addition, it allows you to specify an expression that will return alternative font specifications, depending on other conditions.

Frames

Often, to make your dialog look better, and to divide your dialog into different logical sections, you will want to add frames around controls on the dialog, and you will want to insert vertical and horizontal lines. The command to insert a frame is {Frame}. The syntax for the command is:

Hanging Indents

This example shows how to format text with a hanging indent. The left margin is defined by the position of the first character after the {' sequence.

How to trap mouse events in an xdialog

This example demonstrates how to trap mouse events in an xdialog using a user defined xdialog control.

How to Use Parameters or Variables in a Query Expression

A variable and a parameter are the same thing. A parameter is just an Alpha Anywhere variable whose value is prompted for at run-time.

HTML Editor Style Xdialog Example

The Xdialog Genie supports an HTML ActiveX control, which adds the ability to display an HTML page within an Xdialog form. Within the Action Scripting Editor, select "Dialog Boxes" and "Display an Xdialog Box".

HtmlHost Example 1: Hosting Xdialog Controls

The new {htmlhost} control differs from the {html} control in that it can host Xdialog controls.

HtmlHost Example 2: Vertical Sizer

A vertical sizer can be created in an htmlhost area by adding a div that has the following attributes defined:

HtmlHost Example 3: Horizontal Sizer

Like the Vertical Sizer, a5:target, a5:target_elem and a5:target_adjust must be defined. In addition to these, it is important to note that in the enclosing DIV style of "height:100%; flow:horizontal;", the flow:horizontal; portion causes the enclosed divs to flow left to right instead of top to bottom as they normally would.

HtmlHost Example 5: Dynamically styled Html (a5:style tag)

Similar to conditional expressions, enable/disable and show/hide expressions , a5:style allows the style of an htmlhost tag to be a calculated value. In this example, which is an adaptation of the first example, we cause changes to the color that is selected from the color list to be used as the background color for the last column in the HTML table. Also, a checkbox has been added to toggle the visibility of the firstname and lastname embedded controls.

HtmlHost Xdialog command

Similar to conditional expressions, enable/disable and show/hide expressions , a5:style allows the style of an htmlhost tag to be a calculated value.

Insert Image Dialog Box

You can display the Insert Image dialog box at any time by running A5_PROMPT_FOR_IMAGENAME().

Internet Browser Style Xdialog Example

Within the Action Scripting Editor, select "Dialog Boxes" and "Display an Xdialog Box".

Introduction

Welcome to the Alpha Anywhere Tutorial. This book provides lessons to introduce you to the major desktop features and functions of Alpha Anywhere, and helps new users get started using Alpha Anywhere. This chapter provides an overview of Alpha Anywhere and some of its major features, and some important preliminary steps to take before you begin the lessons. It also tells you how to access Alpha Software resources, such as Documentation, web sites, and technical support.

Introduction to Dialog Box Events

Up to this point, the dialogs that we have discussed have not included any event processing. An understanding of how to process dialog events is essential if you want to create dialogs that behave in ways that are customized to work just the way you want. For example, using event processing, you could validate data in a control on a dialog, or you could change the value in variables, or arrays that are displayed by the dialog.

Keeping a Dialog Open after Processing Events

If, after the event_handling_code has processed an event generated by the dialog box, the a_dlg_button variable is set to a NULL value, the dialog is kept open. If a_dlg_button is set to any non-null value, the dialog is closed and the value in a_dlg_button is returned by the UI_DLG_BOX()function.

Lines

Lines are similar to frames, except that one of the dimensions for rows or columns is set to zero. The syntax for a horizontal line is:

Linking Modeless Dialogs

The following script demonstrates usage of the {linked=} command which is designed to create external dependencies between separate Xdialogs. Change a shared variable in one dialog, and not only do the variables refresh for the Xdialog with focus, but they also change in the linked Xdialog. The linked command is not directional -- i.e. which Xdialog has the linked command makes no difference -- theonly requirement is that the linked to Xdialog exist before the linked from Xdialog 'is created. This is "Dialog1". Any shared variables that are changed in this dialog are immediately seen by "Dialog2". Similarly, any variables that are changed in "Dialog2" are immediately seen by this dialog.

ListView Control - A Simplified Syntax

Xdialogs have been able do display the standard windows ListView control for some time now. Now, a new simplified syntax is available to make it easier to use a ListView control in an Xdialog. The following script shows an example:

ListView Control on MDI Xdialog

This Xdialog box script displays a MDI child window with a List View control in it. The script assumes that you have created a toolbar named MDI_test, and a menu named MDI_test.

ListView with Progressive Lookup

The designer created this dialog with the List View Genie.

ListView with Static Content

The designer created this dialog with the List View Genie.

Manage Favorites Dialog Box

Selecting Scripts > Manage Favorites displays the Manage Favorites dialog box. This utility lets you add and remove scripts from your Favorites list (which appears under the Scripts menu), as well as specify different toolbar layout options. The Favorites list of scripts appears when you run the Display Script Favorites Pick-List action.

MDI Xdialog Framework

You can take advantage of a technique for creating MDI Xdialogs. Refer to the sample 'Learning Xdialog' database that ships with Alpha Anywhere and refer to the 'mdi_xdialog_frameworkV8' script. The main difference between the new technique, and the technique described here is that in the new technique, a 'context' is established and the menu and toolbar are instantiated in that 'context'. This is done in the Xdialog's OnInit event. It is no longer necessary to instantiate the menus and toolbars in the onactivate event and then destroy them in the ondeactivate event.

Modeless Dialog Boxes

A modeless Xdialog differs from a modal dialog box in that you can leave the dialog box open while continuing to work on other parts of Alpha Anywhere. Up till now, all of the examples in this book have been for modal dialog boxes. Throughout Alpha Anywhere itself, we use modeless Xdialog boxes extensively. For example, the Query Genie, the Find by Key dialog, and the Index Selector are all modeless dialog boxes. The syntax for modeless dialog boxes is virtually identical to the syntax for modal dialog boxes. The only difference is that the command to display a modeless dialog box is:

Xdialog - Modifying Xdialogs at Run-time Before the Xdialog is Rendered

The layout of an Xdialog is defined by a string variable. This makes it easy to write an Xbasic script that generates an Xdialog, or modifies one before it is rendered. Two new Xdialog commands make creating dynamic Xdialogs even easier.

Move to Next Control on ENTER

This script shows a simple method that advances the cursor to the next field on a form when the user clicks ENTER. This is a simple Xdialog with multiple text fields.

Multi-Column List Box

By including the %C=column width% directive in the definition of the list box control, you can specify that the list box should be displayed in multiple columns. For example, the following specifies a list box control that has 3 columns, each 30 characters wide (the list box width is 90 characters).

Multi-line and Word-wrapped Text Boxes

To create a multi-line, word-wrapped text box control, you use the %M% format option. To create a multi-line, word-wrapped text box control that accepts the Enter key, use the %MW% formatting option. If you do not use the 'W' in the formatting string, the Enter key will select the default button on the dialog. The following dialog displays multi-line, word-wrapped text boxes, one of which accepts the Enter key to move to a new line.

Multiple Instances of a Modeless Dialog Box

This script demonstrates how it is possible to launch multiple instances of the same modeless Xdialog box. When you run a script that displays an Xdialog box twice, the second instance simply replaces the existing Xdialog box, and you only end up with one open instance of the Xdialog box.

Multiple Selection List Style Xdialog

To create a property-sheet style Xdialog.

Opening a Dialog Box

Standard forms that are opened as Dialog boxes.

Owner Draw O Directive Command Summary

The following table summarizes all of the owner-draw string commands:

ListBoxes - Owner-Draw HTML ListBoxes

You can now use HTML in a standard Xdialog Listbox. To use HTML, you use the 'HTML' directive in the Listbox definition.

Primary Index or Query Dialog Box - User Manual

Clicking Query > Select Index/Query displays the Primary Index or Query dialog box. The Index/Query Lists tab lists the defined indexes and last four queries run. as you select each index, Alpha Five displays its key expression (Order) and associated filter criteria (Filter).

Property-Grid Style Dialog

To create a property-grid style Xdialog.

Property-Sheet Style Dialog

To create a property-sheet style Xdialog.

Reading Variables in External Modeless Xdialogs

This example shows how a variable in another modeless Xdialog can be read using the UI_DLG_EVAL()and UI_DLG_EVAL_VALID() functions. First, display the "test" modeless dialog box with a variable.

Regions

It is convenient to be able to nest table formats. This allows you to divide a cell into a sub-table. It is also convenient to take multiple cells and to group them together so that they act as if they were a single cell. This is achieved with the {Region} {Endregion} command pair. All cells enclosed by the {Region} {Endregion} command are treated as a single cell.

Resizable List Box Columns

Descriptions and an example on resizable list box columns.

Returning Multiple Values from an Xdialog

Users of Action Scripting can create an Xdialog window that creates and sets the values of multiple variables. For example:

Rollup Modeless Dialog Boxes

The following example shows how to create a modeless dialog that can be rolled up to occupy less screen space. This type of dialog box is frequently used for toolboxes. First define the two variations of the <<%dlg%...%dlg% code for dialog boxes, using the same button names.

Setting the Initial Focus

By default the control that has focus when a dialog is opened is the first control on the dialog, however, you may specify a different control. The {initial_focus} command is used to do this. Here is an example where the third edit control in this dialog box gets the initial focus:

Simple Edit Control

To create an edit control (also called a "text box") on a dialog box, use the '[' and ']' delimiters. The syntax for a text object is:

Simple Embedded Dialog Box

This example creates a dialog box named "Embedded" with a second dialog box named "frame1" inside it. The second dialog box does nothing more than to display some text.

Simple Modeless Dialog Box

The following example displays a modeless dialog. The dialog is "modeless" because it does not require you to close it, before switching focus to another window. as a result, the dialog box can remain open for an arbitrary amount of time.

Smart Field Controls

Alpha Anywhere allows you to define your own smart fields, which look at drop-down edit combo boxes.

Smart Fields in Xdialogs

The following script creates a dialog with several smart fields:

Specifying Colors

Alpha Anywhere provides extremely fine control over colors when you set the properties of object on layouts, or when you specify a color in an Xdialog form.

Specifying the Font

In this example we will show how font owner-draw specifications can be used to control the font of the data in a list box.

Specifying the Font Color

In this next example, we show how you can control the font color for the text in the list box. The owner draw specification for controlling the font color is:

Specifying the Row Background Color

In this next example, we show how you can control the row color for each row in a list box. The owner draw specification for controlling the row background color is:

Static Text Genie

The Static Text Genie makes the process of creating sophisticated and attractive Xdialog forms easier, faster, and more reliable. The Static Text Genie generates properly formatted Xdialog code for static text. The genie provides:

Stretchable Windows with Resizable Regions

This script demonstrates how to use the {STRETCH}, {STICKTO}, {HSLIDER}, and {VSLIDER} commands to create a dialog and regions within it that stretch both horizontally and vertically.

Support for Hotspots on Images

You can define image maps for images that are displayed on an Xdialog with the {image} command. The image map defines rectangular areas on the image, the icon to use when the mouse is over the defined area and the event name to fire when the user clicks on the defined area. In the sample shown below the image map has four defined areas. If the user moves the mouse and clicks on one of the squares in the image, the 'value' variable will be updated to reflect the name of the square the user clicked on and displayed in the input area.

Text Box Formatting Codes

The following table summarizes the formatting options for text boxes. Some of these codes turn the text box into a "smart" field. A smart field has an icon at the right edge of the text box. When the user clicks on the icon, a pop-up window helps the user fill in a value into the text box. Other of the formatting codes transform the text box into a special kind of text box. The formatting options are:

The Code Editor Control

You can turn a standard text box control into a Xbasic Code Editor using the %L% formatting code. You should define column and row dimensions for the text box that are large enough to display a reasonable size code editor. Here is an example dialog with an embedded code editor.

The Help Command

The syntax, descriptions, and examples that describe how to use the help command.

Transforming Data in a List Box

The owner-draw string can be used to transform the data that is displayed in a list box. For example, consider the following list box, which displays a list of names. The input data consists of data in the format 'lastname, firstname'. We want to number the rows in the list box and display the data in the format 'firstname lastname'.

Un-Dimmed Variables Dialog Box

When in the Code Editor clicking Code > Find Un-DIMmed Variables displays the Undimmed Variables dialog box. This useful utility will search for variables that have not been dimensioned. The Context tab at the bottom of the screen shows the line that first references the variable. You can set the scope of the variable by clicking one of the radio buttons in the Scope group, then DIM it by clicking one of the seven buttons at the center of the screen.

Understanding the Grid Nature of a Dialog Box

While Xdialog does a pretty good job of spacing out the controls you define in a logical way, you will typically want to tweak the default layout of a dialog box. The controls on an Xdialog are laid out in much the same way as text is laid out in a document that you create on your word processor (actually a word processor that does not have automatic word-wrap). In a word processor, the characters appear on the line, starting at the left and moving to the right until you press Enter to move to the next line (remember, we are talking about a pretty lame word processor that does not have an automatic word-wrap feature). Then, text appears on the next line until you press Enter to move to the third line and so on. You can line up columns of text in your word processor by using the Tab key.

Understanding the Owner-Draw Operators

The power of owner-draw strings is based on the special operators that an owner-draw string can contain. Some of these commands are introduced here. See Summary of Owner-Draw Commands below for a full list. The '@' operator is the 'text select' operator. It selects text from the input value (i.e. from the list of entries that are to be displayed by the list box). The @ operator is followed immediately by a starting position and an optional ending position. For example, {@1,10} specifies that the list box should display the first 10 characters of the input value. {@5,10} specifies that the list box should display character 5 through 10 of the input value. The '@' operator can also be used in conjunction with the '$' and '#' operator (discussed below).

User-Defined Popup Help in Xdialog

The new a5_showPopupHelp() makes it very easy to put help buttons on an Xdialog that the user can click for additional help. The help can be defined using Xdialog or HTML. (See example in Learning Xdialog.)

Using Crystal Reports with Alpha Anywhere

Some users have expressed an interest in incorporating Crystal Reports into an Alpha Anywhere application.

Using Events to Modify Arrays used in Dialog Box Controls

The following example displays a dialog with two list boxes, 'AvailableCities' and 'SelectedCities'. The buttons on the dialog allow the user to select from the list of available cities and place them in the selected cities list. The Up and Down buttons allow the user to change the order of the cities in the list.

Using HTML in an Xdialog

Xdialog is a very good way to display data to a user, and to collect data from a user. Xdialog's display options, however, do not give you the full richness of HTML. This topic shows you how you can combine the best of Xdialog and HTML to create beautiful, dynamic dialog boxes.

Using Images from External Files

Here is an example showing how to use images from external files.

Using the KillFocus Event

The following script prompts the user for their name. It automatically capitalizes the first character of the name, and puts the rest of the name in lower case when the user exits from the control. It also formats the telephone number. When the user exits a control the killfocus event is generated. The event handling code for this script traps the killfocus event, and formats the text in the text box:

Using the Kodak Image Control

The picture below shows a JPEG image scaled to width in a Kodak ActiveX Image Edit Control on a Alpha Anywhere form.

Using Xdialog to Filter a Report

The following example shows the use of a multi-select list box with embedded check boxes with the AlphaSports sample database. It allows the operator to select multiple values from the BILL_CITY field, then uses this information to filter the fields that will appear on a report. The Xdialog form looks like this.

Using Xdialog to Prompt for Variables

The "Prompt for Text" Action and the "Prompt using Radio Button Dialog" Actions (under the "Dialog Boxes" category) are used to prompt for character variables. Alpha Anywhere contains a special programming language called Xdialog that is specifically designed for creating rich dialog boxes. Xdialog is a superset of Xbasic. A full discussion of Xdialog is beyond the scope of this book. For details on Xdialog, see Learning Xdialog. Action Scripting however, offers an Action that allows you to create simple Xdialog boxes that prompt for multiple variables in a single dialog box. In this lesson, we'll create a dialog box that looks like this: Picture

Web Browser Window

The Web Browser window allows you to view and interact with an HTML page, but does not include full browser controls. The use of the shell.explorer ActiveX control allows you to select pages to view. Refer to {ACTIVEX} and Display an Xdialog Box for more information. This approach to displaying HTML is similar to the HTML Text Window.

What is a Dialog Event?

Every action that the user performs while interacting with a dialog can potentially generate an event. By default, the only event that is generated is when the users clicks on a button. However, you can specify that your dialog should generate other events, such as when the value in a control changes, or when a control gets or loses focus.

What is a Dialog?

A dialog, or dialog box, is used throughout Windows programs to interact with the user. A dialog can be used to gather information from the user, or to present information to users. Xdialog is an extremely powerful and flexible language for describing a standard Windows dialog box. In fact, testament to the power and flexibility of Xdialog is the fact that much of what's new in Alpha Anywhere is written using Xdialog.

Working with Images on Dialogs

Xdialog allows you to place images on dialogs. You can place the images on the dialog background, on a button, next to an element in a list box, and so on. This lesson discusses some of the ways in which you can work with images.

Working with Images that Contain Multiple Sub-Images

An image can contain multiple sub-images. For example, the Alpha Anywhere system image called 'filebox' contains sub-images. The following script displays a dialog showing the 'filebox' image:

Working with Pointer Arrays

Pointer arrays (also called "property arrays") allow you to represent "multi-columned" data in an array. For example, for a customer, you have information about the customer's name, address, phone number etc.

Working with UTF-8 Data

All data retrieved from SQL databases using AlphaDAO is in UTF-8 format. If your data does have foreign characters in it, and you want to display the data in an Xdialog, you will need to use one of the available options to convert the data into ANSI format.

New In Xdialog

Header sections, the Xdialog genie, embedded browses on xdialogs, {Title} command, user defined dock panels and more.

Xdialog Genie

The Xdialog Genie is just one of many components of the much larger Action Script Genie. However, it is notable as tool that produces fully functional Xdialog boxes with embedded controls and table lookups. The Xdialog Genie produces reusable Xdialog code and is an excellent way to start any Xdialog project. Begin by selecting "Dialog Boxes" and "Display an XDialog Box".

Xdialog Simplified ListView Syntax Fonts

The simplified syntax for the ListView control in Xdialog supports the standard Xdialog {font} command.

Xdialog - Tree Control - Custom Colors for Tree Items

You can now define custom colors for items in an Xdialog tree control.

Xdialog, HTML, and JavaScript - a Powerful Combination

A brief guide to using xdialog, html, and javascript in combination.