Author Topic: How to get this kind of color background, with this menu item colors  (Read 2740 times)

0 Members and 1 Guest are viewing this topic.

Offline QB64Curious

  • Newbie
  • Posts: 22
    • View Profile
Hi,

I'm playing with the Multi-column text menu at

http://brisray.com/qbasic/qmenu.htm

, in 4.5

I changed a few things, and experimented with colors, but I don't understand them well enough.  How would we change the menus and background to the following:

background blue
menu items = white
selected menu item is blue, but with a white background, only on the selected item.

The goal is to make it into a scrolling horizontal menu with a message bar, and to convert the DATA statements to an array.  But right now I just want to play with the colors and the widths of the menu items.

Code: QB64: [Select]
  1. 'Menucol.bas    Ray Thomas      January 2002
  2. 'Modified 01/29/2022
  3.  
  4.  
  5. DIM MenuItem(60) AS STRING * 15 'Define the menu item array
  6. DIM ChooseItem AS INTEGER       'Currently chosen menu item
  7. DIM XMenuPosn AS INTEGER        'Controls the menu item X positions
  8. DIM YMenuPosn AS INTEGER        'Controls the menu item Y positions
  9. DIM Count AS INTEGER            'Array counter
  10. DIM MenuLine AS INTEGER         'Number of menu items per line
  11. DIM Temp AS STRING              'Used to centre text in the space
  12.  
  13. DATA Choice 1, Choice 2, Longer Choice 3, Choice 4, Longer Choice 5
  14. DATA Choice 6, Choice 7, Choice 8, Choice 9, Choice 10
  15. DATA Choice 11, Choice 12, Choice 13, Choice 14, Choice 15
  16. DATA Choice 16, Choice 17, Choice 18, Choice 19, Choice 20
  17. DATA Choice 21, Choice 22, Choice 23, Choice 24, Choice 25
  18. DATA Choice 26, Choice 27, Choice 28, Choice 29, Choice 30
  19. DATA Choice 31, Choice 32, Choice 33, Choice 34, Choice 35
  20. DATA Choice 36, Choice 37, Choice 38, Choice 39, Choice 40
  21. DATA Choice 41, Choice 42, Choice 43, Choice 44, Choice 45
  22. DATA Choice 46, Choice 47, Choice 48, Choice 49, Choice 50
  23. DATA Choice 51, Choice 52, Choice 53, Choice 54, Choice 55
  24. DATA Choice 56, Choice 57, Choice 58, Choice 59, Choice 60
  25.  
  26. ChooseItem = 1          'Starting point of highlighted menu item
  27. XMenuPosn = 10          'X starting point of menu
  28. YMenuPosn = 3           'Y starting point of menu
  29. MenuLine = 4            'Number of columns in the menu
  30.  
  31.  
  32. '*** Fill the MenuItme Array ***
  33.  
  34. FOR Count = 1 TO UBOUND(MenuItem$)
  35.         READ Temp$
  36.         '*** Centre the Text ***
  37.         Temp$ = SPACE$((15 - LEN(Temp$)) / 2) + Temp$
  38.         MenuItem(Count) = Temp$
  39. NEXT Count
  40.  
  41.  
  42.  
  43.  
  44. GOSUB DrawMenu
  45.  
  46. '*** get cursor key movements and redraw menu ***
  47.         Cmmnd$ = INKEY$
  48.        
  49.         'Check for Esc key
  50.         IF Cmmnd$ = CHR$(27) THEN
  51.                 END
  52.         END IF
  53.         IF LEN(Cmmnd$) = 2 THEN Cmmnd$ = RIGHT$(Cmmnd$, 1)
  54.        
  55.         IF Cmmnd$ = "8" OR Cmmnd$ = CHR$(72) THEN GOSUB MoveUp
  56.         IF Cmmnd$ = "2" OR Cmmnd$ = CHR$(80) THEN GOSUB MoveDown
  57.         IF Cmmnd$ = "4" OR Cmmnd$ = CHR$(75) THEN GOSUB Moveleft
  58.         IF Cmmnd$ = "6" OR Cmmnd$ = CHR$(77) THEN GOSUB MoveRight
  59.         IF Cmmnd$ = "9" OR Cmmnd$ = CHR$(73) THEN GOSUB TopCol
  60.         IF Cmmnd$ = "3" OR Cmmnd$ = CHR$(81) THEN GOSUB BottomCol
  61.         IF Cmmnd$ = "7" OR Cmmnd$ = CHR$(71) THEN ChooseItem = 1
  62.         IF Cmmnd$ = "1" OR Cmmnd$ = CHR$(79) THEN ChooseItem = UBOUND(MenuItem$)
  63.  
  64.  
  65.         GOSUB DrawMenu
  66.  
  67. LOOP UNTIL Cmmnd$ = CHR$(13)
  68.  
  69. COLOR 16, 10
  70. PRINT "Item chosen ="; MenuItem(ChooseItem)
  71.  
  72.  
  73. DrawMenu:
  74. 'Draw the menu
  75. LOCATE YMenuPosn, XMenuPosn
  76. FOR Count = 1 TO UBOUND(MenuItem$)
  77.         IF Count = ChooseItem THEN COLOR 0, 1 ELSE COLOR 4, 1
  78.         PRINT MenuItem$(Count);
  79.         IF Count MOD MenuLine = 0 THEN
  80.                 PRINT
  81.                 LOCATE CSRLIN, XMenuPosn
  82.         END IF
  83.         NEXT Count
  84.  
  85. MoveUp:
  86. IF ChooseItem <= MenuLine THEN
  87.         ChooseItem = UBOUND(MenuItem$) - (MenuItem MOD MenuLine)
  88.         ChooseItem = ChooseItem - MenuLine
  89.  
  90. MoveDown:
  91. IF ChooseItem > UBOUND(MenuItem$) - MenuLine THEN
  92.         ChooseItem = ChooseItem MOD MenuLine
  93.         ChooseItem = ChooseItem + MenuLine
  94. IF ChooseItem = 0 THEN ChooseItem = MenuLine
  95.  
  96. Moveleft:
  97. ChooseItem = ChooseItem - 1
  98. IF ChooseItem = 0 THEN ChooseItem = UBOUND(MenuItem$)
  99.  
  100. MoveRight:
  101. ChooseItem = ChooseItem + 1
  102. IF ChooseItem = UBOUND(MenuItem$) + 1 THEN ChooseItem = 1
  103.  
  104. TopCol:
  105. ChooseItem = ChooseItem MOD MenuLine
  106. IF ChooseItem = 0 THEN ChooseItem = MenuLine
  107.  
  108. BottomCol:
  109. ChooseItem = UBOUND(MenuItem$) - (MenuLine - (ChooseItem MOD MenuLine))
  110. IF MenuLine - (ChooseItem MOD MenuLine) = MenuLine THEN ChooseItem = UBOUND(MenuItem$)
  111.  
  112.  


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #1 on: January 29, 2022, 10:33:48 pm »
Color Foreground or Text Ink, Background or Paper Color

