Comment ========================================================== Copyright 1990-91 by Marc Perkel * All right reserved. This file is a quick menu system for you to get going with MarxMenu quickly and esilly. It is written not only to be useful to us but to be an example of what can be done with MarxMenu. ========================================================= EndComment ;------ Create Variables Var VertLine = "³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³" VertLine2 = "³³³³³³³³³³³³³³³³³³³³" VertLine3 = "ÚÄÁÁÁÁÄ¿" VertLine4 = "ÀÄÂÂÂÂÄÙ" MainChoices DosChoices AppChoices MenuChoices TitleBackColor TitleInsideColor BottomMessage TopMessage ;------ Personalize Your Screen Messages BottomMessage = '*-<< Acme Manufacturing Company >>-*' TopMessage = "Joe Blow's Master Menu" LockWord = '' ;locks keyboard BlankTime = 10 ;blank screen time BlankMessage = '' ;message for screen blanker ;------ Select colors and prepare screen SavePosition OnScreenOnly TitleBackColor = Brown TitleInsideColor = Yellow if ColorScreen TextColor Cyan Blue ClearScreen 176 GotoXY 1 25 TextColor Yellow Mag ClearLine WriteCenter BottomMessage TextColor Blue Green GotoXY 4,4 WriteVertical VertLine2 GotoXY 5,4 WriteVertical VertLine2 GotoXY 6,4 WriteVertical VertLine2 GotoXY 7,4 WriteVertical VertLine2 GotoXY 74,4 WriteVertical VertLine2 GotoXY 75,4 WriteVertical VertLine2 GotoXY 76,4 WriteVertical VertLine2 GotoXY 77,4 WriteVertical VertLine2 GotoXY 2,4 Write VertLine4 GotoXY 72,4 Write VertLine4 GotoXY 2,24 Write VertLine3 GotoXY 72,24 Write VertLine3 BoxBorderColor White TitleBackColor BoxInsideColor TitleInsideColor TitleBackColor ClockColor TitleInsideColor TitleBackColor TextColor TitleInsideColor TitleBackColor else ClearScreen 176 TextColor Black Grey GotoXY 1 25 ClearLine ClearLine WriteCenter BottomMessage BoxBorderColor Black Grey BoxInsideColor Black Grey ClockColor Black Grey endif SingleLineBox Explode Off DrawBox 1 1 80 3 GotoXY (77 - length(TopMessage),1) Write TopMessage ClockPos 3 2 DoubleLineBox ResetColors UseArrows Comment ========================================================== I have defined a couple of procedures called CenterStretchWindow and CornerStretchWindow which takes as parameters a menu title, array of choices, and the XY coordinants of the center of the window. It then displays all the choices and numbers them. This method allows you to update the menu more quickly. ========================================================== EndComment ;----- Main Menu MainChoices[1] = 'Applications Menu' MainChoices[2] = 'Dos Menu' MainChoices[3] = 'Format Disk Menu' MainChoices[4] = 'Dos Command Line' MainChoices[5] = 'Menu Utilities' CornerStretchWindow ('Main Menu',MainChoices,11,6) OnKey 'A' ^Apps OnKey 'B' ^Dos OnKey 'C' |SelectFormat |LastKey = ' ' OnKey 'D' |if ExistOnPath('DOLIST.EXE') > '' DropTo DoList |else | Bat 'DropTo ' + ReadEnv('COMSPEC') |endif OnKey 'E' ^MenuUtils OnKey Esc ^Leave ;----- Applications Menu :Apps AppChoices[1] = 'Word Processing' AppChoices[2] = 'Database' AppChoices[3] = 'Accounting' AppChoices[4] = 'Communications' AppChoices[5] = 'Time Manager' CornerStretchWindow ('Apps Menu',AppChoices,43,6) OnKey 'A' OnKey 'B' OnKey 'C' OnKey 'D' OnKey 'E' ;----- Dos Menu :Dos DosChoices[1] = 'Memory Map' DosChoices[2] = 'Free Space' DosChoices[3] = 'Show Directory' DosChoices[4] = 'Pick Directory' DosChoices[5] = 'Directory Master' DosChoices[6] = 'Backup Hard Disk' DosChoices[7] = 'Run a Program' CornerStretchWindow ('DOS Menu',DosChoices,43,6) OnKey 'A' RamMap Pause OnKey 'B' Free Pause OnKey 'C' D/W OnKey 'D' PD OnKey 'E' |if ExistOnPath('DM3.EXE') > '' DropTo DM3 |else DropTo DM |endif OnKey 'F' CD\ BACKUP C: A: /S |Bat 'CD ' + Path OnKey 'G' |Bat SelectFile (ProgType) ;----- Menu Utils :MenuUtils MenuChoices[1] = 'Edit this Menu' MenuChoices[2] = 'Edit another Menu' MenuChoices[3] = 'Run a Menu' CornerStretchWindow ('Apps Menu',MenuChoices,43,6) OnKey 'A' ME %MenuFileName OnKey 'B' |Bat 'ME ' + SelectFile ('*.MNU') OnKey 'C' |SavePosition Off |Bat 'MARX ' + SelectFile ('*.MNU') ;----- This routines selects floppy disk format Procedure SelectFormat var Ch Message Option BoxDim BoxDim[1] = 30 BoxDim[2] = 12 BoxDim[3] = 37 BoxDim[4] = 4 DrawStretchWindow('Format Floppy Disk Menu',BoxDim) Writeln ' 1 - Format 360 5 - Format /S 360' Writeln ' 2 - Format 1.2M 6 - Format /S 1.2M' Writeln ' 3 - Format 720 7 - Format /S 720' Write ' 4 - Format 1.4M 8 - Format /S 1.4M' Ch = ReadKey if Ch = '1' Message = '360k Format with no System Files.' Option = '/4' endif if Ch = '2' Message = '1.2m Format with no System Files.' Option = '' endif if Ch = '3' Message = '720k Format with no System Files.' Option = '/N:9/T:80' endif if Ch = '4' Message = '1.4m Format with no System Files.' Option = '/N:18/T:80' endif if Ch = '5' Message = '360k Format with System Files.' Option = '/4/S' endif if Ch = '6' Message = '1.2m Format with System Files.' Option = '/S' endif if Ch = '7' Message = '720k Format with System Files.' Option = '/N:9/T:80/S' endif if Ch = '8' Message = '1.4m Format with System Files.' Option = '/N:18/T:80/S' endif if Message = '' then Return if DosVersionString >= '5.00' then Option = Option + '/U' BoxDim[1] = 56 BoxDim[2] = 18 BoxDim[3] = 5 BoxDim[4] = 2 DrawStretchWindow('Drive',BoxDim) Writeln ' A:' Write ' B:' Ch = ReadKey if Ch = Esc then Return if Ch = 'A' Bat '@Echo Formatting Drive A: ' + Message Bat '@Echo To abort, press CTRL-C.' Bat '@Echo .' Bat 'FORMAT A:' + Option endif if Ch = 'B' Bat '@Echo Formatting Drive B: ' + Message Bat '@Echo To abort, press CTRL-C.' Bat '@Echo .' Bat 'FORMAT B:' + Option endif EndProc ;------ Reset Colors Procedure Procedure ResetColors if ColorScreen BoxBorderColor Yellow Blue BoxInsideColor Yellow Blue CapsColor White Blue InverseColor White Mag else BoxBorderColor Grey Black BoxInsideColor Grey Black CapsColor White Black endif EndProc ;----- This routines is used to actually draw the stretch window Procedure DrawStretchWindow (Title,BoxDim) Explode On DoubleLineBox InactiveBox SingleLineBox DrawBox (BoxDim[1] - 2, BoxDim[2] - 3 ,BoxDim[3] + 6, BoxDim[4] + 4) TextColor LCyan Blue WriteCenter Title TextColor LGreen Blue Writeln ClearLine 196 GotoXY 2 2 WriteVertical mid(VertLine,1,BoxDim[4] + 1) ResetColors Explode Off NoBoxBorder Window (BoxDim[1] + 1, BoxDim[2], BoxDim[3] + 2, BoxDim[4]) DoubleLineBox Explode On EndProc ;----- The X Y parameters are the center of the box Procedure CenterStretchWindow (Title, Choices, X, Y) var Longest BoxDim NumElem C Longest = length(Title) - 2 NumElem = NumberOfElements(Choices) C = 64 Loop NumElem Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex] Longest = Max(Longest,length(Choices[LoopIndex])) EndLoop BoxDim[1] = X - (Longest / 2) - 1 BoxDim[2] = Y - (NumElem / 2) + 1 BoxDim[3] = Longest BoxDim[4] = NumElem DrawStretchWindow(Title,BoxDim) Loop NumElem Write ' ' Choices[LoopIndex] if LoopIndex < NumElem then Writeln EndLoop EndProc ;----- The X Y parameters are the corner of the box Procedure CornerStretchWindow (Title, Choices, X, Y) var Longest BoxDim NumElem C Longest = length(Title) - 2 NumElem = NumberOfElements(Choices) C = 64 Loop NumElem Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex] Longest = Max(Longest,length(Choices[LoopIndex])) EndLoop BoxDim[1] = X + 2 BoxDim[2] = Y + 3 BoxDim[3] = Longest BoxDim[4] = NumElem DrawStretchWindow(Title,BoxDim) Loop NumElem Write ' ' Choices[LoopIndex] if LoopIndex < NumElem then Writeln EndLoop EndProc ;------ MenuExit Procedure :Leave Explode On DrawBox 36 11 13 6 TextColor LCyan Blue WriteCenter "Exit Menu" TextColor LGreen Blue Writeln ClearLine 196 GotoXY 2 2 WriteVertical mid(VertLine,1,3) ResetColors Explode Off NoBoxBorder Window 39 14 9 2 Writeln " Yes" Write " No" DoubleLineBox OnKey "Y" |ExitMenu OnKey "N" |LastKey = Esc ;------ Select a File Procedure SelectFile (Mask) if Mask = '' then Return '' Return PickFile Mask 29 9 14 EndProc ;------ Choose Program Type Procedure ProgType var Progs Progs[1] = 'COM File' Progs[2] = 'EXE File' Progs[3] = 'BAT File' CornerStretchWindow ('Program Type',Progs,11,16) OnScreenOnly On LastKey = ReadKey if LastKey = 'A' then Return '*.COM' if LastKey = 'B' then Return '*.EXE' if LastKey = 'C' then Return '*.BAT' if LastKey = Esc then Return '' EndProc