Main BASIS Page
Main Advantage Page
This Issue's Table of Contents
Cut Coding Time With New Grid Control Previous Article Table of Contents Next Article

By Larry Eads

The upcoming Visual PRO/5™ v2.0 release has many new features designed to enhance and simplify your Business Basic programming. One of the most significant new aspects of this release is the inclusion of a graphical grid control.

In some respects, a grid control is similar to a spreadsheet program in which data is displayed in rows and columns, and an operator can scroll both vertically and horizontally to display, modify, and enter new data.

But as any programmer who has created programs of this type will attest, writing this type of logic is one of the more time-consuming portions of any user interface. In addition to data entry and scrolling, the programmer must also accommodate deletion, insertion, and addition of rows, in the initial data entry and in any subsequent data modifications.

Use A Grid Control For...

Programming many data processing applications can be simplified with a grid control feature. Order processing is a typical example. Usually, order header information is followed by entry of one or more items to be ordered. As each line item is entered, the items scroll off the top of the screen while the operator continues to enter more items. The operator can scroll forward and backward in the order to review and modify the individual items.

A grid control can simplify similar applications in which the data exceeds the capacity of a single display screen. Detail deduction entry for payroll, complex general ledger distributions, or detail bill of materials entry are but a few applications where the use of a grid control can significantly reduce a programmer's coding effort.

New Grid Control Capabilities

Visual PRO/5 v2.0's grid control feature is "data aware." Simply associating an existing file channel with the grid will allow the grid itself to read, display, browse, and update the referenced data items. Thus, populating the grid with existing data elements doesn't require a programmer to write detailed logic to read and display data.

This feature works with m-keyed files, a Visual PRO/5 SELECT channel, or an SQL SELECT channel that allows non-Visual PRO/5 files to be integrated into the grid control. In many instances, a grid control can replace a 'LISTBOX', reducing the amount of code. Also, with a capacity for two billion rows and 255 columns, the grid control can accommodate future file growth with ease.

Visual PRO/5 v2.0's grid control has numerous parameters to control appearance, data display, and data entry validation and updating. A plethora of messages and Notify events are available to create sophisticated user-interface functions. Using the grid control features, developers can create programs that include features such as dragging and dropping data elements. More information on the extensive new grid control capabilities can be found in the PRO/5 v2.0 Documentation Supplement located on the BASIS website at

Preview BASIS' New PRO/5 v2.0

The following sample skeleton program originally found in Visual PRO/5 v2.0 Early Access code illustrates many other features of the new grid control.

The source files for this sample program are available from our web site in both a ZIP file ( and a compressed tar file (gridtest.tar.Z). Because this program is in ASCII format, it needs to be compiled by pro5cpl to produce a PRO/5-executable program. If you are not familiar with using pro5cpl to compile ASCII source files, simply enter the following statement at the command prompt:

I=SCALL("pro5cpl gridtest.src")

At the completion of this command, you will have the original source file and a ready-to-run program called gridtest.

When invoked, the gridtest program will look like this:

Sample Grid Control

Two important grid features highlighted in this sample program are animated cursor support and real-time display of grid messages that respond to operator interaction. The animated cursor support can be seen by moving the mouse around the grid. Readers will be able to quickly locate the clever animated cursor "bug" that appears. The Notification Messages displayed in the upper left corner of the program provides an example of the real-time messages that respond to operator interaction. Double-clicking or entering data into a cell brings up a variety of messages in the Notification Messages field.

While this sample program is intended to exercise the grid control, it also contains code that illustrates event loop handling and general program flow when writing event-driven user interfaces. Menus, headings, and data formatting are also illustrated to provide a framework of reference when writing application logic.

We've barely scratched the surface of this new grid control's capabilities. I encourage all developers to take a few minutes to download the Visual PRO/5 v2.0 Early Access release and explore the possibilities this powerful new control can bring to GUI application development efforts.

Previous Article Table of Contents Next Article
Copyright 1999, BASIS International Ltd. All rights reserved.
Terms of Use