home *** CD-ROM | disk | FTP | other *** search
- SWAGOLX.EXE (c) 1993 GDSOFT ALL RIGHTS RESERVED 00007 TEXT WINDOWING ROUTINES 1 05-28-9314:08ALL SWAG SUPPORT TEAM EXECWIN.PAS IMPORT 78 {$A+,B-,D+,E-,F-,G-,I-,L-,N-,O-,P-,Q-,R-,S-,T-,V-,X+,Y-}π{$M 16384,0,655360}πUnit ExecWin;πInterfaceπVar SaveInt10 : Pointer;ππProcedure ExecWindow(X1,Y1,X2,Y2,π Attr : Byte;π Path,CmdLine : String);ππImplementationπUsesπ Crt,Dos;πTypeπ PageType = Array [1..50,1..80] of Word;πVarπ Window : Recordπ X1,Y1,X2,Y2,π Attr : Byte;π CurX,CurY : Byte;π end;π Regs : Registers;π Cleared : Boolean;π Screen : ^PageType;π ActPage,π VideoMode : ^Byte;π {$ifOPT D+}π Fnc,π OldFnc : Byte;π {$endif}ππ{$ifOPT D+}πFunction FStr(Num : LongInt) : String;πVarπ Dummy : String;πbeginπ Str(Num,Dummy);π FStr := Dummy;πend;ππProcedure WriteXY(X,Y,Attr : Byte;TextStr : String);πVarπ Loop : Byte;πbeginπ if Length(TextStr)>0 thenπ beginπ Loop := 0;π Repeatπ Inc(Loop);π Screen^[Y,X+(Loop-1)] := ord(TextStr[Loop])+Word(Attr SHL 8);π Until Loop=Length(TextStr);π end;πend;π{$endif}ππProcedure ScrollUp(X1,Y1,X2,Y2,Attr : Byte); Assembler;πAsmπ mov ah,$06π mov al,$01π mov bh,Attrπ mov ch,Y1π mov cl,X1π mov dh,Y2π mov dl,X2π dec chπ dec clπ dec dhπ dec dlπ int $10πend;ππProcedure ClearXY(X1,Y1,X2,Y2,Attr : Byte); Assembler;πAsmπ mov ah,$06π mov al,$00π mov bh,Attrπ mov ch,Y1π mov cl,X1π mov dh,Y2π mov dl,X2π dec chπ dec clπ dec dhπ dec dlπ int $10πend;ππ{$ifOPT D+}πProcedure Beep(Freq,Delay1,Delay2 : Word);πbeginπ Sound(Freq);π Delay(Delay1);π NoSound;π Delay(Delay2);πend;π{$endif}ππ{$F+}πProcedure NewInt10(Flags,CS,IP,AX,BX,CX,π DX,SI,DI,DS,ES,BP : Word); Interrupt;πVarπ X, Y, X1,π Y1, X2, Y2 : Byte;π Loop, DummyW : Word;πbeginπ SetIntVec($10,SaveInt10);π {$ifOPT D+}π Fnc := Hi(AX);π if Fnc<>OldFnc thenπ beginπ WriteXY(1,1,14,'Coordinates:');π WriteXY(20,1,14,'Register:');π WriteXY(20,2,14,'AH: '+FStr(Hi(AX))+' ');π WriteXY(20,3,14,'AL: '+FStr(Lo(AX))+' ');π WriteXY(20,4,14,'BH: '+FStr(Hi(BX))+' ');π WriteXY(20,5,14,'BL: '+FStr(Lo(BX))+' ');π WriteXY(30,2,14,'CH: '+FStr(Hi(CX))+' ');π WriteXY(30,3,14,'CL: '+FStr(Lo(CX))+' ');π WriteXY(30,4,14,'DH: '+FStr(Hi(DX))+' ');π WriteXY(30,5,14,'DL: '+FStr(Lo(DX))+' ');π Case Fnc ofπ $0 : WriteXY(40,1,14,'Set video mode. ');π $1 : WriteXY(40,1,14,'Set cursor shape. ');π $2 : WriteXY(40,1,14,'Set cursor position. ');π $3 : WriteXY(40,1,14,'Get cursor position. ');π $4 : WriteXY(40,1,14,'Get lightpen position. ');π $5 : WriteXY(40,1,14,'Set active page. ');π $6 : WriteXY(40,1,14,'Scroll up lines. ');π $7 : WriteXY(40,1,14,'Scroll down lines. ');π $8 : WriteXY(40,1,14,'Get Character/attribute. ');π $9 : WriteXY(40,1,14,'Write Character/attribute. ');π $A : WriteXY(40,1,14,'Write Character. ');π $D : WriteXY(40,1,14,'Get pixel in Graphic mode. ');π $E : WriteXY(40,1,14,'Write Character. ');π $F : WriteXY(40,1,14,'Get video mode. ');π else WriteXY(40,1,14,'(unknown/ignored Function) ');π end;π Case Hi(AX) ofπ $0..$E : Beep(Hi(AX)*100,2,5);π else beginπ Beep(1000,50,0);π Repeat Until ReadKey<>#0;π end;π end;π end;π {$endif}π Case Hi(AX) ofπ $00 : beginπ ClearXY(Window.X1,Window.Y1,Window.X2,Window.Y2,Window.Attr);π GotoXY(Window.X1,Window.Y1);π Window.CurX := Window.X1;π Window.CurY := Window.Y1;π end;π $01 : beginπ Regs.AH := $01;π Regs.CX := CX;π Intr($10,Regs);π end;π $02 : beginπ X := Lo(DX);π Y := Hi(DX);π Window.CurX := X+1;π if Cleared thenπ beginπ Window.CurY := Window.Y1;π Cleared := False;π endπ else Window.CurY := Y+1;π if Window.CurX<=Window.X2 thenπ beginπ Regs.AH := $02;π Regs.BH := ActPage^;π Regs.DL := X;π Regs.DH := Y;π Intr($10,Regs);π end;π end;π $03 : beginπ Regs.AH := $03;π Regs.BH := ActPage^;π Intr($10,Regs);π DX := (Window.X1-Regs.DL)+((Window.Y1-Regs.DH) SHL 8);π CX := Regs.CX;π end;π $04 : AX := Lo(AX);π $06 : beginπ X1 := Window.X1+Lo(CX)-1;π Y1 := Window.Y1+Hi(CX)-1;π X2 := Window.X2+Lo(DX)-1;π Y2 := Window.Y2+Hi(DX)-1;π if Lo(AX)=0 thenπ beginπ ClearXY(Window.X1,Window.Y1,π Window.X2,Window.Y2,Window.Attr);π GotoXY(Window.X1,Window.Y1);π Window.CurX := Window.X1;π Window.CurY := Window.Y1;π Cleared := True;π endπ elseπ beginπ if X2>Window.X2 then X2 := Window.X2;π if Y2>Window.Y2 then Y2 := Window.Y2;π Regs.AH := $06;π Regs.AL := Lo(AX);π Regs.CL := X1;π Regs.CH := Y1;π Regs.DL := X2;π Regs.DH := Y2;π Regs.BH := Window.Attr;π Intr($10,Regs);π end;π end;π $07 : beginπ X1 := Window.X1+Lo(CX)-1;π Y1 := Window.Y1+Hi(CX)-1;π X2 := Window.X2+Lo(DX)-1;π Y2 := Window.Y2+Hi(DX)-1;π if X2>Window.X2 thenπ X2 := Window.X2;π if Y2>Window.Y2 thenπ Y2 := Window.Y2;π Regs.AH := $07;π Regs.AL := Lo(AX);π Regs.CL := X1;π Regs.CH := Y1;π Regs.DL := X2;π Regs.DH := Y2;π Regs.BH := Window.Attr;π Intr($10,Regs);π end;π $08 : beginπ Regs.AH := $08;π Regs.BH := ActPage^;π Intr($10,Regs);π AX := Regs.AX;π end;π $09,π $0A : beginπ Regs.AH := $09;π Regs.BH := ActPage^;π Regs.CX := CX;π Regs.AL := Lo(AX);π Regs.BL := Window.Attr;π Intr($10,Regs);π end;π $0D : AX := Hi(AX) SHL 8;π $0D : AX := Hi(AX) SHL 8;π $0E : beginπ Case Lo(AX) ofπ 7 : Write(#7);π 13 : beginπ Window.CurX := Window.X1-1;π if Window.CurY>=Window.Y2 thenπ beginπ Window.CurY := Window.Y2-1;π ScrollUp(Window.X1,Window.Y1,π Window.X2,Window.Y2,Window.Attr);π end;π end;π elseπ beginπ Regs.AH := $0E;π Regs.AL := Lo(AX);π Regs.BL := Window.Attr;π Intr($10,Regs);π end;π end;π Inc(Window.CurX);π GotoXY(Window.CurX,Window.CurY);π end;π $0F : beginπ AX := $03+(80 SHL 8);π BX := Lo(BX);π end;π elseπ beginπ Regs.AX := AX;π Regs.BX := BX;π Regs.CX := CX;π Regs.DX := DX;π Regs.SI := SI;π Regs.DI := DI;π Regs.DS := DS;π Regs.ES := ES;π Regs.BP := BP;π Regs.Flags := Flags;π Intr($10,Regs);π AX := Regs.AX;π BX := Regs.BX;π CX := Regs.CX;π DX := Regs.DX;π SI := Regs.SI;π DI := Regs.DI;π DS := Regs.DS;π ES := Regs.ES;π BP := Regs.BP;π Flags := Regs.Flags;π end;π end;π {$ifOPT D+}π if Fnc<>OldFnc thenπ beginπ WriteXY(1,2,14,FStr(Window.CurX)+':'+FStr(Window.CurY)+' ');π WriteXY(1,3,14,FStr(Window.CurX-Window.X1+1)+':'+π FStr(Window.CurY-Window.Y1+1)+' ');π WriteXY(40,2,14,'AH: '+FStr(Hi(AX))+' ');π WriteXY(40,3,14,'AL: '+FStr(Lo(AX))+' ');π WriteXY(40,4,14,'BH: '+FStr(Hi(BX))+' ');π WriteXY(40,5,14,'BL: '+FStr(Lo(BX))+' ');π WriteXY(50,2,14,'CH: '+FStr(Hi(CX))+' ');π WriteXY(50,3,14,'CL: '+FStr(Lo(CX))+' ');π WriteXY(50,4,14,'DH: '+FStr(Hi(DX))+' ');π WriteXY(50,5,14,'DL: '+FStr(Lo(DX))+' ');π OldFnc := Fnc;π end;π {$endif}π SetIntVec($10,@NewInt10);πend;π{$F-}ππProcedure ExecWindow;πbeginπ Window.X1 := X1;π Window.Y1 := Y1;π Window.X2 := X2;π Window.Y2 := Y2;π Window.Attr := Attr;π {$ifOPT D+}π Fnc := 255;π OldFnc := 255;π {$endif}π ClearXY(Window.X1,Window.Y1,π Window.X2,Window.Y2,Window.Attr);π GotoXY(Window.X1,Window.Y1);π Window.CurX := Window.X1;π Window.CurY := Window.Y1;π SwapVectors;π GetIntVec($10,SaveInt10);π SetIntVec($10,@NewInt10);π Exec(Path,CmdLine);π SetIntVec($10,SaveInt10);π SwapVectors;πend;ππbeginπ Window.X1 := Lo(WindMin);π Window.Y1 := Hi(WindMin);π Window.X2 := Lo(WindMax);π Window.Y2 := Hi(WindMax);π Window.Attr := TextAttr;π Window.CurX := WhereX;π Window.CurY := WhereY;π Cleared := False;π ActPage := Ptr(Seg0040,$0062);π VideoMode := Ptr(Seg0040,$0049);π if VideoMode^=7 thenπ Screen := Ptr(SegB000,$0000)π elseπ Screen := Ptr(SegB800,$0000);πend.π 2 05-28-9314:08ALL SWAG SUPPORT TEAM SHADOW1.PAS IMPORT 10 {π> I Write the following Procedure to shadow Text behind a box. It worksπ> fine (so Far), but am not sure if there is a quicker, easier way.ππYou are searching through the video-RAM For the Char and Attr, you want toπchange. Perhaps, it is easier and faster to use the interrupt, that returnsπyou the Char under the Cursor , than you can change the attribute.π}πUsesπ Dos, Crt;ππProcedure Shadow(x1, y1, x2, y2 : Byte);πVarπ s, i, j : Byte;ππ Procedure Z(x, y : Byte);π Varπ r : Registers;π beginπ r.ah := $02;π { Function 2hex (Put Position of Cursor) }π r.bh := 0;π r.dh := y - 1; { Y-Position }π r.dl := x - 1; { X-Position }π intr($10,r);π r.ah := $08;π { Fkt. 8hex ( Read Char under cursor ) }π r.bh := 0;π intr($10, r);π Write(chr(r.al));π end;ππbeginπ s := TextAttr; { save Attr }π TextAttr := 8;π For i := y1 + 1 to y2 + 1 doπ For j := x1 + 1 to x2 + 1 doπ z(i, j);π TextAttr := s; { Attr back }πend;ππbeginπ Shadow(10,10,20,20);π ReadKey;πend. 3 05-28-9314:08ALL SWAG SUPPORT TEAM SHADOW2.PAS IMPORT 8 {πI Write the following Procedure to shadow Text behind a box. It worksπfine (so Far), but am not sure if there is a quicker, easier way.π}ππProcedure Shadow(x, y, xlength, ylength : Byte);πVarπ xshad,π yshad : Word;π i : Byte;πbeginπ xlength := xlength shl 1; { xlength * 2 }π xshad := ((x*2)+(y*160)-162) + ((ylength+1) * 160) + 4; { x coord }π yshad := ((x*2)+(y*160)-162) + (xlength); { y coord }π if Odd(Xshad) then Inc(XShad); { we want attr not Char }π if not Odd(YShad) then Inc(YShad); { " }π For i := 1 to xlength Doπ if Odd(i) thenπ Mem[$B800:xshad+i] := 8; { put x shadow }π For i := 1 to ylength Doπ beginπ Mem[$B800:yshad+(i*160)] := 8; { put y shadows }π Mem[$B800:yshad+2+(i*160)] := 8π endπend;π 4 05-28-9314:08ALL SWAG SUPPORT TEAM WINDOWS1.PAS IMPORT 38 {π> Okay...it works fine, but I want to somehow be able to kindo of remove tπ> Window. I'm not sure if there is any way of doing this?ππYou need to save the screen data at the location you wish to makeπa Window, then after you're done With the Window simply restoreπthe screen data back to what it was. Here's some exampleπroutines of what you can do, you must call InitWindows once atπthe begining of the Program before using the OpenWindowπProcedure, then CloseWindow to restore the screen.π}ππUsesπ Crt;ππTypeπ ShadeType = (Shading, NoShading);π ScreenBlock = Array [1..2000] of Integer;π ScreenLine = Array [1..80] of Word;π ScreenArray = Array [1..25] of ScreenLine;π WindowLink = ^WindowControlBlock;π WindowControlBlock = Recordπ X,Y : Byte; { start position }π Hight : Byte; { Menu Hight }π Width : Byte; { Menu width }π ID : Byte; { Menu number }π BackLink : WindowLink; { previous block }π MenuItem : Byte; { select item }π ScreenData : ScreenBlock; { saved screen data }π end;π String30 = String[30];π ScreenPtr = ^ScreenRec;π ScreenRec = Array [1..25,1..80] of Integer;πππVarπ Screen : ScreenPtr;π ActiveWindow : Pointer;ππProcedure InitWindows;πbeginπ If LastMode = Mono Thenπ Screen := Ptr($B000,0)π Elseπ Screen := Ptr($B800,0);π ActiveWindow := Nil;πend;ππProcedure OpenWindow(X, Y, Lines, Columns, FrameColor,π ForeGround, BackGround : Byte;π Title : String30; Shade : ShadeType);πVarπ A, X1, X2,π Y1, Y2 : Integer;π OldAttr : Integer;π WindowSize : Integer;π Block : WindowLink;πbeginπ OldAttr := TextAttr;ππ WindowSize := (Lines + 3) * (Columns + 5) * 2 +π Sizeof(WindowControlBlock) - Sizeof(ScreenBlock);ππ If MemAvail < WindowSize Thenπ beginπ WriteLn;WriteLn('Program out of memory');π Halt;π end;ππ GetMem(Block,WindowSize);π Block^.X := X - 2;π Block^.Y := Y - 1;π Block^.Hight := Lines + 3;π Block^.Width := Columns + 5;π Block^.BackLink := ActiveWindow;ππ ActiveWindow := Block;π A := 1;π For Y1 := Block^.Y to Block^.Y+Block^.Hight-1 Doπ beginπ Move(Screen^[Y1, Block^.X], Block^.ScreenData[A], Block^.Width * 2);π A := A + Block^.Width;π end;ππ TextColor(FrameColor);π If BackGround = Black Thenπ TextBackGround(LightGray) { This will keep exploding Window visable }π Elseπ TextBackground(BackGround);ππ X1 := X + Columns Div 2;π X2 := X1 + 1;π Y1 := Y + Lines Div 2;π Y2 := Y1 + 1;ππ Repeatπ Window(X1, Y1, X2, Y2);π ClrScr;π If Columns < 20 Thenπ Delay(20);π If X1 > X Thenπ Dec(X1);π If X2 < X + Columns Thenπ Inc(X2);π If Y1 > Y Thenπ Dec(Y1);π If Y2 < Y + Lines Thenπ Inc(Y2);π Until (X2 - X1 >= Columns ) And (Y2 - Y1 >= Lines);ππ Window(X - 1, Y, X + Columns, Y + Lines);π TextBackground(BackGround);π ClrScr;π TextColor(FrameColor);π Window(1, 1, 80, 24);π GotoXY(X - 2, Y - 1);π Write('┌');π For A := 1 to Columns + 2 Doπ Write('─');ππ Write('┐');π For A := 1 to Lines Doπ beginπ GotoXY(X - 2, Y + A - 1);π Write('│');π GotoXY(X + Columns + 1, Y + A - 1);π Write('│');π end;π GotoXY(X - 2, Y + Lines);π Write('└');π For A := 1 to Columns + 2 Doπ Write('─');π Write('┘');π If Shade = Shading Thenπ beginπ For A := Y to Y + Lines + 1 Doπ Screen^[A, X + Columns + 2] := Screen^[A, X + Columns + 2] And $07FF;π For A := X - 1 to X + Columns + 1 Doπ Screen^[Y + Lines + 1, A] := Screen^[Y + Lines + 1, A] And $07FF;π end;π If Title <> '' Thenπ beginπ TextColor(FrameColor);π GotoXY(X + ((Columns - Length(Title)) div 2) - 1, Y - 1);π Write(' ', Title, ' ');π end;π Window(1, 1, 80, 24);πend;ππProcedure CloseWindow;πVarπ Block : WindowLink;π A : Integer;π Y1 : Integer;π WindowSize : Integer;πbeginπ If ActiveWindow = Nil Thenπ Exit;π Block := ActiveWindow;π WindowSize := (Block^.Hight) * (Block^.Width) * 2 +π Sizeof(WindowControlBlock) - Sizeof(ScreenBlock);π A := 1;π For Y1 := Block^.Y to Block^.Y+Block^.Hight - 1 Doπ beginπ Move(Block^.ScreenData[A], Screen^[Y1, Block^.X], Block^.Width * 2);π A := A + Block^.Width;π end;π ActiveWindow := Block^.BackLink;π FreeMem(Block, WindowSize);πend;ππbeginπ InitWindows;π OpenWindow(10, 5, 10, 50, LightGreen, LightBlue, Magenta,π 'Test Window', Shading);π ReadKey;π OpenWindow(20, 6, 6, 30, Green, Yellow, Blue,π 'Test Window 2', Shading);π ReadKey;π CloseWindow;π ReadKey;π CloseWindow;π ReadKey;π GotoXY(1,24);ππend.π 5 05-28-9314:08ALL SWAG SUPPORT TEAM WINDOWS2.PAS IMPORT 37 Uses Crt;ππTypeππ BufferType = Array[0..3999] of Byte; { screen size }π PtrBufferType = ^BufferType; { For dynamic use }ππVarπ Screen: BufferType Absolute $B800:$0; { direct access to }π { Text screen }ππFunction CharS(Len:Byte; C: Char): String;πVarπ S: String;πbegin { This Function returns a String of }π FillChar(S, Len+1, C); { Length Len and of Chars C. }π S[0] := Chr(Len);π CharS := S;πend;ππFunction Center(X1, X2: Byte; S: String): Byte;πVarπ L, Max: Integer;πbegin { This Function is used to center }π Max := (X2 - (X1-1)) div 2; { a String between two X coordinates. }π L := Length(S);π if Odd(L) then Inc(L);π Center := X1 + (Max - (L div 2));πend;πππProcedure DrawBox(X1, Y1, X2, Y2: Integer; Attr: Byte; Title: String);πVarπ L, Y, X: Integer;π S: String;ππbeginπ X := X2 - (X1-1); { find box width }π Y := Y2 - (Y1-1); { find box height }π { draw box }π S := Concat('╔', CharS(X-2, '═'), '╗');π GotoXY(X1, Y1);π TextAttr := Attr;π Write(S);π Title := Concat('╡ ', Title,' ╞');π GotoXY(Center(X1, X2, Title), Y1);π Write(Title);π For L := 2 to (Y-1) doπ beginπ GotoXY(X1, Y1+L-1);π Write('║', CharS(X-2, ' '), '║');π end;π GotoXY(X1, Y2);π Write('╚', CharS(X-2, '═'), '╝');ππend;ππProcedure SaveBox(X1, Y1, X2, Y2: Integer; Var BufPtr: PtrBufferType);πVarπ Poff, Soff, Y, XW, YW, Size: Integer;ππbeginπ XW := X2 - (X1 -1); { find box width }π YW := Y2 - (Y1 -1); { find box height }π Size := (XW*2 ) * YW; { size needed to store background }π GetMem(BufPtr, Size); { allocate memory to buffer }π For Y := 1 to YW do { copy line by line to buffer }π beginπ Soff := (((Y1-1) + (Y-1)) * 160) + ((X1-1)*2);π Poff := ((XW * 2) * (Y-1));π Move(Screen[Soff], BufPtr^[Poff], (XW * 2)); { Write to buffer }π end;πend;ππ(*************** end of PART 1 of 2. *****************************)π(****** PART 2 of 2 ********************************)πProcedure RestoreBox(X1, Y1, X2, Y2: Integer; Var BufPtr: PtrBufferType);πVarπ Poff, Soff, X, Y, XW, YW, Size: Integer;π F: File;ππbeginπ XW := X2 - (X1-1); { once again...find box width }π YW := Y2 - (Y1-1); { find height }π Size := (XW *2) * YW; { memory size to deallocate from buffer }π For Y := 1 to YW do { move back, line by line }π beginπ Soff := (( (Y1-1) + (Y-1)) * 160) + ((X1-1)*2);π Poff := ((XW*2) * (Y-1));π Move(BufPtr^[Poff], Screen[Soff], (XW*2));π end;π FreeMem(BufPtr, Size);πend;πππProcedure Shadow(X1, Y1, X2, Y2: Byte);πVarπ Equip: Byte Absolute $40:$10;π Vert, Height, offset: Integer;ππbeginπ if (Equip and 48) = 48 then Exit;ππ For Vert := (Y1+1) to (Y2+1) doπ For Height := (X2+1) to (X2+2) doπ beginπ offset := (Vert - 1) * 160 + (Height-1) * 2 + 1;π Screen[offset] := 8;π end;π Vert := Y2 + 1;π For Height := (X1+2) to (X2+2) doπ beginπ offset := (Vert-1) * 160 + (Height-1) * 2 + 1;π Screen[offset] := 8;π end;πend;ππProcedure Hello;πVarπ BufPtr: PtrBufferType;πbeginπ { note, that if you use shadow, save an xtra 2 columnsπ and 1 line to accomadate what Shadow does }π { V V }π SaveBox(7, 7, 73, 15, BufPtr);π DrawBox(7, 7, 71, 13, $4F, 'Hello');π Shadow(7, 7, 71, 13);π GotoXY(9, 9);π Write('Hello Terry! I hope this is what you were asking For.');π GotoXY(9, 11);π Write('Press Enter');π While ReadKey <> #13 do;π RestoreBox(7, 7, 73, 14, BufPtr);πend;ππProcedure Disclaimer;πVarπ BufPtr: PtrBufferType;πbeginπ SaveBox(5, 5, 77, 21, BufPtr);π DrawBox(5, 5, 75, 20, $1F, 'DISCLAIMER');π Shadow(5, 5, 75, 20);π Window(7, 7, 73, 19);π Writeln(' Seeing as I came up With these Procedures For');π Writeln('my own future Programs (I just recently wrote these)');π Writeln('please don''t Forget who wrote them originally if you');π Writeln('decide to use them in your own. Maybe a ''thanks to Eric Miller');π Writeln('For Window routines'' somewhere in your doCs?');π Writeln;π Writeln(' Also, if anyone can streamline this source, well, I''d');π Writeln('I''d like to see it...not that too much can be done.');π Writeln;π Writeln(' Eric Miller');π Window(1,1,80,25);π Hello;π TextAttr := $1F;π GotoXY(9, 18);π Writeln('Press Enter...');π While ReadKey <> #13 do;π RestoreBox(5, 5, 77, 21, BufPtr);πend;ππbeginπ TextAttr := $3F;π ClrScr;π Disclaimer;πend.π(***** end of PART 1 of 2 ******************************)π 6 05-28-9314:08ALL SWAG SUPPORT TEAM WINDOWS3.PAS IMPORT 17 DS> Like say there is a Text Window that pops up when someone makes aπDS>choice. Then they select something else and a Text Window is made thatπDS>overlaps the previous one. Then I'd like to have it so if the userπDS>were to press, say, escape, the current Text Window would be "removed"πDS>and the old Window would still be there as is was....πDS>How can this be done?? Please keep in mind that I'm still sort ofππHere's two Procedures a friend of mine wrote (David Thomas: give creditπwhree credit is due). It works great With regular Text screens.πππPut This in you Type section:ππ WindowStatus = (OnScreen, OffScreen);π WindowType = Recordπ Point : Pointer;π Status : WindowStatus;π Col,π Row,π SaveAttr : Byte;π end;ππProcedure GetWindow (Var Name : WindowType);πVarπ Size,π endOffset,π StartOffset : Integer;πbegin { GetWindow }ππ With Name Doπ beginπ Col := WhereX;π Row := WhereY;π SaveAttr := TextAttr;ππ StartOffset := 0;π endOffset := 25 * 160;π Size := endOffset - StartOffset;π GetMem (Point, Size);ππ Move (Mem[$B800:StartOffset], Point^, Size);π Status := OnScreen;π end; { With }ππend; { GetWindow }π{--------------------------------------------------------------------}πProcedure PutWindow (Var Name : WindowType);πVarπ Size,π endOffset,π StartOffset : Integer;πbegin { PutWindow }ππ With Name Doπ beginπ StartOffset := 0;π endOffset := 25 * 160;π Size := endOffset - StartOffset;ππ Move (Point^, Mem[$B800:StartOffset], Size);ππ FreeMem (Point, Size);π Status := OffScreen;ππ TextAttr := SaveAttr;π GotoXY (Col, Row);π end; { With }ππend; { PutWindow }πππVery easy to use. Just declare a Varibale of WindowType, call theπGETWindow routine, then display whatever. When you're done, call theπPUTWindow routine and it Zap, it's back to how it was. Very face, veryπnice.π 7 05-28-9314:08ALL SWAG SUPPORT TEAM WINDOWS4.PAS IMPORT 10 { SALIM SAMAHA }ππUnit Windows;ππInterfaceππUsesπ Crt;ππConstπ Max = 3;ππTypeπ ScreenImage = Array [0..1999] of Word;π FrameRec = Recordπ Upperleft : Word;π LowerRight : Word;π ScreenMemory : ScreenImage;π end;ππVarπ SnapShot : ^ScreenImage;π FrameStore : Array [1..10] of ^FrameRec;π WindowNum : Byte;ππProcedure OpenWindow(UpLeftX, UpLeftY, LoRightX, LoRightY : Byte);πProcedure CloseWindow;ππImplementationππProcedure OpenWindow(UpLeftX, UpLeftY, LoRightX, LoRightY : Byte);πbeginπ SnapShot := Ptr( $B800, $0000);π Inc(WindowNum);π New(FrameStore[WindowNum]);π With Framestore[WindowNum]^ doπ beginπ ScreenMemory := SnapShot^;π UpperLeft := WindMin;π LowerRight := WindMax;π end;π Window(UpLeftX, UpLeftY, LoRightX, LoRightY);πend;ππProcedure CloseWindow;πbeginπ With Framestore[WindowNum]^ doπ beginπ Snapshot^ := ScreenMemory;π Window ((Lo(UpperLeft) + 1), (Hi(UpperLeft) + 1),π (Lo(LowerRight) + 1), (Hi(LowerRight) + 1));π end;π Dispose(Framestore[WindowNum]);π Dec(WindowNum);πend;ππ