White on Blue is
Color 15, 9 for QB colors


Update better go 1 for blue 7 for white since cant do high white in background in default 0 screen.

Color 1,7 for blue print on low white paper and
color 7, 1 for white on blue background.

Screen 12 might get full range of background color. Yeah, Screen 12 is good 15 for white and 1 for blue, nice contrast (and way more room for menu items!).

Screen _NewImage(pixWidth, pixHeight, 32) ' give a really nice _RGB32(red, green, blue) color range

Code: QB64: [Select]
  1. 'Menucol.bas    Ray Thomas      January 2002
  2. 'Modified 01/29/2022
  3.  
  4.  
  5. Dim MenuItem(60) As String * 15 'Define the menu item array
  6. Dim ChooseItem As Integer 'Currently chosen menu item
  7. Dim XMenuPosn As Integer 'Controls the menu item X positions
  8. Dim YMenuPosn As Integer 'Controls the menu item Y positions
  9. Dim Count As Integer 'Array counter
  10. Dim MenuLine As Integer 'Number of menu items per line
  11. Dim Temp As String 'Used to centre text in the space
  12.  
  13. Data Choice 1,Choice 2,Longer Choice 3,Choice 4,Longer Choice 5
  14. Data Choice 6,Choice 7,Choice 8,Choice 9,Choice 10
  15. Data Choice 11,Choice 12,Choice 13,Choice 14,Choice 15
  16. Data Choice 16,Choice 17,Choice 18,Choice 19,Choice 20
  17. Data Choice 21,Choice 22,Choice 23,Choice 24,Choice 25
  18. Data Choice 26,Choice 27,Choice 28,Choice 29,Choice 30
  19. Data Choice 31,Choice 32,Choice 33,Choice 34,Choice 35
  20. Data Choice 36,Choice 37,Choice 38,Choice 39,Choice 40
  21. Data Choice 41,Choice 42,Choice 43,Choice 44,Choice 45
  22. Data Choice 46,Choice 47,Choice 48,Choice 49,Choice 50
  23. Data Choice 51,Choice 52,Choice 53,Choice 54,Choice 55
  24. Data Choice 56,Choice 57,Choice 58,Choice 59,Choice 60
  25.  
  26. ChooseItem = 1 'Starting point of highlighted menu item
  27. XMenuPosn = 10 'X starting point of menu
  28. YMenuPosn = 3 'Y starting point of menu
  29. MenuLine = 4 'Number of columns in the menu
  30.  
  31.  
  32. '*** Fill the MenuItme Array ***
  33.  
  34. For Count = 1 To UBound(MenuItem$)
  35.     Read Temp$
  36.     '*** Centre the Text ***
  37.     Temp$ = Space$((15 - Len(Temp$)) / 2) + Temp$
  38.     MenuItem(Count) = Temp$
  39. Next Count
  40.  
  41.  
  42.  
  43.  
  44. GoSub DrawMenu
  45.  
  46. '*** get cursor key movements and redraw menu ***
  47.     Cmmnd$ = InKey$
  48.  
  49.     'Check for Esc key
  50.     If Cmmnd$ = Chr$(27) Then
  51.         End
  52.     End If
  53.     If Len(Cmmnd$) = 2 Then Cmmnd$ = Right$(Cmmnd$, 1)
  54.  
  55.     If Cmmnd$ = "8" Or Cmmnd$ = Chr$(72) Then GoSub MoveUp
  56.     If Cmmnd$ = "2" Or Cmmnd$ = Chr$(80) Then GoSub MoveDown
  57.     If Cmmnd$ = "4" Or Cmmnd$ = Chr$(75) Then GoSub Moveleft
  58.     If Cmmnd$ = "6" Or Cmmnd$ = Chr$(77) Then GoSub MoveRight
  59.     If Cmmnd$ = "9" Or Cmmnd$ = Chr$(73) Then GoSub TopCol
  60.     If Cmmnd$ = "3" Or Cmmnd$ = Chr$(81) Then GoSub BottomCol
  61.     If Cmmnd$ = "7" Or Cmmnd$ = Chr$(71) Then ChooseItem = 1
  62.     If Cmmnd$ = "1" Or Cmmnd$ = Chr$(79) Then ChooseItem = UBound(MenuItem$)
  63.  
  64.  
  65.     GoSub DrawMenu
  66.  
  67. Loop Until Cmmnd$ = Chr$(13)
  68.  
  69. Color 1, 15
  70. Print "Item chosen ="; MenuItem(ChooseItem)
  71.  
  72.  
  73. DrawMenu:
  74. Color 15, 1
  75. 'Draw the menu
  76. Locate YMenuPosn, XMenuPosn
  77. For Count = 1 To UBound(MenuItem$)
  78.     If Count = ChooseItem Then Color 1, 15 Else Color 15, 1
  79.     Print MenuItem$(Count);
  80.     If Count Mod MenuLine = 0 Then
  81.         Print
  82.         Locate CsrLin, XMenuPosn
  83.     End If
  84. Next Count
  85.  
  86. MoveUp:
  87. If ChooseItem <= MenuLine Then
  88.     ChooseItem = UBound(MenuItem$) - (MenuItem)
  89.     ChooseItem = ChooseItem - MenuLine
  90.  
  91. MoveDown:
  92. If ChooseItem > UBound(MenuItem$) - MenuLine Then
  93.     ChooseItem = ChooseItem Mod MenuLine
  94.     ChooseItem = ChooseItem + MenuLine
  95. If ChooseItem = 0 Then ChooseItem = MenuLine
  96.  
  97. Moveleft:
  98. ChooseItem = ChooseItem - 1
  99. If ChooseItem = 0 Then ChooseItem = UBound(MenuItem$)
  100.  
  101. MoveRight:
  102. ChooseItem = ChooseItem + 1
  103. If ChooseItem = UBound(MenuItem$) + 1 Then ChooseItem = 1
  104.  
  105. TopCol:
  106. ChooseItem = ChooseItem Mod MenuLine
  107. If ChooseItem = 0 Then ChooseItem = MenuLine
  108.  
  109. BottomCol:
  110. ChooseItem = UBound(MenuItem$) - (MenuLine - (ChooseItem Mod MenuLine))
  111. If MenuLine - (ChooseItem Mod MenuLine) = MenuLine Then ChooseItem = UBound(MenuItem$)
  112.  
  113.  
