For more convenient interaction some kind of state logic was added to the layout xml scheme. Check it out by selecting the “Default state layout” from within the 2.0 version of the app.
1. toggle button
A toggle button (e.g. mute on/off) with two or even more states can be defined with the following attributes:
<button statetype="toggle" states="MUON;MUOFF" statequery="MU?" label="Mute off;Mute on" iconid="20;21" style="red;dark" ...>MUOFF;MUON</button>
As you can see, you have to define a statetype (
toggle) and the states, seperated by character
;. The states have to match the corresponding EVENTS received from the AVR. The statequery attribute defines the COMMAND to request the current state from the AVR. Label, iconid and style attributes can be defined per state as well by using the above character as a delimiter. If you define only one, it is used for every state. The actual commands which will be sent refer to the states by their order, which means in “MUON” state “MUOFF” will be sent and vice versa for the example above.
2. view “button”
To show some info without interaction a view only “button” can be defined:
<button statetype="view" states="state1;state2" statequery="query?" label="label1;label2" style="red;dark" ...>dummy</button>
It works exactly the same as the toggle button except it can not be clicked. As the element value (the COMMAND) can not be empty in the xml structure, provide some dummy string as it will not be used at all.
To give some more flexibility placeholders “
$number” and “
$text” can be used in the state attribute and referenced in the label attribute by “
The following example will show the current source:
<button statetype="view" states="SI$text" statequery="SI?" label="Source: $" ...</button>
$text” will match everything, “
$number” can be used to explicitly match numbers.
3. chooser button
To allow for a more convenient way of selecting “something” with some more possible values (like input source, presets) a chooser button can be defined which shows a list context menu on button press:
<button statetype="chooser" states="SI$text" statequery="SI?" label="Source: $" list="Blue Ray;Sat/Cable;TV;Net/USB;DVD..." ...>SIBD;SISAT/CBL;SITV;SINET/USB;SIDVD...</button>
The actual command which will be sent refers to the selected list entry by order. This element can be combined with placeholders.
You can omit the
statequery attributes. In this case the button will act like a simple “list chooser” without any AVR response evaluation. This can be usefull for e.g. Presets.