Controls in Xdialog

Description

Pages about Xdialog Controls.

Name
Description
Advanced List Box-Record List Control

Describes the list box-record list control with an example.

Auto-Populating List Box and Combo Box Controls

When you place a list box or combo box control on a Form, Alpha Anywhere offers several different ways to automatically populate the control. The controls can be automatically populated with various internal Alpha Anywhere lists or dynamic lists of data.

Xdialog Buttons

Guides relating to Xdialog buttons.

Cascading Selection Lists

There are many cases when an application needs to display a dynamic selection list. The following example displays a list of unique state values in one list box. When the user makes a selection, the second list box displays a list of cities for that state.

Check Box Controls

How to create check box controls and display dialogs that use them.

Xdialog Chrome Browser Control

Xdialog allows you to embed the Chrome browser control.

Combo Boxes

Combo boxes are variants on the text box and radio button controls. Like a radio button, a combo box displays a list of values, but it displays the choices in a drop-down text box. You can specify the choices for the combo in one of three ways:

Comparing Drop-down Lists and Popup Dialogs

You can display a table lookup as a drop-down combo box, rather than in a separate pop-up window. While there are some advantages in using the pop-up window (i.e. the ability to edit and add records to the lookup table on the fly, and the ability to search for a record by any key), using a combo box creates a more natural feel for the user. The AlphaSports Invoice Form has a product combo box lookup.

Conditional Control Properties

Describes setup properties and dimension properties

Conditionally Showing Controls

Instead of merely disabling controls, it may be preferable to hide certain controls completely. Using the {condition} command you can make the display of whole sections of a dialog box conditional on an expression.

Conditionally Sizing Controls

Sometimes it is desirable to be able to resize controls on the fly.

Control Properties

Every control that you place on a layout has a set of properties that you can set to modify its appearance and/or behavior. Properties for an control can always be set by using its Properties dialog box, which is displayed by right-clicking on the object and choosing Properties... from the right-click menu, or by pressing F12. In addition, some object properties can be set through the use of one or more Toolbars.

Controlling Record Navigation with the Invoice Toolbar

Describes record navigation buttons and how to create a toolbar utilizing using these buttons. This page also covers how to attach this toolbar to a form.

Copying Selected Text from a Memo Control

The following example shows how to copy selected text from a memo control. The script then pastes the copied text into a different text control on the same form.

Creating a Cascading List

A cascading list is a series of nested pop-up lists that appear as you make selections from the initial lookup window and its related sub-windows. All lookup values are selected at the endpoints of the cascading lists.

Creating a User Defined Control

This script shows how to create user-defined controls (based on ActivX controls) that can be used on an Xdialog. The control will be called myControl. Once the control has been defined, it can be placed on the Xdialog using the syntax {myControl=width,heightInstanceVariable} e.g. {myControl=100,20p} where p is a dot variable that defines and instance of the myControl User Defined Control. In this example, we will create a User Defined Control called myControl. This control will have two methods, setHTML()and setCSS().

Creating and Using a Multi-Level Popup Menu

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

Creating Custom Toolbars

Alpha Anywhere lets you create your own toolbars. You can attach custom toolbars to forms, browses, and print preview windows. Unlike custom menus, however, you do not need a form, browse, or print preview window to use a custom toolbars. You can run a custom toolbar from the control panel, or from an Xbasic script, and the toolbar will remain open until you close it.

Creating the Navigation Toolbar

The NavigationToolbar toolbar provides an alternative mechanism for displaying the different forms of the AlphaSports application. Looking at the definition of the Invoices button, you can see that the Button Action is "Play Global Script" and the Script Name is "invoice_form" - the same properties as BUTTON1 , thereby reusing the invoice_form script.

Defining Which Controls Have Tab Stops

This script shows how to use the {DEFAULTTABSTOPS}, {NOTABSTOPS}, {TABSTOPS}, and {ENDTAB} to define which dialog controls have tab stops.

Displaying a "Wait" Message While a Branch Expands

This example shows how to use the {EXPAND} command to display a wait message while waiting for the data to expand a branch of a tree control. The list that defines the tree control's contents includes the {EXPAND} command where Alpha Anywhere may require several seconds to general the branches of the tree. This occurs only when dynamically populating the tree control with a function.

Displaying the Navigation Toolbar

The vCshowNavBar check box on the Main Menu form displays the Navigation Toolbar. It uses the following Xbasic code.

Dynamically Sizing List Box Row Height

To specify that the row height in the list box is computed dynamically based on the height of the row it is displaying, use the 'D' directive in the list box format string. For example, to fix the previous script, change the format string to:

Edit Combo Box with Bubble Help for Choices

This example shows how to use the Combo Box %A% directive to display a CR-LF delimited list of choices as bubble help.

HtmlHost
Image Controls

To place an image on dialog, use the {Image} command. The syntax for the command is:

ImageViewer Control - Displaying Images on an Xdialog

The {ImageViewer} control - a control displays a .BMP, .GIF, .JPG, or .PNG image on an Xdialog.

Line Breaks

In the Putting a Button on the Dialog example, it would be nice if the button were on a new line. This is accomplished by using the line break symbol - a semi-colon ( ; ). Instead of using this code, which puts the text and buttons on the same line:

List Box Controls

Pages relating to List Box Controls.

ListView
More Dialog Box Controls

This lesson discusses several types of controls that you can put on a dialog box.

Numbering the Rows in a List Box

By changing the owner-draw string from the above example, we can cause the list box to be displayed with row numbers. For example, with the owner draw string shown below, our list box now shows each row with the row number, then a space, then two dashes, then another space, then the image, then a space, then text from the input value.

