home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boldly Go Collection
/
version40.iso
/
TS
/
17A
/
DRWIN101.ZIP
/
WTEST.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-23
|
2KB
|
101 lines
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include "strutil.h"
#include "scrutil.h"
#include "wutil.h"
#include "menutil.h"
WIND *w;
char done=0;
int val=0;
char incline[40]="&Increment";
MENU_LIST incl[]={
{ "Inc by &1", NULL, MEN_CLOSE },
{ "Inc by &2", NULL, MEN_CLOSE },
{ NULL,NULL,0 }
}; /*incl*/
MENU_DESC incd={
incl, NULL,1,
-1,-1,0,0,0,0,0
}; /*incd*/
void incval(MENU_DESC* m)
{
if (menvert(&incd)>=0) val += incd.cur+1;
wprintf(w,"Value is now %d\n",val);
sprintf(incline,"&Increment v:%+05d",val);
if (m) return;
} /*incval*/
void decval(MENU_DESC* m) {
val--;
wprintf(w,"Value is now %d\n",val);
sprintf(incline,"&Increment v:%+05d",val);
if (m) return;
} /*decval*/
MENU_LIST mainl[]={
{ incline, incval, MEN_NEXT },
{ "&Decrement", decval, 0 },
{ "e&Xit", NULL, MEN_CLOSE },
{ NULL, NULL, 0 }
}; /*mainl*/
MENU_DESC maind={
mainl, /*list of menu headings/functions*/
#if 0
"Manipulate",1, /*title, border=0,1,2*/
23, 15, 0, ATTR(BLACK,LIGHTGRAY), /*row,col,width,attribute*/
ATTR(WHITE,BLUE), /*attribute for border/title*/
ATTR(WHITE,BLACK), /*attribute for selected text*/
ATTR(RED,LIGHTGRAY) /*attribute for hotkey chars*/
#else
NULL,1,-1,-1,0,0,0,0,0
#endif
};
void main(void)
{
char s[80]="hahaha! this is a test string";
int row=3;
if (!winit()) return;
wscr->attr=ATTR(BLACK,BLUE);
wscr->fchr=0xB1;
wclr(wscr);
w=wopen(2," Overlaps ", row,10, 20,60, ATTR(WHITE,MAGENTA));
sprintf(incline,"&Increment v:%6d",val);
menvert(&maind);
wprintf(w,"\nEnter: ");
wgetsfield(w,s,sizeof(s),0,ATTR(WHITE,MAGENTA));
wfile(w,"wutil.c");
wpurge();
} /*main*/