« Last Edit: January 29, 2022, 10:57:38 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #2 on: January 29, 2022, 11:06:45 pm »
More room more colors:
Code: QB64: [Select]
  1. 'Menucol.bas    Ray Thomas      January 2002
  2. 'Modified 01/29/2022
  3. Screen _NewImage(1024, 720, 32)
  4. Const blue = &HFF112288
  5. Const white = &HFFFFDDFF
  6.  
  7.  
  8. Dim MenuItem(60) As String * 15 'Define the menu item array
  9. Dim ChooseItem As Integer 'Currently chosen menu item
  10. Dim XMenuPosn As Integer 'Controls the menu item X positions
  11. Dim YMenuPosn As Integer 'Controls the menu item Y positions
  12. Dim Count As Integer 'Array counter
  13. Dim MenuLine As Integer 'Number of menu items per line
  14. Dim Temp As String 'Used to centre text in the space
  15.  
  16. Data Choice 1,Choice 2,Longer Choice 3,Choice 4,Longer Choice 5
  17. Data Choice 6,Choice 7,Choice 8,Choice 9,Choice 10
  18. Data Choice 11,Choice 12,Choice 13,Choice 14,Choice 15
  19. Data Choice 16,Choice 17,Choice 18,Choice 19,Choice 20
  20. Data Choice 21,Choice 22,Choice 23,Choice 24,Choice 25
  21. Data Choice 26,Choice 27,Choice 28,Choice 29,Choice 30
  22. Data Choice 31,Choice 32,Choice 33,Choice 34,Choice 35
  23. Data Choice 36,Choice 37,Choice 38,Choice 39,Choice 40
  24. Data Choice 41,Choice 42,Choice 43,Choice 44,Choice 45
  25. Data Choice 46,Choice 47,Choice 48,Choice 49,Choice 50
  26. Data Choice 51,Choice 52,Choice 53,Choice 54,Choice 55
  27. Data Choice 56,Choice 57,Choice 58,Choice 59,Choice 60
  28.  
  29. ChooseItem = 1 'Starting point of highlighted menu item
  30. XMenuPosn = 10 'X starting point of menu
  31. YMenuPosn = 3 'Y starting point of menu
  32. MenuLine = 4 'Number of columns in the menu
  33.  
  34.  
  35. '*** Fill the MenuItme Array ***
  36.  
  37. For Count = 1 To UBound(MenuItem$)
  38.     Read Temp$
  39.     '*** Centre the Text ***
  40.     Temp$ = Space$((15 - Len(Temp$)) / 2) + Temp$
  41.     MenuItem(Count) = Temp$
  42. Next Count
  43.  
  44.  
  45.  
  46.  
  47. GoSub DrawMenu
  48.  
  49. '*** get cursor key movements and redraw menu ***
  50.     Cmmnd$ = InKey$
  51.  
  52.     'Check for Esc key
  53.     If Cmmnd$ = Chr$(27) Then
  54.         End
  55.     End If
  56.     If Len(Cmmnd$) = 2 Then Cmmnd$ = Right$(Cmmnd$, 1)
  57.  
  58.     If Cmmnd$ = "8" Or Cmmnd$ = Chr$(72) Then GoSub MoveUp
  59.     If Cmmnd$ = "2" Or Cmmnd$ = Chr$(80) Then GoSub MoveDown
  60.     If Cmmnd$ = "4" Or Cmmnd$ = Chr$(75) Then GoSub Moveleft
  61.     If Cmmnd$ = "6" Or Cmmnd$ = Chr$(77) Then GoSub MoveRight
  62.     If Cmmnd$ = "9" Or Cmmnd$ = Chr$(73) Then GoSub TopCol
  63.     If Cmmnd$ = "3" Or Cmmnd$ = Chr$(81) Then GoSub BottomCol
  64.     If Cmmnd$ = "7" Or Cmmnd$ = Chr$(71) Then ChooseItem = 1
  65.     If Cmmnd$ = "1" Or Cmmnd$ = Chr$(79) Then ChooseItem = UBound(MenuItem$)
  66.  
  67.  
  68.     GoSub DrawMenu
  69.  
  70. Loop Until Cmmnd$ = Chr$(13)
  71.  
  72. Color blue, white
  73. Print "Item chosen ="; MenuItem(ChooseItem)
  74.  
  75.  
  76. DrawMenu:
  77. Color white, blue
  78. 'Draw the menu
  79. Locate YMenuPosn, XMenuPosn
  80. For Count = 1 To UBound(MenuItem$)
  81.     If Count = ChooseItem Then Color blue, white Else Color white, blue
  82.     Print MenuItem$(Count);
  83.     If Count Mod MenuLine = 0 Then
  84.         Print
  85.         Locate CsrLin, XMenuPosn
  86.     End If
  87. Next Count
  88.  
  89. MoveUp:
  90. If ChooseItem <= MenuLine Then
  91.     ChooseItem = UBound(MenuItem$) - (MenuItem)
  92.     ChooseItem = ChooseItem - MenuLine
  93.  
  94. MoveDown:
  95. If ChooseItem > UBound(MenuItem$) - MenuLine Then
  96.     ChooseItem = ChooseItem Mod MenuLine
  97.     ChooseItem = ChooseItem + MenuLine
  98. If ChooseItem = 0 Then ChooseItem = MenuLine
  99.  
  100. Moveleft:
  101. ChooseItem = ChooseItem - 1
  102. If ChooseItem = 0 Then ChooseItem = UBound(MenuItem$)
  103.  
  104. MoveRight:
  105. ChooseItem = ChooseItem + 1
  106. If ChooseItem = UBound(MenuItem$) + 1 Then ChooseItem = 1
  107.  
  108. TopCol:
  109. ChooseItem = ChooseItem Mod MenuLine
  110. If ChooseItem = 0 Then ChooseItem = MenuLine
  111.  
  112. BottomCol:
  113. ChooseItem = UBound(MenuItem$) - (MenuLine - (ChooseItem Mod MenuLine))
  114. If MenuLine - (ChooseItem Mod MenuLine) = MenuLine Then ChooseItem = UBound(MenuItem$)
  115.  
  116.  
  117.  
  118.  

