Page 1 of 1

API to get all widget states on page load

Posted: Fri Sep 29, 2017 9:39 am
by ghostgum
When web virtual console loads, it shows the correct state of buttons. This is because QLC+ knows the state of the buttons and generates HTML with buttons in the correct state (i.e. green for active buttons, grey for inactive).

When I load a customised virtual console page from my web server, the buttons are all in the inactive state, because I don't yet know the button states.

What I would like is an API that generates web socket messages for the current state of all controls. For example, if the page had four button in a solo frame and the first button was selected, it would generate
1|BUTTON|1
2|BUTTON|0
3|BUTTON|0
4|BUTTON|0

I thought to use the getWidgetStatus API, but because the websocket is asynchronous, the responses don't give you the context.
getWidgetStatus|1
getWidgetStatus|2
getWidgetStatus|3
getWidgetStatus|4
which returns
QLC+API|getWidgetStatus|255
QLC+API|getWidgetStatus|0
QLC+API|getWidgetStatus|0
QLC+API|getWidgetStatus|0
When I receive each of these in the handler, I don't know the widget to which it belongs.

More useful would be a message that contains also contains the widget number:
QLC+API|getWidgetStatus|255|1
QLC+API|getWidgetStatus|0|2
QLC+API|getWidgetStatus|0|3
QLC+API|getWidgetStatus|0|4
With this I could easily modify the style of each button 1-4 to the correct stage.

At the moment, the workaround seems to be to request each widget status, wait for the response, then send the next request...

More useful would be an API function that triggers websocket messages for each widgets (button, slider etc.)