Hi Jeremy,

No, I am not adding dynamic menus.
I needed a list of all the menu bars, their menus and their menu items as set 
in the Menu editor.

I eventually realised that I need to call SET MENU BAR($i) for every menu bar I 
want to get the menus and menu items for, 

and then to this:
$MenuBarRef:=Get menu bar reference(Current process)
to get the menu ref to use.

You have to use MenuBarRef to do GET MENU ITEMS for the selected menu bar to 
get the menus

Then, you need to do GET MENU ITEMS for every menu in the menu bar, to get the 
menu items

It will not work if you do it differently.

Damn … I spent hours figuring this thing out… 


Regards,

Rudy Mortier
Two Way Communications bvba  -----------------



> On 26 Sep 2017, at 19:54, Jeremy French <[email protected]> wrote:
> 
> Hi Randy,
> 
> I gather you are adding one or more dynamic menus to the menu bar created in 
> the Menu Editor. In that case, you need to work with references, not a 
> positional integer.
> 
> The positional index works only for menus created in the Menu Editor.
> 
> Try this, which assumes no hierarchical menus:
> 
> --
> $mb_ref_t:=Get menu bar reference
> 
> ARRAY TEXT($mb_menu_title_at;0)
> ARRAY TEXT($mb_menu_ref_at;0)
> 
> GET MENU ITEMS($mb_ref_t;$mb_menu_title_at;$mb_menu_ref_at)
> 
> For ($menu_i;1;Size of array($mb_menu_title_at))
>       
>       $menu_title_t:=$mb_menu_title_at{$menu_i}
>       $menu_ref_t:=$mb_menu_ref_at{$menu_i}
>       
>       ARRAY TEXT($menu_item_text_at;0)
>       ARRAY TEXT($menu_ref_at;0)
>       
>       GET MENU ITEMS($menu_ref_t;$menu_item_text_at;$menu_ref_at)
>       
>       For ($menu_item_i;1;Size of array($menu_item_text_at))
>               
>               $menu_item_ref_t:=$menu_item_text_at{$menu_item_i}
>               
>               // get specifics using positional $menu_item_i OR reference 
> $menu_item_ref_t
>               
>       End for
> End for
> 
> - Jeremy French
> 
> 
>> On Sep 26, 2017, at 11:52 AM, Two Way Communications via 4D_Tech 
>> <[email protected] <mailto:[email protected]>> wrote:
>> 
>> Although you can get a list of menus in the menu bar (GET MENU ITEMS), this 
>> doesn’t work when you pass the menu ref for one of the menus. 
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to