When is a menu not a menu?

Martin Baxter martin at materiaprima.fsnet.co.uk
Sat Apr 2 10:22:32 EST 2005


>I  know that menus are really buttons, but in the documentation there
>is an example:
>
>  disable menu "Text"
>
>which implies that you can use the term 'menu' as being more
>descriptive. However, I found out that
>
>   put exists(menu "myMenu" of grp "Main_Menu" of cd "Main" of stack
>"Main_Display")
>
>results in 'false', whereas
>
>   put exists(btn "myMenu" of grp "Main_Menu" of cd "Main" of stack
>"Main_Display")
>
>returns 'true'
>
>In what circumstances does RR allow me to use the term 'menu' as a
>synonym for button?
>
>Graham

Hi Graham,

I got quite confused about this too at first, but it was explained to me that

menu "menuName" always refers to a menu in the *active* menu, whereas
button "whatever" of cd "cdname" addresses the object specifically.

I think the usage is meant to be that if you specifically want to do
something to, or test something in, the active menu, whatever it happens to
be, then you can use the "menu" syntax. On the other hand if you are trying
to affect a specific menu button object, then use that form.

I found this out when trying to set up a stack's menus in preopenstack. At
that time they are not yet active, and you need to refer to the button
objects explicitly.

I think that if you do

put exists(menu "myMenu")

you would get true if such a menu were in the active menu bar and false if not.

HTH

Martin Baxter




More information about the use-livecode mailing list