Other Controls

In addition to the controls discussed in this lesson, Xdialog offers several other control types which we will discuss in later lessons. However, before discussing these controls, we will discuss how to control the layout of the controls on your dialogs.

Placing a Browser Control on a Form

The following procedure describes the process of placing the Microsoft Web Browser (shell.explorer) ActiveX control on a form.

Placing an HTML Edit Control on a Form

The following procedure describes the process of placing the Microsoft DHTML Edit Control for IE5 ( Dhtmledit.Dhtmledit ) ActiveX control on a form. This form is bound to the HTMLnotes memo field in the underlying table.

Setting Choices for List and Combo Boxes

A data field displayed as a list box accepts only values that are in its choice list. A data field displayed as a combo box accepts both values in the list and new values entered by the user. These images show a list box in regular and combo box formats.

Setting the Text and Value Properties of Items in a Choice List Array

The user defined choices displayed by a combo box, radio button, list box etc. can be read and set by reading or setting the text and value properties of the choice list array. The text property controls what is displayed on the form. The value property controls what value is written to the field when an item is selected.

Simple List Box-Record List Control

Use this record list command:

Special Formatting for Text Box Controls

Text box controls have a large number of special formatting options that change the behavior and appearance of text box controls. These formatting options are enclosed between '%' characters at the start of the text box.

Specifying the Default Button

Generally when you design a dialog you will want to designate one of the buttons as the default buttons. Pressing the Enter key will select the default button. Putting a ?*' at the start of a button definition designates the button as the default button. The following script makes the "OK" button the default button:

Standard Controls

In this lesson you will learn about the standard Windows controls, such as edit boxes, radio buttons, check boxes, etc. that you can place on your dialog boxes.

Supercontrols

This page covers the alphabet button search bar supercontrol, drop down browse supercontrol, and cascading drop down browse.

Tab Controls

Alpha Anywhere allows you to create tabbed dialogs. Tabbed dialogs allow you to organize your dialog into logical sections, and to pack a lot more information onto the dialog than a single dialog would allow. To put a tab control on a dialog you use the {tab}, {pane} and {endtab} commands. The syntax for the commands is as follows:

The Record List Control

A record list control displays data in a combo box, edit-combo box, or a list box. Unlike combo boxes or list boxes, however, the record list is populated dynamically with data from records in a table. The advantage of this over a combo box or list box is that there is no limit to the number of entries that can be displayed in a record list. In addition, record lists have other advantages over combo boxes in that they can be multi-columned.

Toolbars

Toolbars provide quick access to commonly used menu commands. In the layout editors they provide a quick way to set properties of objects. Alpha Anywhere includes a variety of System Toolbars. To better suit your needs, you can modify the system toolbars by adding and removing buttons, or create your own custom toolbars and save them in the database.

Tree Controls

Pages about Tree Controls.

User Defined Controls

The following section gives examples of User Defined Controls (UDCs) on a form. The sample forms and Xbasic scripts can be found in the Samples\Xbasic directory off the directory in which Alpha Anywhere was installed. Open the Xbasic database in this directory.

Using a Combo Box to Dynamically Redefine a Browse

The OnChange event of the SearchBy combo box runs the following Xbasic code, which:

Using a Tabbed Object to Selectively Display Controls

The Tabbed1 object has three tabs and pages, each with its own set of controls. The controls on a page are hidden until the user clicks the corresponding tab.

Using Embedded Owner-Draw Specifications in Controls

There are techniques for including bitmaps and font information in the data displayed by various Xdialog controls. This lesson will show you how you can embed an owner draw directive directly in the data that you are displaying. In many cases this will greatly simplify using fonts and images in your controls.

Using Owner-Draw Specifications in Controls

As we saw in the previous lesson, the term "owner-draw" refers to the fact that the developer can control certain aspects about the appearance of a button. For example, we saw how owner-draw strings allowed us to put text and a bitmap on a button.

Using Radio Buttons to Select a Record

This technique allows you to identify a record selected with a radio button and read the value of a field bound to the radio button. In this example, the field will be the customer_id field, which is the unique key field for the customer table. This demonstration is based on the AlphaSports sample database.

Using the Microsoft Calendar Control

The following example shows how to use the Microsoft Calendar Control on a form. In this implementation the calendar control sets the value of the Invoice Date field and the Invoice Date field sets the value of the calendar.

Where is the Mouse?

This example shows how to detect which control the cursor is over. The script uses the {TIMER} event to periodically call the UI_DLG_CONTROL_FROM_POS()function, which returns the location of the cursor.

Working with List Boxes, Combo Boxes, Radio Buttons Etc.

If a list box, drop-down list box, radio button, two-state, or multi-state button control has a user defined list of choices, you can modify the displayed choices with Xbasic. For example, a drop-down list box might offer these choices to the user:

Xdialog ListBoxes - Dynamically Computing the Display Expression

A common requirement in an Xdialog is to display a listbox showing data from an array. The array is often a property array, and so the Xdialog displays data from one of the properties in the array. For example, the property array shown below has 'fname' and 'lname' properties, and the Xdialog shows the value in the 'lname' property:

Xdialog Listboxes - Horizontal Scrolling

Xdialog listboxes now has horizontal scrolling. To turn on horizontal scrolling, you must use the 'H' directive, as shown in the example below:

Xdialog Preview Button

When you create an Xdialog with Action Scripting, you have the ability to preview your new dialog box before you finish your action script. You no longer have to complete defining the action and then run the script before you can see how the Xdialog will look.