home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxlb.zip / SAMPLES / MENUS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-04-29  |  4KB  |  135 lines

  1. /**********************************************/
  2. /* example of RXWINDOW function package usage */
  3. /**********************************************/
  4.  
  5. call rxfuncadd 'w_register', 'rxwin30', 'rxwindow'
  6. call w_register
  7.  
  8. call initialize
  9. w = w_open(2,2,23,78,normal)
  10. call w_border w
  11. current = 1
  12. menu_item = 1
  13. do i = 1 to food_types
  14.     if i = current then attr = reverse
  15.     else attr = normal
  16.     call w_put w, 2, 3+(i-1)*10, food_type.i,, attr
  17.     end
  18. call w_put w, 20, 20, "Select type of cuisine with /"||'1a'x||'.'
  19. call w_put w, 21, 20, "Select main course with /."
  20. call w_put w, 22, 20, "Press ESC to exit."
  21. call show_menu 1
  22. do forever
  23.     key = inkey()
  24.     select
  25.         when key = right then do
  26.             call w_close w1
  27.             call w_attr w, 2, 3+(current-1)*10, length(food_type.current), normal
  28.             if current < food_types then current = current + 1
  29.             else current = 1
  30.             call w_attr w, 2, 3+(current-1)*10, length(food_type.current), reverse
  31.             menu_item = 1
  32.             call show_menu current
  33.             end
  34.         when key = left then do
  35.             call w_close w1
  36.             call w_attr w, 2, 3+(current-1)*10, length(food_type.current), normal
  37.             if current > 1 then current = current - 1
  38.             else current = food_types
  39.             call w_attr w, 2, 3+(current-1)*10, length(food_type.current), reverse
  40.             menu_item = 1
  41.             call show_menu current
  42.             end
  43.         when key = down then do
  44.             call w_attr w1, menu_item+1, 2, length(food.current.menu_item), normal1
  45.             if menu_item < food.current.0 then menu_item = menu_item + 1
  46.             else menu_item = 1
  47.             call w_attr w1, menu_item+1, 2, length(food.current.menu_item), reverse1
  48.             end
  49.         when key = up then do
  50.             call w_attr w1, menu_item+1, 2, length(food.current.menu_item), normal1
  51.             if menu_item > 1 then menu_item = menu_item - 1
  52.             else menu_item = food.current.0
  53.             call w_attr w1, menu_item+1, 2, length(food.current.menu_item), reverse1
  54.             end
  55.         when key = esc then leave
  56.         otherwise nop
  57.         end
  58.     end
  59. call w_close w
  60. exit
  61.  
  62. /* show a cuisine menu */
  63. show_menu:
  64. n = arg(1)
  65. w1 = w_open(4,4+(n-1)*10,food.n.0+2,36,normal1)
  66. call w_border w1, 1, 1, 1, 1
  67. attrib. = normal1
  68. attrib.menu_item = reverse1
  69. do j = 1 to food.n.0
  70.     call w_put w1, j+1, 2, food.n.j,, attrib.j
  71.     end
  72. drop attrib.
  73. return
  74.  
  75. /* initialize variables */
  76. initialize:
  77. esc = '1b'x
  78. right = '004d'x
  79. left  = '004b'x
  80. up = '0048'x
  81. down = '0050'x
  82.  
  83. parse value pcvideomode() with irc colors . .
  84. if irc = 1 & colors < 4 then do
  85.     normal = 7
  86.     normal1 = 7
  87.     reverse = 112
  88.     reverse1 = 112
  89.     end
  90. else do
  91.     normal = 47
  92.     normal1 = 31
  93.     reverse = 112
  94.     reverse1 = 112
  95.     end
  96. food_type.1 = 'French'
  97. food_type.2 = 'Italian'
  98. food_type.3 = 'Chinese'
  99. food_type.4 = 'Indian'
  100. food_type.5 = 'Cajun'
  101. food_types = 5
  102. food.1.1 = "Boeuf à la Bourguignonne"
  103. food.1.2 = "Canard aux Pêches"
  104. food.1.3 = "Coquilles Saint Jacques"
  105. food.1.4 = "Escalopes de Veau à l'Estragon"
  106. food.1.5 = "Grillade d'Agneau à la Provençale"
  107. food.1.0 = 5
  108. food.2.1 = "Cannelloni alla Romana"
  109. food.2.2 = "Fettuccine alla moda di Alfredo"
  110. food.2.3 = "Lasagna Bolognese"
  111. food.2.4 = "Linguine al Sugo di Vongole"
  112. food.2.5 = "Pollo alla Cacciatora"
  113. food.2.6 = "Tortellini Carbonara"
  114. food.2.0 = 6
  115. food.3.1 = "Kung Pao Prawns"
  116. food.3.2 = "Lemon Chicken"
  117. food.3.3 = "Mo Shu Pork"
  118. food.3.4 = "Mongolian Beef"
  119. food.3.5 = "Peking Duck"
  120. food.3.6 = "Yu-Shiang Eggplant"
  121. food.3.0 = 6
  122. food.4.1 = "Booti Kabab"
  123. food.4.2 = "Gosht Vindaloo"
  124. food.4.3 = "Lamb Pasanda"
  125. food.4.4 = "Shahi Korma"
  126. food.4.5 = "Tandoori Chicken"
  127. food.4.0 = 5
  128. food.5.1 = "Blackened Redfish"
  129. food.5.2 = "Cajun Prime Rib"
  130. food.5.3 = "Panéed Chicken and Fettucini"
  131. food.5.4 = "Sautéed Crawfish"
  132. food.5.5 = "Shrimp Creole"
  133. food.5.0 = 5
  134. return
  135.