home *** CD-ROM | disk | FTP | other *** search
- Program ScrDemo;
- {
-
- <C>opyright 1989 by iHn Systems - all rights reserved
-
- Read ScrEdit.Tut for a description of how to use this program.
-
- }
- {---------------------------------------------------------------------------}
-
- You will get a compiler error here until you select the appropriate interface
- for your compiler and delete these comments.
-
- This interface is for Turbo Pascal 3.0
-
- {$I \scredit\interfac\ScrEd30.Pas}
- {$I \scredit\interfac\ScrEd3&4.Pas}
-
- This interfac is for Turbo Pascal 4.0 & 5.0
-
- USES Crt,SCRED40;
-
- {---------------------------------------------------------------------------}
-
- {$I ScrDemo.001}
- {$I ScrDemo.002}
-
- Var
- Option : Integer;
- Screen_Mode : Integer;
- Cursor_Position : Integer;
-
-
- Procedure Back_To_Turbo_Pascal_Land;
- Var
- Response : String[10];
- Begin
- ClrScr;
- Repeat
- ClrScr;
- WriteLn('This is regular pascal code now.');
- WriteLn('');
- WriteLn('You can do anything now that you want to, use any ');
- WriteLn('programming statement that you wish to. When you');
- WriteLn('are ready to resume with Turbo ScrEdit just return');
- WriteLn('and the screen will be reloaded and you will resume');
- WriteLn('at the point where you left the screen.');
- WriteLn;
- Write('Type "RETURN" in upper case to end this example...');
- ReadLn(Response);
- Until (Response = 'RETURN')
- End;
-
- Procedure ScrDemo_Init;
- Begin
-
- S_Init;{<==DO NOT USE TURBO SCREDIT PROCEDURES WITHOUT CALLING S_INIT}
-
- S_OpenScreenFile('ScrDemo.SCR');
-
- Initialize_Demo_Menu_buf;
- Initialize_Demo_Screen_Buf;
-
- S_LoadScreen('Demo_Menu');
-
- TextBackGround(Black);
- TextColor(Green);
-
- Screen_Mode := 0;
- S_Cursor := S_Normal;
- S_Sound := False;
- Option := 1;
- S_ShowStatus := True;
- End;
-
-
- Procedure Process_Screen;
- Begin
- If Screen_Mode = 1 Then
- Begin
- Cursor_Position := Trunc(Demo_Screen_Buf.OP + 0.005);
- Case Cursor_Position of
- 0 : S_Point := S_FirstField;
- 1 : S_Point := 2;
- 2 : S_Point := 5;
- 3 : S_Point := 12;
- 4 : S_Point := 9;
- End; {Case of}
- End;
-
- If Screen_Mode = 2 then
- Begin
- S_Point := S_Point + 1;
- Cursor_Position := Trunc(Demo_Screen_Buf.OP + 0.005);
- Case Cursor_Position of
- 0 : S_Point := 1;
- 1 : If (S_Point > 4) Or
- (S_Point < 2) Then
- S_Point := 2;
- 2 : Begin
- If (S_Point > 10) Or
- (S_Point < 5) Then
- S_Point := 5;
- If S_Point = 9 Then
- S_Point := 10;
- End;
- 3 : If (S_Point > 13) Or
- (S_Point < 12) Then
- S_Point := 12;
- 4 : Begin
- If (S_Point > 11) Or
- (S_Point < 9) Then
- S_Point := 9;
- If S_Point = 10 Then
- S_Point := 11;
- End;
- End; {Case of}
- End;
-
- S_Msg := ' <F1>=Ininialize Screen <F2>=Return to Menu ';
-
- Case Screen_Mode of
- 2 : S_ReadField;
- 1 : S_ReadScreen;
- End; {Case of}
-
- If S_Fkey Then
- Begin
- If (Not S_Shift) And
- (Not S_Ctrl) And
- (Not S_Alt) Then
- Begin
- If S_F1 Then
- Begin
- Initialize_Demo_Screen_Buf;
- S_Point := S_FirstField;
- S_Msg := 'Screen has been reset.';
- End;
- If S_F2 Then
- Screen_Mode := 0;
- End;
- End;
- End;
-
-
-
-
-
- Procedure Read_Menu_Screen;
- Var
- X,Y,Z : Integer;
- Begin
- S_LoadScreen('Demo_Menu');
- Repeat
- FillChar(Demo_Menu_Buf,SizeOf(Demo_Menu_Buf),00);
-
- Demo_Menu_Buf.O1 := 'This Menu';
- Demo_Menu_Buf.O2 := 'Using S_ReadScreen';
- Demo_Menu_Buf.O3 := 'Using S_ReadField';
- Demo_Menu_Buf.O4 := 'Using S_ReadKey';
- Demo_Menu_Buf.O5 := 'Using S_NextKey';
- Demo_Menu_Buf.O6 := 'Using Windows';
- Demo_Menu_Buf.O7 := 'Using The Message Line';
- Demo_Menu_Buf.O8 := 'Mixed ScrEdit';
- Demo_Menu_Buf.O13:= 'Remaining Memory';
-
- If Option < 1 Then Option := 9;
- If Option > 9 Then Option := 1;
-
- With Demo_Menu_Buf Do
- Begin
- Case Option of
- 1 : Begin
- P1 := '==>';
- M1 := 'To use this menu, have a listing of the';
- M2 := 'file SCRDEMO.P with you and follow';
- M3 := 'each of the examples through the pascal';
- M4 := 'code. This program is designed to help';
- M5 := 'you understand how to implement Turbo';
- M6 := 'ScrEdit procedures in your programs.';
- End;
- 2 : Begin
- P2 := '==>';
- M1 := 'S_ReadScreen - process an entire screen';
- M2 := 'with one call. Control returns to your ';
- M3 := 'program when ENTER, UP or DOWN arrows,';
- M4 := 'HOME, END, PGUP, PGDN, INSERT, DEL, one';
- M5 := 'the F keys, or any key is pressed in ';
- M6 := 'conjuction with ALT or CTRL.';
- End;
- 3 : Begin
- P3 := '==>';
- M1 := 'S_ReadField - Process a single screen';
- M2 := 'field at a time. Control returns to';
- M3 := 'your program when the cursor is moved ';
- M4 := 'off of the field with the left or right';
- M5 := 'arrow keys, TAB key, or Any of the';
- M6 := 'other key listed with S_ReadScreen.';
- End;
- 4 : Begin
- P4 := '==>';
- M1 := 'S_ReadKey - This demonstrates how to';
- M2 := 'display a message on the message line';
- M3 := 'and accept a keystroke response from';
- M4 := 'the user. The key pressed does not';
- M5 := 'echo to the screen and will not be ';
- M6 := 'placed in any screen field.';
- End;
- 5 : Begin
- P5 := '==>';
- M1 := 'S_NextKey - This demonstrates how to';
- M2 := 'read the next key pressed only. No ';
- M3 := 'message can be displayed. Turbo Scredit';
- M4 := 'waits for the next key pressed and ';
- M5 := 'returns to your program.';
- End;
- 6 : Begin
- P6 := '==>';
- M1 := 'A method of using windows to display';
- M2 := 'data on your screens and then restore';
- M3 := 'the screen to its original state.';
- End;
- 7 : Begin
- P7 := '==>';
- M1 := 'Demonstrates several way of using ';
- M2 := 'the message line to communicate with';
- M3 := 'the user of your program.';
- End;
- 8 : Begin
- P8 := '==>';
- M1 := 'This demonstrates how you can exit a';
- M2 := 'procedure using a Turbo ScrEdit screen';
- M3 := 'to use your language`s standard inupt';
- M4 := 'and output statements, and then resume ';
- M5 := 'using Turbo ScrEdit when you wish.';
- End;
- 9 : Begin
- P13 := '==>';
- M1 := 'Use this option to see how much ';
- M2 := 'memory is left on your machine while';
- M3 := 'you run this program.';
- End;
- End;{Case of};
- End;
- Repeat
- S_ReadKey;
- If (S_Up) Or
- (S_Down) Or
- (S_Enter)Or
- (S_Esc) Then
- Begin
- If S_Down Then
- Option := Option + 1;
-
- If S_Up Then
- Option := Option - 1;
-
- If S_Enter Then
- Begin
- If Option = 1 Then
- S_Msg := ' Please read the text in the Option Descript'
- + 'ion window.';
-
- If Option = 2 Then
- Begin
- Screen_Mode := 1;
- S_LoadScreen('Demo_Screen');
-
- While Not S_F2 Do Process_Screen;
-
- S_LoadScreen('Demo_Menu');
- End;
-
- If Option = 3 Then
- Begin
- Screen_Mode := 2;
- S_LoadScreen('Demo_Screen');
-
- While Not S_F2 Do Process_Screen;
-
- S_LoadScreen('Demo_Menu');
- End;
-
- If Option = 4 Then
- Begin
- S_Msg := 'Demo of S_READKEY - Press "C" key to continue';
-
- Repeat
- S_ReadKey;
- S_Msg := 'OOPS!! wrong key - Press "C" key to continue';
- Until UpCase(S_Ch) = 'C';
-
- S_Msg := ' "C" has been pressed - You may continue';
- End;
-
- If Option = 5 Then
- Begin
- For X := 1 to 6 Do
- Begin
- Gotoxy(39,14+X);
- Write(' ');
- End;
- gotoxy(39,17);
- Write(' << OKAY PRESS SHIFT C TO CONTINUE >>');
- Repeat
- S_NextKey;
- Until (S_Shift) and (UpCase(S_Ch)='C');
- End;
-
- If Option = 6 Then
- Begin
- TextColor(Black);
- Y := 1;
- For X := 1 to 4 Do
- Begin
- TextBackground(Y);
- Y := Y + 1;
- Window(X*5,(X*2),(X*5)+40,(X*2)+10);
- ClrScr;
- Write('This is window ',X:2);
- Delay(600);
- End;
- Window(25,10,65,20);
- TextColor(White);
- TextBackground(Y);
- ClrScr;
- gotoxy(10,5);Writeln('<<< This is a window >>>');
- gotoxy(10,7);WriteLn('Press any key to Exit..');
- S_NextKey;
- Window(1,1,80,25);
- TextBackGround(Black);
- TextColor(Green);
- S_LoadScreen('Demo_Menu');
- End;
-
- If Option = 7 Then
- Begin
- S_Msg := 'Do You want to continue Y/N ';
- Repeat
- S_ReadKey;
- If UpCase(S_Ch) In ['Y','N'] Then
- Begin
- If UpCase(S_Ch) = 'N' Then
- S_Msg := ' How about now..Do you want to continue? Y/N ';
- End
- Else
- S_Msg := '<' + S_Ch + '> Please respond with Y or N';
- Until UpCase(S_Ch)='Y';
- S_Msg := 'Ok you may continue';
- End;
-
- If Option = 8 Then
- Begin
- Back_To_Turbo_Pascal_Land;
- S_LoadScreen('Demo_Menu');
- End;
-
- If Option = 9 Then
- Begin
- For X := 1 to 6 Do
- Begin
- Gotoxy(39,14+X);
- Write(' ');
- End;
- gotoxy(39,15);
- Write('MaxAvail =',MaxAvail:6);
- gotoxy(39,16);
- Write('MemAvail =',MemAvail:6);
- gotoxy(39,19);
- Write(' << OKAY PRESS ANY KEY TO CONTINUE >>');
- S_NextKey;
- End;
-
- S_ResetKeyFlags;
- End;
- End
- Else
- S_Msg := ' Only UP and DOWN arrows and ENTER and ESC are valid';
-
- Until (S_Esc)Or(S_UP)Or(S_Down);
-
- Until (S_Esc);
- End;
-
- Begin
- ScrDemo_Init;
- Read_Menu_Screen;
- S_CloseScreenFile;
- End.