home *** CD-ROM | disk | FTP | other *** search
- {.L-} { Suppress listing by ListT }
- {*
- * --------------------------------------------------------------------
- * M E N U U N I T
- * --------------------------------------------------------------------
- *
- * This 'unit' contains the primitives to build a simple menu system.
- * It does not contain any hardware dependencies.
- *
- * I N T E R F A C E S E C T I O N
- *}
-
- type
- TitleString = string[40] ; { String to contain a title }
-
- {
- procedure DisplayMenuHead ;
- procedure DisplayMenuTail ;
- procedure DisplayTitle( VariaTitle : TitleString ) ;
- procedure InitMenuUnit( FixedTitle : TitleString ) ;
- }
-
- {*
- * I M P L E M E N T A T I O N S E C T I O N
- *}
- var
- FixedTitlePtr : ^TitleString ; { Right title, program name }
-
- procedure DisplayTitle( VariaTitle : TitleString ) ;
- {*
- * Display both the fixed title and the variable title on the top line
- * of the screen. The titles are underlined and the rest of the screen
- * is cleared.
- * Note : It is assumed that the screen width is 80 characters!
- *}
- var
- FreeSpace : Integer ; { Free space on top line }
- I : Integer ; { Loop control variable }
- begin
- ClrScr ;
- Write( FixedTitlePtr^ ) ;
- FreeSpace:= 79 - Length( FixedTitlePtr^ ) ;
- if FreeSpace>5 then
- Write( Copy(VariaTitle,1,FreeSpace):FreeSpace ) ;
- WriteLn ;
-
- For I:= 1 to 79 do
- Write( '-' ) ;
- WriteLn ;
- end ; { of DisplayTitle }
-
- procedure DisplayMenuHead ;
- {*
- * Display the (standard) header of a menu.
- *}
- begin
- WriteLn ;
- WriteLn( ' Cmd Action' ) ;
- WriteLn ;
- end ; { of DisplayMenuHead }
-
- procedure DisplayMenuTail ;
- {*
- * Display the (standard) tail of a menu.
- *}
- begin
- WriteLn ;
- WriteLn( ' <Q> Quit' ) ;
- WriteLn ;
- end ; { of DisplayMenuTail }
-
- procedure InitMenuUnit( FixedTitle : TitleString ) ;
- {*
- * Save the location of the fixed title.
- *}
- begin
- FixedTitlePtr:= Ptr( Addr(FixedTitle) ) ;
- end ; { of InitMenuUnit }
- {.L+}
-