/* EXAMPLE 9: Window-relative writing routines ----------------------------------------------------------------------*/ #include #include #include "wndwc20.h" char *s1,*s2,*s3,s4[80]; int r1,r2; char ch; void main() { qinit(); initwindow( LIGHTGRAY_BG, 1, 0 ); makewindow( 5, 20, 15, 40, WHITE+BLUE_BG, CYAN+BLUE_BG, SINGLE_BORDER, WINDOW1 ); s1 = " a:\\long\\long\\filename"; s2 = " a:\\shorter\\filename"; s3 = " error message"; r1 = 1; r2 = 14330; wwrite ( 2, 2, "File name: " ); wclreos ( LIGHTGRAY_BG ); /* Clear first field */ qwriteeos ( SAMEATTR, s1 ); /* Put in file name */ wwrite ( 3, 2, "Status" ); wclrfield ( 3, 13, 20, LIGHTGRAY_BG ); /* Clear second field */ qwriteeos ( SAMEATTR, s3 ); /* Put in status message */ wwrite ( 4, 2, "Quantity: " ); wclrfieldeos( 20, LIGHTGRAY_BG ); /* Clear third field */ sprintf( s4, "%19d", r1 ); /* Put in formatted data */ qwriteeos( SAMEATTR, s4 ); eostorcrel( 0, -1 ); /* Shift EOS back one space */ wgotoeos(); titlewindow( BOTTOM, CENTER, YELLOW+BLUE_BG+BLINK, " Press any key " ); while(getch() == 0); wclrtitle( BOTTOM ); tws.wndwattr = SAMEATTR; /* Keeps field attributes intact */ wwrite ( 2, 13, s2 ); wclreos ( SAMEATTR ); /* Clears remainder of long filename */ wclreol ( 3, 13, SAMEATTR ); /* Clears beyond field, But A OK! */ sprintf ( s4, "%19d", r2 ); wwrite ( 4, 13, s4 ); /* Overwrites new data */ tws.wndwattr = tws.origattr; /* Restore window attribute */ getch(); }