You can combine many menu structures from different devices into a single menu, this works by each remote menu being represented by a
MenuInMenu object being associated with a
RemoteConnection and a
MenuManagerServer. It maps the remote menu into an unused ID range on the local device and even handles dialog commands. Available from version 2.3 of tcMenu Designer and API.
Each menu in menu definition that we create results in a remote connection to another device, and the selected sub-menu receiving all the menu items from that device as if they were local menus. To ensure there are no ID overlaps, the IDs of the remote menus are given an offset so they appear unique locally. However, should you alter any of these menu items they will be sent remotely with their original ID.
In the diagram below we have three MenuInMenus,
Device 1 maps all remote item ID by adding 100000 to them and the items appear in the “Device 1 SubMenu” locally.
Device 2 maps all remote item ID by adding 200000 to them and the items appear in the “Device 2 SubMenu” locally, and likewise
Device 3 maps all remote item ID by adding 300000 into the “Device 3 SubMenu” locally.
In addition to the range of IDs we also provide the dialog manager that will be used to forward any dialogs from the remote, the submenu in the local tree where this menu should be replicated, and also the replication mode, there are tree possible modes:
REPLICATE_SILENTLY- this does not tell the manager that the tree has structurally changed, useful only in certain circumstances.
REPLICATE_NOTIFY- this mode notifies of any structural changes
REPLICATE_ADD_STATUS_ITEM- this mode notifies and also creates a boolean menu item representing the state of the connection.
If you’ve not already read it first read the Embedded Java core documentation
You must ensure that the UUID you have chosen is paired with the device as the MenuInMenu system has no means of pairing. Choices are:
MenuInMenu is a first class concept in the designer UI. To edit connections:
First ensure that you have the platform set to “RaspberryPI / Java”. This is the only platform to support menu in menu.
From the “Code” menu select the “Menu In Menu” option, this will present the menu in menu editor shown below:
In the above window the table shows the list of currently set up
MenuInMenu items for this project. Here you can “Add”, “Edit” and “Remove” items. When you add or edit an item the following dialog appears:
In the above dialog the fields are as follows:
For Socket connections
For Serial connections
Once created, these items will appear in the “App” class in their own method.
Although you can add MenuInMenu items manually, it is far easier to add them using designer UI, however the basic procedure for manual creation is:
Once started, this will keep the menu from the remote up to date in our local menu. Any changes made to it will be reflected back to the device. This is very useful when combined with embedCONTROL, as the PI can serve up a single web application with the data from all your devices.