Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

C-scape And Look & Feel


December 1990/C-scape And Look & Feel

Ian Ashdown is a consulting software engineer specializing in C/C++ programming and embedded systems design. He has a B.App.Sc. in electrical engineering from the University of British Columbia. He may be contacted at byHeart Software, 620 Ballantree Road, West Vancouver, B.C., Canada V7S 1W3, Tel. (604) 922-6148 / Fax. (604) 987-5216.

C-scape and Look & Feel from Oakland Group, Inc., are two complementary screen management and design packages that allow you to create sophisticated and powerful character-based user interfaces for MS-DOS, OS/2, UNIX, and VMS machines. C-scape, the screen management package, offers an object-oriented library of more than 300 carefully crafted and documented C functions. Look & Feel, a companion screen design program and code generator, allows you to interactively design your screens and then automatically produce C source code for them.

C-scape

C-scape supports the full range of user interface features that you expect from professional application programs, including tiled, layered, bordered, shadowed, popup and exploding windows, scrolling lists, and popup and pulldown menus. Many sophisticated data entry and validation capabilities are available, as are hypertext help screens, built-in text editing, mouse control, and PCX color graphics support. The package provides fully documented C source code for all library and support functions.

Creating screens with C-scape is greatly simplified because it adheres to the object-oriented design paradigm. Windows are modeled as objects (dynamically-allocated data structures). You can modify the runtime appearance or behavior of a window or one of its fields by setting (binding) a function pointer in its data structure or passing it a pointer to another data structure.

You create individual windows in two phases. First, create a menu object, then repeatedly call an enhanced printf function to lay out the text and fields of your window. C-scape's menu_Printf function is a superset of printf, designed for sending its output to a color video display rather than a teletype printer. C programmers will feel right at home here.

In the second phase, you create a screen editor (or sed) object that determines how the window will appear and behave on the display. Specifying its attributes — display colors, border type, shadow effects, resizing, mouse control, and so on — requires no more than calling a C-scape library function to set a function or data pointer in the sed data structure. For example, you can specify that the window border display a title, prompt string, and text scroll bar, and that the window can be resized and moved with a mouse, all with the function call sed_SetBorder(sed, bd_mouse) (where sed is a handle for the sed object and bd_mouse is a pointer to a data structure).

Managing the display — recognizing the video adapter and mode in use, producing fonts for graphic modes, formatting and positioning the windows, responding to keyboard and mouse events, and so forth — is handled by an underlying window manager (the Oakland Windowing Library). Although the package provides complete source code for this manager, you rarely have to consider its operation. Once you have defined your windows, you need only paint them on the screen and activate them. C-scape handles the complex details of their presentation and interaction reliably and transparently.

A varied selection of useful and powerflibrary functions handles data entry and validation for fields. Each set of functions is encapsulated in an array of function pointers that is passed to menu_Printf when defining the field in the menu object. You have an opportunity to write a function that performs extra formatting and validation on the field data and bind it to the sed object. Alternatively, for those fields with specific or unique formatting and validation requirements, you can duplicate the field function array by substituting one or more pointers to your own functions.

C-scape's concept of fields extends beyond text-based data entry and validation to include the basic object, or bob. The various types of displayable objects — windows, scrolling lists, menus, and so forth — can be bobbed and then embedded in another window. This is a form of encapsulation in that the parent window does not know or care about the details of the bobbed object. The parent considers this object (say a window-based text editor) as just another data entry field.

Speaking of text editors, C-scape provides a family of text editing functions, so you can build anything from a popup note pad to a basic but complete text editor within a window. You can choose the default editor or modify the source code to make it perform exactly the way you want.

C-scape offers more features than I can review in this article. These features include higher-level functions for creating various types of menus and popup message boxes, a context-sensitive help system that can be added to any application, the ability to save and load window definitions from disk, and full access to the video display hardware and keyboard. All in all, C-scape occupies more than 1.6 megabytes of C source code spread over some 450 files, and comes with nearly 800 pages of documentation in two soft-cover manuals. It is a serious and fully professional product.

User Comments

I have been using C-scape daily for the past six months to create a medium-sized commercial application (35,000 lines of C source code), and I remain very impressed with the product, with only a few minor complaints. Its object-oriented design makes it easy to learn and very easy to use. The source code is well commented and cleanly designed, and the documentation is outstanding for its clarity and completeness. I have found only five bugs, each of which I managed to fix in an hour or so of sleuthing through the source code.

C-scape does tend to produce large executables. A minimum application (the ubiquitous "Hello, World!") that can run on any MS-DOS video adapter requires approximately 100K of code. On the positive side, the execution speed is good to excellent and is acceptable even on a decrepit 4.77MHz PC. (Two exceptions are the text editor search and replace functions — they can be painfully slow. You can watch the cursor move as they chug through the on-screen text, even on a 16MHz AT-class machine.)

C-scape transparently supports all common MS-DOS video adapters with the exception of Super-VGA and higher resolution boards; however, support for the Hercules board in graphics mode has an unusual quirk: a 90-character wide display. Developing an application on an 80-character wide EGA display and then seeing it squashed on the left-hand side of a Hercules display is somewhat disconcerting. Unfortunately, C-scape provides no means of centering the entire screen.

Debugging C-scape applications will require a mental shift of gears for C programmers who are used to procedural code designs. The operation of the window manager can be extremely complicated, with a lot of activity occurring that you wouldn't normally be concerned with. Rather than stepping through code execution line by line, you should set breakpoints on the functions of interest, and then wait for them to be executed.

