[comp.os.os2] cursor woes

tholen@uhccux.uhcc.Hawaii.Edu (David Tholen) (06/16/90)

I'm hoping that somebody out there can help explain the behavior I've
experienced with the API routines VioSetCurPos and VioSetCurType.

The application I'm developing starts by turning the cursor off ("hidden"
attribute).  Before the program exits, it turns the cursor back on and
restores the screen that existed when the program was started.  All this
works just fine when the program exits normally.  However, if the program
terminates abnormally (either by a Ctrl-C or bug), strange things begin
to occur.  I have no cursor at the command line prompt, but if I type a
command line long enough for the cursor to reach that portion of the screen
where a menu was prior to the termination of my program, the cursor reappears.
It will also reappear if I hit a carriage return enough times for the command
line prompt to reach the bottom of the screen and begin scrolling the screen.
Another way to restore the cursor is to use CLS.

I've experienced similar behavior within the program.  On those occasions
when the program issues a prompt for user input, I turn the cursor back on,
but it doesn't appear unless the screen location has something written to
it (having been cleared with VioScrollUp just prior to writing the prompt).
In other words, if I write "Prompt:" and then position the cursor after that
prompt, it remains hidden, but if I write "Prompt:     " (note the trailing
blanks) and position the cursor after the colon, it becomes visible (but if
I enter more characters than there were blanks written, the cursor disappears
again).

On a related note, when this program terminates normally, it restores the
screen (as mentioned above) and cursor.  On my OS/2 machine, this works just
fine, but when I run a bound version of this program on a DOS 3.10 machine
(a Compaq), the restored cursor is no longer a couple of scan lines at the
bottom of the character cell, but rather in the middle!  Could this be an
artifact of Compaq's higher resolution text mode?  I can only guess that the
top and bottom scan lines of the cursor, as set by VioSetCurType, are not
appropriate for the Compaq's CGA system.

Anybody out there that can help me understand what's going on in these
situations?  Thanks in advance.

tholen@uhccux.uhcc.hawaii.edu