===psmenu - simple menu to select a menu item=== ' MMBasic DOS 5-04-05 Beta 7 ' psmenu - version 1 ' by Peter Svard , 2017.09.22 ' Show how to use psmenu Sub (and psmenuinit) Colour 7,0 Cls ' setup variables for psmenu Const psmmax = 10 ' max menu items Dim psmt(psmmax) As string ' create menu array Dim eKey As integer ' return eKey-code Dim mindex As integer ' return menu index ' notes: change menutext using Sub psmenuinit Cursor 3,2:Print "psmenu Use cursor Up or Down to move. Press Enter or ESC to exit." psmenu 3,5,7,0,eKey,mindex Cursor 0,18 Print " Return code from psmenu " Print " menu index = ";mindex Print " exit eKey = ";eKey End ' ----- psmenu ----- ' col,row = menu position ' fc,bc = colour foreground, background ' eKey = return key ( 13=Enter, 27=ESC-key) ' mindex = return menu index Sub psmenu(col As integer,row As integer,fc As integer,bc As integer, eKey As integer, mindex As integer) psmenuinit Local i As integer Local t As integer ' inkey$ key-code ' print out the menu Colour fc,bc For i=0 To psmmax-1 Cursor col,row+i Print psmt(i+1) Next i i = 0 ' start at first menu item (0=first item) Colour bc,fc ' show menu cursor Cursor col,row+i Print psmt(i+1); ' main menu loop start Do t=Asc(Inkey$) ' wait for a Key If t=13 Or t=27 Then ' Enter or ESC-key eKey=t ' return eKey-code mindex=i+1 ' return menu index Exit Do End If If t=128 Or t=129 Then ' cursor Up or Down Colour fc,bc ' clear menu cursor Cursor col,row+i Print psmt(i+1) If t=128 And i>0 Then i=i-1 ' Up If t=129 And i