The C-scape advertisements prominently proclaim, "Graphics: combine high-resolution color graphics with text or menus". While this is true, it is somewhat misleading. Although C-scape applications can run in both text and graphic modes, C-scape is not a graphical user interface. Your screen design options are strictly limited to the IBM Extended ASCII character set under MS-DOS, or the native character set for other environments. It provides limited support for the display of color PCX-format graphics — you can load an image into a window and then move and resize the window as required, but you can't resize the image. Moreover, in contrast to the printed C-scape manuals, the only documentation for this feature is a few poorly-written paragraphs in a READ.ME file. [Vendor claims that version 3.2 will contain more graphics documentation Ed.]

C-scape coexists with third-party graphic library routines, although it cannot normally interact with them. I have successfully used the Microsoft v5.1 C compiler, INGRAF, and C Source's GFX graphics libraries with C-scape to draw patterns and images inside C-scape windows. However, what is sorely missing is a set of C-scape functions that grab whatever image is on the screen inside a window and move it when you move the window with a mouse. These functions should also allow the window and enclosed image to be hidden and redisplayed without having to separately erase and redraw the image. [The vendor also claims extended mouse support in v3.2Ed.]

Look & Feel

Designing windows for the C-scape screen manager by hand is possible but very tedious. With Look & Feel, screen design is actually an enjoyable experience. All of the low-level coding and interface details are taken care, leaving you free to concentrate on the aesthetic and ergonomic aspects of your design.

Look & Feel supports all of the window design features C-scape offers. It's a true WYSIWYG editor, so that the windows you design appear exactly as they will in your finished application. Its own built-in screen editor allows you to move, cut, paste, and copy blocks of text and data fields as you design. Multiple windows can be edited at once, and online, context-sensitive help offers detailed information on every feature. Finally, you can use a built-in text editor to perform such housekeeping chores as writing notes and editing associated C source code.

Using Look & Feel, you can simulate the operations of windows and menus as you design them, without generating and compiling C source code. The simulation calls the same data entry, formatting, and validation functions that your finished application program will use, so there are no questions or doubts about its accuracy or runtime behavior.

One of C-scape's more useful features is the ability to write custom data entry, formatting, and validation functions for individual fields. Look & Feel supports this ability by allowing you to easily modify and recompile part of its user interface such that your custom functions can be added to its menu of more than 30 standard field functions. You can also add your own custom screen border functions, mouse handlers and keyboard handler functions. While the Look & Feel package does not provide source code for the entire Look & Feel program (although it is available from Oakland Group), source code access to its user interface should be more than satisfactory for most users.

After completing a screen design, you can instruct Look & Feel to generate C source code for it or save the screen to disk as an ASCII screen description file. Your application program can load this file at runtime, with the screen being displayed just as if it were generated directly from executable code. One advantage of this feature is that the screens can be rewritten — perhaps with the text in a different language — without having to recompile your program. Another is that it reduces the size of the executable image, albeit at the expense of brief pauses at runtime while the files are being loaded.

Another feature offered by Look & Feel is the ability to load screens from ASCII files or files generated with Dan Bricklin's Demo Program. While there should be little need to create screens outside of Look & Feel's environment, it's still nice to have the capability available.

As does C-scape, Look & Feel allows you to link one screen to another for such purposes as embedding a text editor in a data entry screen or creating a menu bar with pulldown submenus. You can also attach user-defined functions to windows or individual fields for specific data manipulation requirements.

Look & Feel is very much an adjunct of the C-scape screen management package. Its documentation is brief, consisting of one well-written, 120-page soft-cover manual. This is more than adequate, however, since much of what it refers to is covered in the C-scape manuals.

User Comments

As with C-scape, I am very impressed with Look & Feel. As a design tool, it serves its intended purpose, which is managing the complexities of designing screens for C-scape. The user interface (which appears to have been developed using C-scape) is fast, visually and ergonomically pleasing, and very intuitive. It can be used with or without a mouse.

I am less impressed with several serious bugs that should never have gotten beyond the alpha test stage. You can crash the program by making the window being designed as large as the screen display. You can lock up the program by testing screens containing fields with incorrect data validation parameters. The program occasionally locks up when writing screen descriptions or their C source code to disk. When you have just spent the last two hours designing a complex screen and are trying to save your work to disk, such glitches are anything but amusing.

The C source code Look & Feel produces is commented and easy to follow, although it does suffer from a few cosmetic defects. For example, the code produced for accessing embedded (bobbed) screens is rather inefficient compared to the examples offered in the C-scape manuals. On the other hand, I have never found an instance of incorrect code being produced.

Look & Feel can also generate C code for stand-alone applications from your screen designs, essentially by creating a very small shell program that initializes the screen manager and then calls the screen code. This is useful when you want to test the screen with some associated data manipulation functions before attempting to integrate it into your application program.

To become proficient with the C-scape screen management package you must invest considerable time and effort. Look & Feel enables you to become productive almost immediately, while helping you learn the C-scape function library by examining the source code it produces.

Summary

C-scape and Look & Feel comprise an excellent screen management and design package for the professional programmer. The suggested list price of $499 for the MS-DOS and OS/2 versions (UNIX versions start at $999) places them beyond the means of most hobbyists. However, for the programmer designing user interfaces for serious applications (commercial or otherwise), I feel they are worth every penny.

C-scape, Look & Feel
Oakland Group, Inc.
675 Massachusettes Avenue
Cambridge, MA 02139-3309
(800) 233-3733


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.