execute_menu()

execute_menu() is used to monitor the state of the menu and to return the action_id of the menu option activated by the user. This option does not require any arguments. See the snippet of code above for the usage example.

MAIN

 

DEFINE

 main_menu_id INT,

 submenu1_id,exit_id INT,

 action_id INT

 

LET main_menu_id = create_menu()

 

LET submenu1_id = menu_add_submenu(main_menu_id, "menu1")

CALL menu_add_option(submenu1_id, "menu1_submenu1  ",101)

CALL menu_add_option(submenu1_id, "menu1_submenu2  ",102)

CALL menu_add_option(submenu1_id, "menu1_submenu3  ",103)

 

LET exit_id = menu_add_option(main_menu_id, "exit",199)

 

LET action_id = 0

 

WHILE TRUE

CALL menu_publish()

  LET action_id = execute_menu()

  

  IF action_id = 0 THEN

   CONTINUE WHILE

  END IF

  CASE action_id

  WHEN 101

     DISPLAY "you pressed 'menu1_submenu1'" AT 5,1

  WHEN 102

     DISPLAY "you pressed 'menu1_submenu2'" AT 5,1

  WHEN 103

     DISPLAY "you pressed 'menu1_submenu3'" AT 5,1 ATTRIBUTE (BLUE)

  WHEN 199

    EXIT WHILE

  END CASE

END WHILE

END MAIN

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.