Establishing a Status Line

The following example uses a one line window to establish a status line on the next to last line of the screen (leaving the last line for an error window). Automatic cursor advance and automatic clear-to-the-end-of-the-row are turned off on the status line. This gives better control over output on the line and will prevent status information near the end of the line from being erased when the positions to the left are updated.

The top part of the screen, above the status line, is defined as another window. General output will go to the main window. Automatic screen cursor placement is turned on in the main window.

WINDOWPTR stat_wnp, main_wnp;



stat_wnp = wn_def(vs_rowq() - 2, 0, 1, vs_colq(), LREVERSE, BDR_NULLP);

sw_opt(CSADVANCE | CLRENDROW, OFF, stat_wnp);



main_wnp = wn_def(0, 0, vs_rowq() - 2, vs_colq(), LNORMAL, BDR_NULLP);

sw_opt(CSRPLACE, ON, main_wnp);

wn_up(stat_wnp);

wn_up(main_wnp);

When you wish to write to the main part of the screen, reference main_wnp in the output functions. Output will not be permitted to go to the status line. Conversely, when you want to write to the status line, reference stat_wnp.

For example, if you are keeping the value of the column position of the physical cursor in the main window at position 70 on the status line, you could update this position with:

cs_mv(0, 70, stat_wnp);

v_printf(stat_wnp, "%d", main_wnp->c);


Home Contents Previous Next