[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with pads .....
From: |
Ben Duncan |
Subject: |
Problem with pads ..... |
Date: |
Wed, 08 Apr 2009 08:49:08 -0500 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081209) |
Ok, I have the following attached PADS demo program.
No matter what I do, prefresh refuses to display properly and
truncates the "PAD" area.
Am I doing something wrong, or is this a Bug ?
Thanks ....
--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
- Hanlon's Razor
/*
***** A Little PAD testing program
* compile with: gcc -lncursesw -lpanelw -o testpad testpad.c
*/
#include <locale.h>
#include <curses.h>
#include <panel.h>
#include <stdlib.h>
#define ENTER 10
#define ESCAPE 27
#define WIDTH 40
#define HEIGHT 15
int startx = 0;
int starty = 0;
char *choicesa[] = { "Choice A1",
"Choice A2",
"Choice A3",
"Choice A4",
"Exit",
};
char *choicesb[] = { "NEW Choice B1",
"NEW Choice B2",
"NEW Choice B3",
"NEW Choice B4",
"NEW Choice B5",
"NEW Choice B6",
"NEW Choice B7",
"NEW Choice B8",
"Exit",
};
int a_choices = sizeof ( choicesa ) / sizeof ( char * );
int b_choices = sizeof ( choicesb ) / sizeof ( char * );
void print_wina( WINDOW * menu_win, int highlight );
void print_winb( WINDOW * menu_win, int highlight );
void init_curses ( )
{
initscr ( );
start_color ( );
init_pair ( 1, COLOR_WHITE, COLOR_BLUE );
init_pair ( 2, COLOR_BLUE, COLOR_WHITE );
init_pair ( 3, COLOR_RED, COLOR_WHITE );
curs_set ( 0 );
noecho ( );
keypad ( stdscr, TRUE );
}
int main ( )
{
int key;
int ROWSIZE = 0 ;
int COLSIZE = 0 ;
int ROWLOC = 0 ;
int COLLOC = 0 ;
setlocale(LC_ALL, "");
WINDOW *mypad_a ;
WINDOW *mypad_b ;
init_curses ( );
bkgd ( COLOR_PAIR ( 1 ) );
move ( 2, 1 );
printw ( "Let us test pads now " );
refresh ( );
key = getch ( );
/* PANEL TEST */
ROWSIZE = 4 ;
COLSIZE = 10 ;
ROWLOC = 4 ;
COLLOC = 10 ;
mypad_a = newpad( ROWSIZE + 1 , COLSIZE + 1 ) ;
print_wina ( mypad_a, 1 );
prefresh (mypad_a, 0, 0, ROWLOC, COLLOC, 100 , 100 ) ;
key = getch ( );
ROWSIZE = 12 ;
COLSIZE = 30 ;
ROWLOC = 8 ;
COLLOC = 14 ;
mypad_b = newpad( ROWSIZE , COLSIZE ) ;
print_winb ( mypad_b, 1 );
prefresh (mypad_b, 0, 0, ROWLOC, COLLOC, ROWSIZE, COLSIZE) ;
key = getch ( );
endwin ( );
return 0;
}
void print_wina ( WINDOW * win, int highlight )
{
int x, y, i;
x = 1;
y = 1;
/*
box ( win, 0, 0 );
*/
for ( i = 0; i < a_choices; ++i )
{
if ( highlight == i + 1 )
{
wattron ( win, A_REVERSE );
mvwprintw ( win, y, x, "%s", choicesa[i] );
wattroff ( win, A_REVERSE );
}
else
mvwprintw ( win, y, x, "%s", choicesa[i] );
++y;
}
}
void print_winb ( WINDOW * win, int highlight )
{
int x, y, i;
x = 1;
y = 1;
/*
box ( win, 0, 0 );
*/
for ( i = 0; i < b_choices; ++i )
{
if ( highlight == i + 1 )
{
wattron ( win, A_REVERSE );
mvwprintw ( win, y, x, "%s", choicesb[i] );
wattroff ( win, A_REVERSE );
}
else
mvwprintw ( win, y, x, "%s", choicesb[i] );
++y;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problem with pads .....,
Ben Duncan <=