[comp.os.msdos.programmer] Text windowing/UI techniques

burleigh@ogre.cica.indiana.edu (Frank Burleigh) (06/08/91)

I've been looking for a more or less advanced text-mode interface
library with fast virtual windowing that can support (or that
includes) the usual CUA bells and whistles.

I'm finding that one really has to satisfice with commercial UI
libs.  I own TCXL, whose next version will in principle support
an event driven, CUA interface.  But there is no solid ship date. 
Vitamin C 4.0 looks nice but is relatively expensive and, more
important to me, is big (the buggy demo is 164k) and lacks some
standard CUA behaviors.  Zinc 2.0 is also big, possibly inflexi-
ble, and somewhat incomplete.

It might be time for me to do my own UI library--at least the
windowing part.  I perceive, however, that achieving high perfor-
mance writes to (possibly virtual, covered or shadowed) windows
may require experience with projects such as this that I lack.

I am looking, then, for windowing techniques/algorithms.  If
anyone is interested in sharing ideas or can recommend any books,
texts or articles/papers on the subject, I'd appreciate hearing
of them.

It could also be that I've overlooked some available lib.

I thank any responders in advance.

PS: Al Stevens is doing a CUA lib in Dr Dobbs, but, at least
right now, it is slow and big.


--
Frank Burleigh  burleigh@cica.cica.indiana.edu
USENET: ...rutgers!iuvax!cica!burleigh BITNET: BURLEIGH@IUBACS.BITNET
Department of Sociology, Indiana University, Bloomington, Indiana 47405

sorrow@oak.circa.ufl.edu (06/08/91)

I personally would use the Al Stevens library since it is PD.  Also, when he
gets done with it I am sure that it will just about dog most commercial
products.  I just finished writing my own library that compiles to about 75K
all together.  It looks exactly like the Borland IDE.

However, I found that writing my own was a bigger pain than it's worth.  PC
Week stated that Borland would be releasing TurboVision for C++ sometime soon. 
If so, I would get that package.

Some general rules that I abide by are:

1.  Always use direct screen writes and reads (don't worry about snow...most
people have either Herc or VGA these days).
2.  Install your own interrupt handler for the mouse, but unless you want some
serious pain avoid the keyboard handler.  In my GetEvent function I have
something like this:

    if (Queue.NumEvents) {
    // Grab an event
    }
    else if kbhit() {
    // Grab the key and translate it
    }
3.  User the BIOS functios to scroll windows vertically.
4.  If you use the conio routines for Borland, use window() and cputs() since
they do automatic truncation/scrolling.
5.  Get the Logitech Mouse Programmer's Reference...an invaluable guide for
moues programming (such as installing your own call back function).
6.  Read the Al Stevens column closely and use as much as possible.  The man
knows what he is doing.

Also, since I'm kind of a wimp when it comes to difficult programming, I
statically allocate all my windows in a header file.  This avoids the problem
of knowing what memory is valid for freeing, constantly checking for out of
memory problems, pointer problems, etc.  Dynamically allocate the scroll back
buffer for every window, and dynamically allocate all the screen buffers when
the window is opened.

Hope this helps,

Brian
/*
Brian Hook -- MS-DOS Programmer for Contract
-----------------------------------------------------------------
"I was in the kitchen, Seamus, that's my dog, was outside....and buried
ALIVE....fritter and waste...but this one goes to 11!....anymore of that
plutonium nyborg?...Little guitars..This is home...this is Mean Street..
*/