Hiding the cursor

Hiding the cursor

Post by And » Wed, 10 Nov 1993 23:57:40



Hello,

        I am making a menu program using curses.  The trouble is I
can't find how to acutally "hide" the cursor.  So you see this box sitting
there when I run my menu screen.  Any ideas?

Andy Niksch

 
 
 

Hiding the cursor

Post by Jerry Siever » Sun, 14 Nov 1993 22:24:25


i think i know what you mean... you should check the curs_set(visibility)
routine i your implementation has it.

with visibility being...

        0 = cursor cant be seen
        1 = cursor normal (like just a blinking _ )
        2 = cursor is a blinking [BOX] or whatever

remember that.....

        1) your terminal must be able to have the cursor turned off & on
           (at least off & on for visibility = 0 or 1)
        2) the terminfo file for same terminal must be set such that curses
           "knows" what the control strings are.

the terminfo file on my system for vt100 did not have cursor visibility
configured even tho my terminal can do several cursor tricks including
turning the blink on or off.

ps. i once gave advise to some other at purdue... name jason schlachet
or something like that... if you know him... please say HELLO for me!

LATER

 
 
 

1. Hiding the cursor

I finished my first Linux program last night!  Great, wonderful --
except that just before midnight I discovered that if I run it for ten
minutes, it exhausts virtual memory.  Oops.

The program is a digital clock, just the killer app we've all been
waiting for...  Anyway, I blank the screen and naturally I don't want
that damn cursor flashing in the corner.  So I hide it.

I found the right way to do this:

        printf(tgetstr("vi", nil));

and this works in isolation.  But I'm also looking for a keystroke to
tell me to quit.  When I put the two together, the cursor remains
visible.  That is, I have something like:

        ...
        printf(tgetstr("vi", nil));
        ...
        while (read(STDIN_FILENO, &TheChar, 1) == 0)
                {
                ...
                }
        ...
        printf(tgetstr("ve", nil));
        ...

and the cursor remains.  But if I turn off the cursor after each read(),
then the cursor vanishes:

        ...
        while (read(STDIN_FILENO, &TheChar, 1) == 0)
                {
                printf(tgetstr("vi", nil));
                ...
                }
        ...
        printf(tgetstr("ve", nil));
        ...

This is screwy but it seemed to work, so I was willing to live with it
for now.  Then I discovered the memory problem, which did not occur in
the first version.  In summary, if I call tgetstr() outside of the loop,
then the cursor remains visible; if I call tgetstr() inside the loop,
the cursor goes away but there's a monster memory leak (constant disk
activity).

Any ideas?

Thanks!

Cliff

2. retaining screen formatting in a variable

3. how to hide the cursor?

4. various questions...

5. Hide the cursor

6. Urgent!!!! Computer Networking question

7. Hiding Mouse Cursor in X app

8. Top 10 subjects comp.unix.shell

9. Hiding the cursor in curses

10. help me HIDE the cursor.

11. Command line to hide mouse cursor

12. Blinking cursor when panel is hidden

13. hidden cursor