On the basis of an example project (Layer_Container.zip), a pull-down menu is to be displayed, which is implemented via layers with state buttons.
Sometimes you want to combine several objects, e.g. control elements, into a kind of “collection container” or “container” in order to dynamically change them all by a single, central operation on the container object. So something similar to a “panel” (known from other systems) should be simulated, which can be switched to “visible” or “invisible” for example and thus – in one fell swoop – also the elements contained therein (buttons, sliders, text outputs, etc.).
Although there is no panel in Elvis in the narrower sense, there are one or more layers on each Elvis operating page, which can also serve as containers for control elements.
On the basis of an example project (Layer_Container.zip), a pull-down menu is to be displayed, which is implemented via layers with state buttons:
It consists of only one page, which, in addition to the “Controls” and “Background” layers, also contains the “Basement”, “Ground Floor” and “Stock1” layers. After opening, only the buttons “Basement”, “Ground floor” and “1st floor” are displayed, which are contained in the “Controls” layer. After clicking on the “Basement” button, the blue buttons “Hallway” and “Guest Room” of the associated layer “Basement” also appear, because this switches it to “visible”.
For example, if you now click on “Ground floor”, the layer “Basement” (with the two blue buttons) becomes invisible again and instead the layer “Ground floor” is displayed with three red buttons. Similarly, when you click on “1st floor”, only the “Bedroom” button of the “Floor1” layer is displayed.
Finally, the additional “Submenu OFF” button can be used to hide all three layers again, so that the output state is displayed when the page is opened.
The logic for showing and hiding the three layers is stored in the global subroutine “Layer_Init” of the page event processing (under “Form/(global)”). For certain events, such as opening the page (“Form_Load”) or button clicks, this subroutine is then only called with different arguments for layer visibility.