Offline QB64Curious

  • Newbie
  • Posts: 22
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #3 on: January 30, 2022, 01:08:23 pm »
Thanks, bplus.  Unfortunately, the examples don't compile in 4.5.

The first one returns an Illegal Function call, at the COLOR statement.  That's probably deceptive, and the error is occurring somewhere else.

The second returns an Expected: Expression error, at the Screen statement.

Offline QB64Curious

  • Newbie
  • Posts: 22
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #4 on: January 30, 2022, 01:09:55 pm »
Looks like the first attachment didn't make it.  This is the illegal function call error.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #5 on: January 30, 2022, 01:42:55 pm »
OK @QB64Curious I thought you were curious about QB64, so I show you QB64. (Where'd I get that idea??? LOL)

I am surprised
Code: QB64: [Select]
  1. Color fore, back
doesn't work in QB<64??? but it's been years since I've coded in it.

Your first screen shot shows crap code ie Const declare mixed into a Screen command but no way that code would work in old QB, and 2nd doesn't show me enough code to see possible cause of error.

Does QB4.5 have screen 12? I don't remember.

« Last Edit: January 30, 2022, 02:05:15 pm by bplus »

Offline QB64Curious

  • Newbie
  • Posts: 22
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #6 on: January 30, 2022, 02:59:46 pm »
From a search on the web, it looks like 4.5 had 13 screens.


Yep, my plan for now is to work only with 4.5 compatible qb64 code.  The idea is to be able to code on the pc using qb64 during the day.  And when the mood strikes in the evening on the recliner or recumbent bike, code 4.5 on the android tablet.

Ok, I'll play with the code a bit, and post here when it's running ok.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #7 on: January 30, 2022, 03:14:09 pm »
Surely 7 for low white and 1 for blue should work even in that old dinosaur QB4.5 LOL!

Those don't change color when you swap colors in screen 0, default when no screen is declared.

Offline QB64Curious

  • Newbie
  • Posts: 22
    • View Profile
Re: How to get this kind of color background, with this menu item colors
« Reply #8 on: January 30, 2022, 04:03:41 pm »
All set, thanks BPlus.

Code: QB64: [Select]
  1. 'Menucol.bas    Ray Thomas      January 2002
  2. 'Modified 01/29/2022
  3.  
  4. ' SCREEN 12  ' No idea why this is generating a compiler error.
  5. CONST blue = 1
  6. CONST white = 7
  7.  
  8. DIM MenuItem(60) AS STRING * 15 'Define the menu item array
  9. DIM ChooseItem AS INTEGER       'Currently chosen menu item
  10. DIM XMenuPosn AS INTEGER        'Controls the menu item X positions
  11. DIM YMenuPosn AS INTEGER        'Controls the menu item Y positions
  12. DIM Count AS INTEGER            'Array counter
  13. DIM MenuLine AS INTEGER         'Number of menu items per line
  14. DIM Temp AS STRING              'Used to centre text in the space
  15.  
  16. DATA Choice 1, Choice 2, Longer Choice 3, Choice 4, Longer Choice 5
  17. DATA Choice 6, Choice 7, Choice 8, Choice 9, Choice 10
  18. DATA Choice 11, Choice 12, Choice 13, Choice 14, Choice 15
  19. DATA Choice 16, Choice 17, Choice 18, Choice 19, Choice 20
  20. DATA Choice 21, Choice 22, Choice 23, Choice 24, Choice 25
  21. DATA Choice 26, Choice 27, Choice 28, Choice 29, Choice 30
  22. DATA Choice 31, Choice 32, Choice 33, Choice 34, Choice 35
  23. DATA Choice 36, Choice 37, Choice 38, Choice 39, Choice 40
  24. DATA Choice 41, Choice 42, Choice 43, Choice 44, Choice 45
  25. DATA Choice 46, Choice 47, Choice 48, Choice 49, Choice 50
  26. DATA Choice 51, Choice 52, Choice 53, Choice 54, Choice 55
  27. DATA Choice 56, Choice 57, Choice 58, Choice 59, Choice 60
  28.  
  29. ChooseItem = 1          'Starting point of highlighted menu item
  30. XMenuPosn = 10          'X starting point of menu
  31. YMenuPosn = 3           'Y starting point of menu
  32. MenuLine = 4            'Number of columns in the menu
  33.  
  34.  
  35. '*** Fill the MenuItme Array ***
  36.  
  37. FOR Count = 1 TO UBOUND(MenuItem$)
  38.         READ Temp$
  39.         '*** Centre the Text ***
  40.         Temp$ = SPACE$((15 - LEN(Temp$)) / 2) + Temp$
  41.         MenuItem(Count) = Temp$
  42. NEXT Count
  43.  
  44.  
  45.  
  46. COLOR white, blue
  47. GOSUB DrawMenu
  48.  
  49. '*** get cursor key movements and redraw menu ***
  50.         Cmmnd$ = INKEY$
  51.        
  52.         'Check for Esc key
  53.         IF Cmmnd$ = CHR$(27) THEN
  54.                 END
  55.         END IF
  56.         IF LEN(Cmmnd$) = 2 THEN Cmmnd$ = RIGHT$(Cmmnd$, 1)
  57.        
  58.         IF Cmmnd$ = "8" OR Cmmnd$ = CHR$(72) THEN GOSUB MoveUp
  59.         IF Cmmnd$ = "2" OR Cmmnd$ = CHR$(80) THEN GOSUB MoveDown
  60.         IF Cmmnd$ = "4" OR Cmmnd$ = CHR$(75) THEN GOSUB Moveleft
  61.         IF Cmmnd$ = "6" OR Cmmnd$ = CHR$(77) THEN GOSUB MoveRight
  62.         IF Cmmnd$ = "9" OR Cmmnd$ = CHR$(73) THEN GOSUB TopCol
  63.         IF Cmmnd$ = "3" OR Cmmnd$ = CHR$(81) THEN GOSUB BottomCol
  64.         IF Cmmnd$ = "7" OR Cmmnd$ = CHR$(71) THEN ChooseItem = 1
  65.         IF Cmmnd$ = "1" OR Cmmnd$ = CHR$(79) THEN ChooseItem = UBOUND(MenuItem$)
  66.  
  67.  
  68.         GOSUB DrawMenu
  69.  
  70. LOOP UNTIL Cmmnd$ = CHR$(13)
  71.  
  72.     PRINT
  73.     COLOR 7, 1
  74.     PRINT "Item chosen ="; MenuItem(ChooseItem)
  75.  
  76.  
  77. DrawMenu:
  78. 'Draw the menu
  79. LOCATE YMenuPosn, XMenuPosn
  80. FOR Count = 1 TO UBOUND(MenuItem$)
  81.         IF Count = ChooseItem THEN COLOR blue, white ELSE COLOR white, blue
  82.         PRINT MenuItem$(Count);
  83.         IF Count MOD MenuLine = 0 THEN
  84.                 PRINT
  85.                 LOCATE CSRLIN, XMenuPosn
  86.         END IF
  87.         NEXT Count
  88.  
  89. MoveUp:
  90. IF ChooseItem <= MenuLine THEN
  91.         ChooseItem = UBOUND(MenuItem$) - (MenuItem MOD MenuLine)
  92.         ChooseItem = ChooseItem - MenuLine
  93.  
  94. MoveDown:
  95. IF ChooseItem > UBOUND(MenuItem$) - MenuLine THEN
  96.         ChooseItem = ChooseItem MOD MenuLine
  97.         ChooseItem = ChooseItem + MenuLine
  98. IF ChooseItem = 0 THEN ChooseItem = MenuLine
  99.  
  100. Moveleft:
  101. ChooseItem = ChooseItem - 1
  102. IF ChooseItem = 0 THEN ChooseItem = UBOUND(MenuItem$)
  103.  
  104. MoveRight:
  105. ChooseItem = ChooseItem + 1
  106. IF ChooseItem = UBOUND(MenuItem$) + 1 THEN ChooseItem = 1
  107.  
  108. TopCol:
  109. ChooseItem = ChooseItem MOD MenuLine
  110. IF ChooseItem = 0 THEN ChooseItem = MenuLine
  111.  
  112. BottomCol:
  113. ChooseItem = UBOUND(MenuItem$) - (MenuLine - (ChooseItem MOD MenuLine))
  114. IF MenuLine - (ChooseItem MOD MenuLine) = MenuLine THEN ChooseItem = UBOUND(MenuItem$)
  115.