Blame | Last modification | View Log | Download
{.PA}{*******************************************************************}{* SOURCE CODE MODULE: MC-MOD02 *}{* PURPOSE: Display values in cells and move between *}{* cells in the spread sheet. *}{*******************************************************************}procedure FlashType;beginwith Screen[FX,FY] dobeginGotoXY(1,23);Write(FX,FY:2,' ');if Formula in CellStatus then write('Formula:') elseif Constant in CellStatus then Write('Numeric ') elseif Txt in CellStatus then Write('Text ');GotoXY(1,24); ClrEol;if Formula in CellStatus then Write(Contents);end;end;{ The following procedures move between the Cells on the calc sheet.}{ Each Cell has an associated record containing its X,Y coordinates }{ and data. See the type definition for "Cell". }procedure GotoCell(GX: ScreenIndex; GY: integer);beginwith Screen[GX,GY] dobeginGotoXY(XPos[GX],GY+1);LowVideo;Write(' ');GotoXY(XPos[GX],GY+1);if Txt in CellStatus then Write(Contents)elsebeginif DEC>=0 then Write(Value:FW:DEC)else Write(Value:FW);end;FlashType;GotoXY(XPos[GX],GY+1);end;NormVideo;end;{.CP20}procedure LeaveCell(FX:ScreenIndex;FY: integer);beginNormVideo;with Screen[FX,FY] dobeginGotoXY(XPos[FX],FY+1);Write(' ');GotoXY(XPos[FX],FY+1);if Txt in CellStatus then Write(Contents)elsebeginif DEC>=0 then Write(Value:FW:DEC)else Write(Value:FW);end;end;end;{.CP20}procedure Update;varUFX: ScreenIndex;UFY: integer;beginClrScr;Grid;for UFX:='A' to FXMax do for UFY:=1 to FYMax doif Screen[UFX,UFY].Contents<>'' then LeaveCell(UFX,UFY);GotoCell(FX,FY);end;{.CP20}procedure MoveDown;var Start: integer;beginLeaveCell(FX,FY);Start:=FY;repeatFY:=FY+1;if FY>FYMax then FY:=1;until (Screen[FX,FY].CellStatus*[OverWritten,Locked]=[]) or (FY=Start);if FY<>Start then GotoCell(FX,FY);end;{.CP20}procedure MoveUp;var Start: integer;beginLeaveCell(FX,FY);Start:=FY;repeatFY:=FY-1;if FY<1 then FY:=FYMax;until (Screen[FX,FY].CellStatus*[OverWritten,Locked]=[]) or (FY=Start);if FY<>Start then GotoCell(FX,FY);end;{.CP20}procedure MoveRight;var Start: ScreenIndex;beginLeaveCell(FX,FY);Start:=FX;repeatFX:=Succ(FX);if FX>FXMax thenbeginFX:='A';FY:=FY+1;if FY>FYMax then FY:=1;end;until (Screen[FX,FY].CellStatus*[OverWritten,Locked]=[]) or (FX=Start);if FX<>Start then GotoCell(FX,FY);end;{.CP20}procedure MoveLeft;var Start: ScreenIndex;beginLeaveCell(FX,FY);Start:=FX;repeatFX:=Pred(FX);if FX<'A' thenbeginFX:=FXMax;FY:=FY-1;if FY<1 then FY:=FYMax;end;until (Screen[FX,FY].CellStatus*[OverWritten,Locked]=[]) or (FX=Start);if FX<>Start then GotoCell(FX,FY);end;