home *** CD-ROM | disk | FTP | other *** search
- (*$C-,V-,U-*)
- Program MenuDemo;
-
- (*----------------------------------------------------------------------*)
- (* MenuDemo --- Demonstrate TURBO Menu Routines *)
- (*----------------------------------------------------------------------*)
- (* *)
- (* Author: Philip R. Burns *)
- (* Date: January, 1985 *)
- (* Version: 1.0 *)
- (* Systems: For MS-DOS on IBM PCs and close compatibles only. *)
- (* Note: I have checked these on Zenith 151s under *)
- (* MSDOS 2.1 and IBM PCs under PCDOS 2.0. *)
- (* *)
- (* Overview: This program provides a short demo of the routines in *)
- (* PIBMENUS.PAS. A single menu, to select a baud rate *)
- (* in a communications program, is created. *)
- (* *)
- (* Suggestions for improvements or corrections are welcome. *)
- (* Please leave messages on Gene Plantz's BBS (312) 882 4145 *)
- (* or Ron Fox's BBS (312) 940 6496. *)
- (* *)
- (* I hope that you find this program useful -- and, *)
- (* if you expand upon it, please upload your extensions so *)
- (* that all of us can enjoy them! *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- (*----------------------------------------------------------------------*)
- (* Global Color Variables *)
- (*----------------------------------------------------------------------*)
-
- Var
-
- ForeGround_Color : Integer (* Color for ordinary text *);
- BackGround_Color : Integer (* Usual background color *);
-
- Menu_Text_Color : Integer (* Color for menu text *);
- Menu_Frame_Color : Integer (* Color for menu frame *);
-
- (*$IGLOBTYPE.PAS *)
- (*$IASCII.PAS *)
- (*$IMINMAX.PAS *)
- (*$IPIBMENUS.PAS *)
-
- (*----------------------------------------------------------------------*)
- (* Local constants and variables *)
- (*----------------------------------------------------------------------*)
-
- Const
- (* Baud Rates available *)
-
- Baud_Rates: Array[ 1 .. 8 ] OF Integer
- = ( 110, 150, 300, 600, 1200, 2400, 4800, 9600 );
-
- Var
- Baud_Menu : Menu_Type (* Hold the menu itself *);
- Baud_Rate : Integer (* Selected baud rate *);
- I : Integer (* Loop index *);
-
- (*----------------------------------------------------------------------*)
- (* Begin Main Program *)
- (*----------------------------------------------------------------------*)
-
- Begin (* MenuDemo *)
-
- (* Select color/mono screen *)
-
- Get_Screen_Address( Actual_Screen );
-
- (* Establish colors *)
-
- If Color_Screen_Active Then
- Begin
- ForeGround_Color := Yellow (* Color for ordinary text *);
- BackGround_Color := Black (* Usual background color *);
-
- Menu_Text_Color := Green (* Color for menu text *);
- Menu_Frame_Color := Red (* Color for menu frame *)
- End
- Else
- Begin
- ForeGround_Color := White (* Color for ordinary text *);
- BackGround_Color := Black (* Usual background color *);
-
- Menu_Text_Color := White (* Color for menu text *);
- Menu_Frame_Color := White (* Color for menu frame *);
-
- End;
-
- Set_Global_Colors( ForeGround_Color, BackGround_Color );
-
- (* Set up the menu *)
- Baud_Menu.Menu_Size := 8;
- Baud_Menu.Menu_Row := 11;
- Baud_Menu.Menu_Column := 30;
- Baud_Menu.Menu_Tcolor := Menu_Text_Color;
- Baud_Menu.Menu_Bcolor := BackGround_Color;
- Baud_Menu.Menu_Fcolor := Menu_Frame_Color;
- Baud_Menu.Menu_Width := 0;
- Baud_Menu.Menu_Height := 0;
-
- (* Default baud rate = 1200 = *)
- (* fifth entry in menu *)
- Baud_Menu.Menu_Default := 5;
-
- (* Define positions, values *)
- (* for each baud rate *)
- For I := 1 to 8 Do
- With Baud_Menu.Menu_Entries[I] Do
- Begin
- Menu_Item_Row := I;
- Menu_Item_Column := 2;
- Case I Of
- 1: Menu_Item_Text:= '110';
- 2: Menu_Item_Text:= '150';
- 3: Menu_Item_Text:= '300';
- 4: Menu_Item_Text:= '600';
- 5: Menu_Item_Text:= '1200';
- 6: Menu_Item_Text:= '2400';
- 7: Menu_Item_Text:= '4800';
- 8: Menu_Item_Text:= '9600';
- End (* Case *);
- End;
- (* Set title of menu *)
-
- Baud_Menu.Menu_Title := 'Choose Baud Rate: ';
-
- (* Display the menu *)
-
- Menu_Display_Choices( Baud_Menu );
-
- (* Get selected menu item *)
-
- Baud_Rate := Baud_Rates[ Menu_Get_Choice( Baud_Menu , Erase_Menu ) ];
-
- GoToXY( 1 , 20 );
- Writeln('The Selected Baud Rate Is ', Baud_Rate );
- Delay( 3000 );
-
- End (* MenuDemo *).