[comp.os.msdos.programmer] Screen libraries

rc3h+@andrew.cmu.edu (Ross Ward Comer) (03/15/91)

In addition to the previous post on comp.sys.ibm.pc.programmer on Vitamin C...

Can anyone recommend a good screen painter/C code-generating library?  I
am particularly looking for something that doesn't need MS Windows, but
can work with it if Windows is installed.  Does such a beast exist?  If
not, can anyone recommend a good text-based (in other words:
non-Windows) windowing library package?

Thanks!
ross


------------------------------------------------------------------------
Ross Comer                |   ARPA:   rc3h@andrew.cmu.edu
PO Box 262, CMU           |   Bitnet: rc3h@andrew.cmu.edu
Pittsburgh, Pa.  15213    |   UUCP:   ...!harvard!andrew.cmu.edu!rc3h
------------------------------------------------------------------------

dmocsny@minerva.che.uc.edu (Daniel Mocsny) (03/19/91)

In article <obs75L200WBKM11ZZF@andrew.cmu.edu> rc3h+@andrew.cmu.edu (Ross Ward Comer) writes:
>Can anyone recommend a good screen painter/C code-generating library?  I
>am particularly looking for something that doesn't need MS Windows, but
>can work with it if Windows is installed.  Does such a beast exist?  If
>not, can anyone recommend a good text-based (in other words:
>non-Windows) windowing library package?

I have Greenleaf DataWindows v. 2.10 (they have an upgrade to 2.12
out now, but I haven't gotten it yet). This is a function library
for character-mode user-interfaces under C. No MS-Windows, no
C++, at least with the version I've got. I don't know Greenleaf's
future plans. However, they have (at higher price) UNIX and VMS
versions of the same library. I haven't tried the other versions,
so I don't know how portable things are; the salescreature told me
on the phone "highly portable".

Overall, I like the package. You get source, and it's a good thing,
because in version 2.10 you find yourself needing it from time to
time. Some things in the code don't work exactly as the manuals
advertise, so you have to look at the code to see what is going on.
Also, the compiled library files I got with my distribution weren't
synch'ed with the latest sources in the same distribution, so I
had a problem with one of their functions that had become a macro
in a source header file, but the change hadn't propagated yet in the 
binaries.  Recompiling was simple, thanks to Greenleaf's Install 
program, but I took a couple of tries to make sure that Install had 
everything just the way it wanted.

The Greenleaf library creates what I would consider a pretty nice
user interface. You have to do a lot of work to plow through all
the manuals and figure out what is going on, but once you do you can
make some pretty snappy stuff. Screen writes are fast, you can
get things to happen mostly the way you want (but sometimes you run
into brick walls), and most users will be impressed.
Certainly, your code can be up to the industry-standard in character-
mode interfaces. Greenleaf gives you windows, menus, and data-entry
forms. You can build most of the features you expect, with a reasonable
amount of work: context-sensitive help, hot keys, etc.

Some personal gripes:

1. On data-entry forms, Greenleaf shows its business orientation by
not permitting scientific notation on double (floating-point) fields.
What is worse, I haven't been able to figure out an easy way to control
the numerical precision. Greenleaf seems to give you at most six
digits to the right of the decimal point, no matter what you told it
in your "picture string" (field template). This severely limits the
dynamic range on floating-point numbers that the form will handle.
This should be fixable, with some hacking, because you can replace
Greenleaf's field editor with your own. I wrote a floating-point input
routine for curses, but I haven't tried porting it over to Greenleaf
yet because it would probably take me a week (since I really don't
know where to start). In the meantime, you can fix the dynamic-range
problem by having the user work with the *logarithm* of the number 
on the data entry form. Scientists have traditionally done this anyway,
so it's not a big deal. (E.g., "pH" is the log to base ten of the
hydrogen ion concentration in a solution.)

2. On pull-down menus, programmer ability to place sub-menus on the
screen seems restricted. Greenleaf does a pretty good job most of the
time, but not always. When it doesn't, you seem to be SOL.

3. Colors. Greenleaf lets you do whatever you like with screen
colors and attributes, but the default colors don't map very well
between color and monochrome monitors. At least, I couldn't get
one selection to look good on both. So you have to fiddle around
with calling the Greenleaf functions that identify the monitor
type you're running on, then muck about with defining a set of
colors and attributes that will look good. To make things more 
interesting, Greenleaf gives you two functions to identify the
monitor type (iscolor() and ismono()), and they don't seem to behave
oppositely at all times, for example, when you have a monochrome
monitor that is trying to emulate a color monitor. (This is almost
certain to look awful unless you force the output into monochrome.)
Also, the default colors for menus, windows, and data entry forms
look fine in mono, and not great at all in color. All told, I must
have blown at least a week fiddling with colors.

4. List-selection boxes. Greenleaf gives you list-selection boxes,
but no obvious way to pre-select any item other than the first.
If the box has a lot of items, this is a problem. To be fair,
you can use a menu instead of a list box, and menu items are
pre-selectable. Writing a pre-selection routine for a list box
is not too hard, but it took me a few days.

Greenleaf does have some code-generator tools for windows and forms,
but I haven't tried them yet. They would probably be useful. The
manuals total about 1000 pages, and they are fairly complete. They
have lots of useful examples, but somehow I constantly found myself
getting outside the scope of their examples in a hurry, and feeling
pretty lost. That is because all the examples are small and self-
contained, and the useful programs you want to write will be big
and complex and filled with interactions. 

I would like to see more examples, especially of fairly complete
applications. A somewhat full-featured DOS directory shell program would
be nice to see, since most applications need to incorporate most
of these features anyway. You wind up figuring most of it out on
your own, which is largely a waste of time. A file-listing program
like the old (simple) versions of Vernon Buerg's LIST.COM would
be nice to see, too. Greenleaf does provide some example source
code on the distribution disks, which is worth studying. However,
the code could stand to have some explanatory text beyond the
program comments.

Huh, maybe I should write a book called _Power Programming with
Greenleaf Datawindows_. Would anybody buy it?

The manuals are OK for reading (and you *will* need
to read them cover-to-cover, carefully), but not so great for
programming. Doing anything in Greenleaf means calling a series of
functions, so you find yourself flipping through the manuals
constantly. The index gives all the function names, but is pretty
weak on *topical* indexing. So if you know *what* you want to do,
but you don't know the function names you need, you will have a hard
time stumbling across all of them in the right order.

Greenleaf has a BBS which is definitely worth calling. I downloaded
their Norton Guides (TM) on-line version of the manual. In some ways
this is easier and faster to use than the paper manual. However, the
on-line manual gives only the function descriptions, not any of the
tutorial material. It is useful once you have gotten through all
the intro sections in the manual.

I would be interested in hearing from other Greenleaf DataWindows
users.

Also, I am considering the move to C++, and I will need a class
library for windows, menus, and data entry forms. I am aware that
several shareware user-interface libraries exist for C; do any
shareware user-interface class libraries exist for C++ yet?
Character-mode is fine for the moment. Now that I've gotten comfortable
with one user-interface library, I would like to try some others, to
see how they compare.


--
Dan Mocsny				
Internet: dmocsny@minerva.che.uc.edu