Custom menus

I've seen some custom menus on some of the demo programs on TB silver how do i create my own?

Thnx
Stuart

Comments

Menus

Hi Stuart,

Look up DEMWIN1.TRU for an example of how to create a menu structure, e.g.

DIM menus$(4,0:3)
MAT READ menus$
DATA File, Quit, "", ""
DATA Show, Show 1, Show 2, Show 3
DATA Hide, Hide 1, Hide 2, Hide 3
DATA Active, Active 1, Active 2, Active 3

Note the menu$ two dimensional array shows the number of menu headings (4) and the number of items under each heading (3). Item zero in each case is the actual heading itself.

Regards
Big John

Linking to Subroutines

Great thanks i got the menus to show.
Is there now a way of linking them to subroutines?

Menus

Hi,

First of all you need an event loop e.g.

DO
CALL TC_Event (0, event$, window, x1, x2)

IF event$ = "MENU" then
SELECT CASE x1 ! the headings
CASE 1 ! first heading
SELECT CASE x2 ! the items
CASE 1 ! first item
REM: insert the code that deals with item 1 under the first menu heading
CASE 2 ! second item
REM: the code for item 2
CASE 3 ! third item
REM: the code for item 3
END SELECT
CASE 2 ! second heading
SELECT CASE x2 ! the items
CASE 1
CASE 2
CASE 3
END SELECT
CASE 3 ! third heading
SELECT CASE x2 ! the items
CASE 1
CASE 2
CASE 3
END SELECT
CASE 4 ! fourth heading
SELECT CASE x2 ! the items
CASE 1
CASE 2
CASE 3
END SELECT
CASE ELSE
END SELECT
END IF
LOOP

That is all there is to it.

Regards
Big John