user1340098
user1340098

Reputation: 51

scrolling content in ncurses box

I have a window (created with newwin ) and create box (box (WINDOW *, int, int) ).

I read and write (on FD 0 and 1) under the box, and I get a (char *) from a socket, I wrote this tab in the box.

When I wrote 195 lines, I arrive on the end of the box.

How I can scroll the existing text, so that new text will print at the bottom?

Upvotes: 4

Views: 11226

Answers (1)

c00kiemon5ter
c00kiemon5ter

Reputation: 17604

Use the scrollok(WINDOW *win, bool bf); function.

scrollok(win, TRUE);

From the man page:

The scrollok option controls what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If disabled, (bf is FALSE), the cursor is left on the bottom line. If enabled, (bf is TRUE), the window is scrolled up one line (Note that to get the physical scrolling effect on the terminal, it is also necessary to call idlok).


btw, I've written a very simple interface to an irc client in c using ncurses (pic), it is not complete, but you may want to peek for hints - code.

Upvotes: 3

Related Questions