home *** CD-ROM | disk | FTP | other *** search
- { EXMENDOW.PAS - MENDOW21.INC Turbo Pascal Example }
- { This file will create a Menu And A Window }
-
- { include the MENDOWS.INC file }
- (*$IMENDOWS.INC *)
-
- { Define the Menu/Window Variables }
-
- VAR
- ExMenu : DrawRec; { Menu Example Rec }
- ExMenuWindow : WindowPtr; { Menu Example Window Ptr }
- ExOptionChosen : INTEGER; { Menu Option Var }
- ExWindow : WindowPtr; { Window Example Window Ptr }
-
- { Anciallary Varible Definitions }
- I : INTEGER; { General Counter }
- Exit_Code : BOOLEAN; { Exit System Flag }
-
- { Example Procedure 1 - Create/Delete A Window }
- PROCEDURE ExMenuProc1;
-
- VAR
- Proc1Window : WindowPtr; { Window Var }
- Proc1Code : BOOLEAN; { Window Error Code }
-
- BEGIN
- Proc1Code := Make_Window(30,14,60,19,'Procedure 1 Window',Proc1Window,TRUE);
- { TRUE - Clear Window }
- GOTOXY(2,1); { Goto top of window }
- WRITELN('This is test window 1');
- WRITELN('Hit Enter To Continue');
- READLN;
- DRestoreWindow(Proc1Window,0,0); { Erase Window From Screen }
- END; { ExMenuProc1 }
-
-
-
- { Example Procedure 2 - Create/Delete Multiple Windows }
- PROCEDURE ExMenuProc2;
-
- VAR
- Proc2WindowAr : ARRAY[1..3] OF WindowPtr; { Array For Three Windows }
- Proc2CodeAr : ARRAY[1..3] OF BOOLEAN; { Error Code For Windows }
- I : INTEGER; { Counter Variable }
-
- BEGIN
- FOR I := 1 TO 3 DO
- BEGIN
- Proc2CodeAr[I] := Make_Window(10*I,1+(3*I),40+(5*I),20+I,
- 'Test Window # '+CHR(48+I),Proc2windowAr[I],
- TRUE);
- { Create Windows at differing offsets }
- GOTOXY(2,1);
- WRITELN('This is window # ',I); { Message In Window[I] }
- END;
- WRITELN('Press Enter To Delete');
- WRITELN(' Each Window');
- FOR I := 3 DOWNTO 1 DO
- BEGIN
- READLN;
- DRestoreWindow(Proc2WindowAr[I],0,0); { Delete Window[I] }
- END;
- END; { ExMenuProc2 }
-
-
- { Example Procedure 3 - Create Non-Erasing Menu }
- PROCEDURE ExMenuProc3;
-
- VAR
- ExProc3Menu : DrawRec; { Menu Rec For Proc 3 }
- ExProc3Window : WindowPtr; { Window For Proc 3 Menu }
- ExProc3Option : INTEGER; { Option Chosen From Menu }
-
- BEGIN
- { Define Proc3 Menu Rec }
- WITH ExProc3Menu DO
- BEGIN
- Count := 3; { Number Proc3 Menu Options }
- Default := 1; { Default Proc3 Menu Option }
- Title := 'Non Erasing Menu'; { Proc3 Menu Title }
-
- WITH DrawRecAr[1] DO { First Menu Item }
- BEGIN
- Col := 17; { Top Left Column }
- Row := 7; { Top Left Row }
- DrawDat := 'Option 1'; { 1st Menu Option }
- END; { WITH DrawRecAr[1] }
-
- WITH DrawRecAr[2] DO { Second Menu Item }
- BEGIN
- Col := 66; { Bottom Right Column }
- Row := 11; { Bottom Right Row }
- DrawDat := 'Option 2'; { 2nd Menu Option }
- END; { WITH DrawRecAr[2] }
-
- DrawRecAr[3].DrawDat := 'Option 3'; { 3rd Menu Option }
- END; { WITH ExProc3Menu }
-
- ExProc3Option := Make_Menu(ExProc3Menu,ExProc3Window,FALSE);
- { FALSE - Don't erase }
- { menu on exit from }
- { Make_Menu }
- GOTOXY(20,1);
- WRITE('If Menu Is Not Erased,'); { }
- GOTOXY(20,2); { In Window Message }
- WRITE('The Window Remains Active.'); { and }
- GOTOXY(20,3); { Pause }
- WRITE('Hit <ENTER> To Continue'); { }
- READLN; { }
- DRestoreWindow(ExProc3Window,0,0); { Restore Old Window }
- END; { ExMenuProc3 }
-
-
- { Example Procedure 4 - Create Full Screen Window }
-
- PROCEDURE ExMenuProc4;
-
- VAR
- ExProc4Window : WindowPtr;
- I : INTEGER;
- Proc4Code : BOOLEAN;
-
- BEGIN
- Proc4Code := Make_Window(1,1,80,25,'Big Window',ExProc4Window,TRUE);
- { Create Full Screen Window }
- { TRUE - Clear Window }
-
- GOTOXY(1,1); { }
- WRITELN('The Entire Screen Can Be Used As A Window'); { Full Screem }
- WRITELN('Hit <ENTER> To Continue'); { Draw }
- READLN; { Replete }
- FOR I := 1 TO 1000 DO { With }
- WRITE('*'); { Pauses }
- WRITELN; { }
- WRITELN('Hit <ENTER> To Continue'); { }
- READLN; { }
- DRestoreWindow(ExProc4Window,0,0); { Restore Full Screen }
- END; { ExMenuProc4 }
-
-
- { Example Procedure 5 - Create Full Screen Window w/out Clearing }
-
- PROCEDURE ExMenuProc5;
-
- VAR
- ExProc5Window : WindowPtr;
- I : INTEGER;
- Proc5Code : BOOLEAN;
-
- BEGIN
- Proc5Code := Make_Window(1,1,80,25,'Big Non-Cleared Window',
- ExProc5Window,FALSE);
- { Create Full Screen Window }
- { FALSE - Don't Clear Screen }
- { within new window }
-
- GOTOXY(1,1); { }
- WRITELN('The Entire Screen Can Be Used As A Window'); { Full Screem }
- WRITELN('Hit <ENTER> To Continue'); { Draw }
- READLN; { Replete }
- FOR I := 1 TO 1000 DO { }
- CASE (I MOD 2) OF { }
- 0 : WRITE('@'); { With }
- 1 : WRITE('*'); { }
- END; { CASE I MOD 2 } { }
- WRITELN; { }
- WRITELN('Hit <ENTER> To Continue'); { }
- READLN; { }
- DRestoreWindow(ExProc5Window,0,0); { Restore Full Screen }
- END; { ExMenuProc5 }
-
-
-
-
- { Actual Menu/Window Examples }
- BEGIN
- DetermineDisplay; { Checks for C-G or Mono Monitor }
-
- { Fill Screen with '@'s For Menu Example }
- GOTOXY(1,1); { Send Cursor to Top Of Screen }
- FOR I:= 1 TO 1919 DO { Fill Char Screen with '@' }
- WRITE('@');
-
- { Define Menu Record }
- WITH ExMenu DO
- BEGIN
- Count := 5; { Number of Menu Items }
- Default := 3; { Default Menu Option }
- Title := 'Example Menu'; { Menu Title }
-
- With DrawRecAr[1] DO { First Menu Item }
- BEGIN
- Col := 20; { Top Left Column }
- Row := 3; { Top Left Row }
- DrawDat := 'Single Window Example'; { 1st Menu Option }
- END; { WITH DrawRecAr[1] }
-
-
- With DrawRecAr[2] DO { Second Menu Item }
- BEGIN
- Col := 60; { Bottom Right Column }
- Row := 9; { Bottom Right Row }
- DrawDat := 'Multi Window Example'; { 2st Menu Option }
- END; { WITH DrawRecAr[2] }
-
- DrawRecAr[3].DrawDat := 'Non-Erase Menu Example'; { 3rd Menu Option }
- DrawRecAr[4].DrawDat := 'Full Scr Window Example'; { 4th Menu Option }
- DrawRecAr[5].DrawDat := 'Uncleared Window Example'; { 5th Menu Option }
- END; { WITH ExMenu }
-
- { Call Menu Cration/Option Routine }
- Exit_Code := FALSE; { No Exit Yet }
- REPEAT
- ExOptionChosen := Make_Menu(ExMenu,ExMenuWindow,TRUE); { TRUE - erase }
- { menu on exit }
- CASE ExOptionChosen OF
- 0 : Exit_Code := TRUE; { ESC Pressed from Menu }
- 1 : ExMenuProc1; { Make_Window Example }
- 2 : ExMenuProc2; { Make Multiple Window Examp }
- 3 : ExMenuProc3; { Make Non-Erase Menu Examp }
- 4 : ExMenuProc4; { Full Screen Window Example }
- 5 : ExMenuProc5; { Non Erase Window Example }
- END; { CASE ExOptionChosen }
- UNTIL Exit_Code = TRUE;
- END.