Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

light bar menus in c

Status
Not open for further replies.

subra

Programmer
Aug 6, 2000
45
IN
I am a new C programmer. I had written some code for a light bar menu as given below.

void main()
{
static int colno = 1, rowno = 1, optsize, true = 1, arrsize ;
static int i, current = 0, previous = 1, response = 0, interim = 0 ;
static char *blank=" " ;
static char *menu[5][2] = {
{ "Extract ", "Extract data from txndata.btr " },
{ "Database ", "Create database from saved file" },
{ "Report ", "Create a report of transactions" },
{ "Jobstream ", "Create jobstream from database " },
{ "Quit ", "Work over! Quit the program " }
} ;

void makesa() ;
void makedb() ;
void makejs() ;
void makerp() ;
int inkey() ;
int isempty( char *chkstr) ;

_setcursortype(_NOCURSOR) ;
optsize = strlen(menu[0][0]) ;
arrsize = sizeof(menu)/4 ;
while (true==1)
{
CYAN ;
clrscr() ;
MAGENTA ;
gotoxy(0,0) ;
cprintf("%160.160s\r\n",blank) ;

for (i=0;i<arrsize;i++)
{
gotoxy((colno+i*optsize),rowno) ;
puts(menu[PROMPT]) ;
} // for (i=0;...)
HIGHLIGHT ;
gotoxy((colno+current*optsize),rowno) ;
cprintf(menu[current][PROMPT]) ;
MAGENTA ;
gotoxy(1,rowno+1) ;
cprintf(menu[current][MESSAGE]) ;
response = 0 ;
while (response!=13)
{
response = inkey() ;
interim = previous ;
previous = current ;
switch (response)
{
case 77 :
current >= 4 ? current = 0 : current++ ;
break ;
case 75 :
current <= 0 ? current = 4 : current-- ;
break ;
case 69 :
case 101:
current = 0 ;
response = 13 ;
break ;
case 68 :
case 100:
current = 1 ;
response = 13 ;
break ;
case 82 :
case 114:
current = 2 ;
response = 13 ;
break ;
case 74 :
case 106:
current = 3 ;
response = 13 ;
break ;
case 81 :
case 113:
current = 4 ;
response = 13 ;
break ;
default :
current = previous ;
previous = interim ;
} // switch(response)
HIGHLIGHT ;
gotoxy((colno+current*optsize),rowno) ;
cprintf(menu[current][PROMPT]) ;
MAGENTA ;
gotoxy(1,rowno+1) ;
cprintf(menu[current][MESSAGE]) ;
gotoxy((colno+previous*optsize),rowno) ;
cprintf(menu[previous][PROMPT]) ;
} // (response!=13)
NORMAL ;
clrscr() ;
_setcursortype(_NORMALCURSOR) ;

and then the switch statements.

The code works fine in a stand alone machine. When the program is run on the network (Novell 4.11) the repainting of the menu highlights goes awry. Can anybody tell me why?
The code works, only the screen repainting does not work well.

Subra if you find this useful let me know at vksubra@usa.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top