home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / compiler / doobject / box.do < prev    next >
Text File  |  1991-07-25  |  649b  |  35 lines

  1. /*
  2.     draw a box in textmode
  3.     first, define some box-drawing characters
  4. */
  5. #define UR 187
  6. #define LR 188
  7. #define LL 200
  8. #define UL 201
  9. #define HORIZ 205
  10. #define VERT 186
  11. #define ESC 27
  12.  
  13. /*
  14.     define a method for drawing a box on a window
  15. */
  16. method Window::drawBox(self,r,c,h,w)
  17. {
  18.     horiz = chr(HORIZ);
  19.     vert = chr(VERT);
  20.     
  21.     say(r,c,chr(UL)); 
  22.     for(i=c+1;i<(w+r);i=i+1) say(r,i,horiz);
  23.     say(r,i,chr(UR));
  24.     for(j=r+1;j<(r+h);j=j+1) say(j,i,vert);
  25.     say(j,i,chr(LR));
  26.     for(i=i-1;i>c;i=i-1) say(j,i,horiz);
  27.     say(j,i,chr(LL));
  28.     for(j=j-1;j>r;j=j-1) say(j,i,vert);
  29. }
  30.  
  31. /*
  32.     draw a test box
  33. */
  34. drawBox(currentWindow(),5,5,10,40);
  35.