[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with pads
From: |
Morris, William |
Subject: |
Problems with pads |
Date: |
Tue, 17 Dec 2002 05:08:49 -0600 |
Hello
Can anyone put me right in the use of "pads"?
I added a pad to a program which needs to show a portion of some data.
The data in the pad never appeared. So I have the simple code below
which tries to make a pad do what I expect. The comments in the code
explain what happens. I would like to be able to:
1. get input from the main window or other windows
2. use addstr/waddstr (and variants) to add to areas inside and outside
the pad view area.
I'm running QNX6.2 (realtime OS with POSIX features) curses version-5.2.
I tried compiling up the 5.3 release. The library (libncurses.a)
compiled, but other components failed. After compiling/linking against
the 5.3 library, text strings were printed in a garbled fashion and the
pad text appeared in the rip-off line.
Thanks in advance
William Morris
-------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
WINDOW * pad, * line;
static void curses_close( void )
{
clear(); refresh(); endwin();
}
static int do_line( WINDOW * w, int cols )
{
line = w;
waddstr( w, "Rip off!" );
//wrefresh( line ); This causes an end to all keyboard input
return 0;
}
int
main( int argc, char ** argv )
{
ripoffline( 1, do_line );
initscr();
cbreak();
noecho();
atexit( curses_close );
// Refresh the ripped-off line. This causes an end to all keyboard
// input if placed in do_line()
wrefresh( line );
pad = newpad( 100, 100 );
//trace( TRACE_MAXIMUM );
// Write some text into the pad and display it. pnoutrefresh does
// nothing so use prefresh instead
mvwaddstr( pad, 3, 3, "Text in pad added with mvwaddstr" );
prefresh( pad, 0,0,0,0,10,60 );
// Wait for input. If this is just getch(), pad text does not appear.
wgetch( line );
// getch();
// Add some text ouside the pad view area. Pad text now disappears!
move( 12, 12 );
addstr( "Text in main area added with addstr" );
getch();
// Put the pad text back. Now we have both text areas!
// (pnotrefresh() does nothing here)
prefresh( pad, 0,0,0,0,10,60 );
// getch() doesn't obliterate pad this time.
getch();
return 0;
}
---
William Morris
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problems with pads,
Morris, William <=