Sometimes you don’t have space on your panel for a huge router bus, but you need occasional access to a large number of router sources. Here’s a live example of how you can make a button on your router bus dynamically assignable while the panel is running.
Now let’s take a look at the code for that. First step is to download the panel file Router Pick.
The source selection section of this panel comprises two RouterBus controls:
- ExtBus – all the ‘normal’ statically assigned sources
- PickBus – the dynamically assigned source
The Pick… button just executes a quick script to reveal the source picker.
It’s a bit of a cheat but it works just fine. Clicking on Pick… moves the whole window over to reveal the picker, which is located to the left of the main panel.
The Back button moves the window back to its normal position.
You select your ‘pick’ source on this RouterBus called Picker. This bus is set to work in ArmAndTake mode so clicking on a source simply arms the source but does not take it. And Picker has an OnClick script
which sets the First Input property of the PickBus (the last button in the source selection section) to the armed input. Now PickBus points to the source you have chosen. And if you now click on the PickBus that source will be selected on the router output.
And one last detail. We need ExtBus and PickBus to be in the same RouterBus group. So we have this line of Lua script in the panel’s BeforeConnect script.
Quite a neat and simple way to expand access to router sources without taking up your entire screen.