home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / textwndw.swg / 0006_WINDOWS3.PAS.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-28  |  2.0 KB  |  76 lines

  1. DS>  Like say there is a Text Window that pops up when someone makes a
  2. DS>choice. Then they select something else and a Text Window is made that
  3. DS>overlaps the previous one.  Then I'd like to have it so if the user
  4. DS>were to press, say, escape, the current Text Window would be "removed"
  5. DS>and the old Window would still be there as is was....
  6. DS>How can this be done??  Please keep in mind that I'm still sort of
  7.  
  8. Here's two Procedures a friend of mine wrote (David Thomas: give credit
  9. whree credit is due).  It works great With regular Text screens.
  10.  
  11.  
  12. Put This in you Type section:
  13.  
  14.   WindowStatus = (OnScreen, OffScreen);
  15.   WindowType = Record
  16.                  Point    : Pointer;
  17.                  Status   : WindowStatus;
  18.                  Col,
  19.                  Row,
  20.                  SaveAttr : Byte;
  21.                end;
  22.  
  23. Procedure GetWindow (Var Name : WindowType);
  24. Var
  25.   Size,
  26.   endOffset,
  27.   StartOffset  : Integer;
  28. begin   { GetWindow }
  29.  
  30.   With Name Do
  31.     begin
  32.       Col := WhereX;
  33.       Row := WhereY;
  34.       SaveAttr := TextAttr;
  35.  
  36.       StartOffset := 0;
  37.       endOffset   := 25 * 160;
  38.       Size := endOffset - StartOffset;
  39.       GetMem (Point, Size);
  40.  
  41.       Move (Mem[$B800:StartOffset], Point^, Size);
  42.       Status := OnScreen;
  43.     end; { With }
  44.  
  45. end;    { GetWindow }
  46. {--------------------------------------------------------------------}
  47. Procedure PutWindow (Var Name : WindowType);
  48. Var
  49.   Size,
  50.   endOffset,
  51.   StartOffset  : Integer;
  52. begin   { PutWindow }
  53.  
  54.   With Name Do
  55.     begin
  56.       StartOffset := 0;
  57.       endOffset   := 25 * 160;
  58.       Size := endOffset - StartOffset;
  59.  
  60.       Move (Point^, Mem[$B800:StartOffset], Size);
  61.  
  62.       FreeMem (Point, Size);
  63.       Status := OffScreen;
  64.  
  65.       TextAttr := SaveAttr;
  66.       GotoXY (Col, Row);
  67.     end; { With }
  68.  
  69. end;    { PutWindow }
  70.  
  71.  
  72. Very easy to use.  Just declare a Varibale of WindowType, call the
  73. GETWindow routine, then display whatever.  When you're done, call the
  74. PUTWindow routine and it Zap, it's back to how it was.  Very face, very
  75. nice.
  76.