|
|||
Задание 6. Program 6Задание 6 Program 6 Uses CRT; Const MaxMenuItem = 4; Var Ret : Byte;
Function MainMenu(R_Select:Byte):Byte; Type TMenu = record X,Y : Byte; S : String[20]; End;
Var Menu : Array [0..MaxMenuItem] Of TMenu; Run : Boolean; Sel : Byte; TC, TB : Byte; {color}
Procedure DrawMenu; Var I : Byte; Begin For I := 0 To MaxMenuItem Do Begin GotoXY(Menu[I].X, Menu[I].Y); Write(Menu[I].S); End; End;
Procedure Select (I:Byte); Begin TextBackground(TC); TextColor(TB); GotoXY(Menu[I].X, Menu[I].Y); Write(Menu[I].S); TextBackground(TB); TextColor(TC); End;
Procedure DeSelect (I:Byte); Begin TextBackground(TB); TextColor(TC); GotoXY(Menu[I].X, Menu[I].Y); Write(Menu[I].S); TextBackground(TB); TextColor(TC); End;
Begin Menu[0].S := 'Sozdat fail'; Menu[0].X := 20; Menu[0].Y := 5; Menu[1].S := 'Groos Staate'; Menu[1].X := 20; Menu[1].Y := 6; Menu[2].S := 'Poriadok Platz'; Menu[2].X := 20; Menu[2].Y := 7; Menu[3].S := 'Zapros'; Menu[3].X := 20; Menu[3].Y := 8; Menu[4].S := ' exit '; Menu[4].X := 20; Menu[4].Y := 9;
ClrScr;
TC := TextAttr mod 16; TB := TextAttr div 16;
DrawMenu; Sel := R_Select; Select(Sel);
Run := False; While Not Run Do Begin Case ReadKey Of #13 : Run := True; #27 : Begin Run := True; Sel := MaxMenuItem; End;
#0 : Case ReadKey Of #72 : Begin DeSelect(Sel); If Sel = 0 Then Sel := MaxMenuItem Else Sel := Sel - 1; Select(Sel); End; #80 : Begin DeSelect(Sel); If Sel = MaxMenuItem Then Sel := 0 Else Sel := Sel + 1; Select(Sel); End; End; End; End; MainMenu := Sel;
TextBackground(TB); TextColor(TC);
ClrScr; End;
Begin ClrScr; TextBackground(Blue); TextColor(LightGreen);
Ret := 0; Repeat Ret := MainMenu(Ret); Case Ret Of 0: Begin WriteLn('‚лЎа ЇгЄв: ', Ret); WriteLn('... ¦Ё Є« ўЁиг ...'); ReadLn; End; 1: Begin WriteLn('‚лЎа ЇгЄв: ', Ret); WriteLn('... ¦Ё Є« ўЁиг ...'); ReadLn; End; 2: Begin WriteLn('‚лЎа ЇгЄв: ', Ret); WriteLn('... ¦Ё Є« ўЁиг ...'); ReadLn; End; 3: Begin WriteLn('‚лЎа ЇгЄв: ', Ret); WriteLn('... ¦Ё Є« ўЁиг ...'); ReadLn; End; Else Begin WriteLn('‚л室 Ё§ Їа®Ја л'); WriteLn('... ¦Ё Є« ўЁиг ...'); ReadLn; End; End; {case Ret} Until Ret = MaxMenuItem; TextBackground(Black); TextColor(LightGray); ClrScr;
End.
|
|||
|