Graphical user interfaces (GUIs) have revolutionized the way end users interact with software. Instead of typing in memorized commands, they can now simply point and click their way through the most complex operations. The result has made computing much easier for average users but created a steep learning curve for developers.
GUI programs are structurally different from character programs, with the screen transformed into a graphical window and data fields replaced with graphical controls such as push buttons, check boxes, and radio buttons. Then there is the event loop, the heart of the event-driven GUI program, that cycles as it waits for the user to take some action--push a button or click on a menu--and then responds. And to make it even more complicated, windows and graphical controls are identified with arbitrary numbers instead of easy-to-remember names.
But a new tool in Visual PRO/5® 2.0 is simplifying the creation of event-driven GUI programs for developers at any experience level. GUIBuilder is a complete visual programming environment that lets developers focus on what's really important--designing the overall flow of the application and creating the business rules--by automatically handling all the housekeeping details that go into an event-driven GUI program. GUIBuilder even includes a series of defined functions that lets you work with graphical controls using meaningful names rather than arbitrary numbers. For developers who may have seen GUI as intimidating and overly complex, GUIBuilder makes GUI programming easy and understandable.
The Visual Programming Environment
The first step in developing a program with GUIBuilder doesn't actually start with GUIBuilder but in ResBuilder, the new, visual resource builder in Visual PRO/5 2.0. Using ResBuilder, you create a window--a type of GUI form--and then place graphical controls in the window. ResBuilder stores the structure of the window and controls in a resource file (see "Randolph Wrestles with ResBuilder" in The BASIS Advantage at www.basis.com/advantage/mag-v2n1/randolph.html). Then you can open the resource file in GUIBuilder and begin selecting forms, windows, controls, and events from lists, and type in event handlers--blocks of Visual PRO/5 code that tell GUIBuilder how to respond to selected events. When you've finished creating event handler subroutines, GUIBuilder generates a complete and extensively commented GUI program.
The visual orientation of GUIBuilder eliminates the possibility of errors in identifying forms, windows, controls, or events by allowing you to pick only legal values from lists. To ensure that the program remains up to date with resource file changes, a detailed cross-check is done every time you load the program into GUIBuilder and when you return from editing the resource file in GUIBuilder.
GUIBuilder can't automatically convert all your character-based programs from character to GUI, but it does help you incorporate your existing character-based code into your new GUI programs. The GUIBuilder interface has two windows, an Edit Window for typing in blocks of code and a View Window, where you can load secondary text files or programs. When a tokenized Visual PRO/5 program is loaded into the View Window, GUIBuilder converts all line number references in the program to label references and then loads the program as formatted text. You can then easily cut selected blocks of code from your legacy program and paste them into the new GUI program, toggling back and forth between the Edit Window and the View Window.
The instant error checking available with the traditional BBx® console is not lost. GUIBuilder offers a menu option and corresponding tool button that can be used to check syntax at any time. This feature checks the syntax of the current block of code and returns either a "No errors found" message or a list of errors. When an error from the list is selected, the cursor is placed in an edit window with the incorrect line of code highlighted. Detailed syntax checking and reporting are also done when a completed program is built. Another option can be used to check for and report syntax errors automatically when saving each block of code to the work file.
In addition to the features described above, GUIBuilder lets you
With GUIBuilder, the parts you don't see--the framework and the associated code-generation logic--are just as important as the parts you do see. In GUIBuilder, the code blocks that you create are inserted into a standard framework that takes care of the housekeeping details important to any event-driven GUI program. The framework
GUIBuilder generates a complete, working program even before you
add your own code blocks. You can sit down alone or with a customer
and design the overall look of the program using ResBuilder and then
immediately generate a complete prototype program that demonstrates
the application's look and feel. You can even leave the generated
program at the customer's site. When combined with the resource file
and a single called program,
GUI Building Blocks
A program created using GUIBuilder is made up of a standard framework, plus individual code blocks. The code blocks fall into one of the following categories:
There's one other type of code block, known as Subroutines or Functions, that is used for common subroutines, defined functions, or nonexecuting code like the TABLE, IOLIST, or DATA statements. Code defined in these blocks isn't managed automatically by the framework, so it's up to you to decide how it will be used.
There are a few more interesting features associated with creating
event handler routines. When you create a new event handler, the code
block doesn't start out completely blank. It's initialized with enough
code to get you started--sometimes with as little a comment line
Data Management Functions
Programming languages got much easier when programmers were able to
use variable names like
If you've managed to avoid GUI programming so far, now is the time to give it a try. GUIBuilder's visual programming environment makes GUI program development intuitive, and the thorough help system makes it easy to get started. If you already have some experience in writing event-driven GUI programs using Visual PRO/5 1.0, you'll be impressed with how quick and easy the process has become with GUIBuilder. To try out GUIBuilder for yourself; you'll need only to upgrade to Visual PRO/5 2.0. This new version is available for Windows 3.1, 3.11, 95, and 98, as well as Windows NT 3.51 and 4.0.
Copyright 1999, BASIS International Ltd. All rights reserved.