I would like to change a Label component content from one input to multiple dynamic inputs that would be registered from a TextBox component.
Usually, when placed multiple text inputs directly to the label, this component shows all of them. (Option A)
However, since we have a dynamic input that is generated through another Human UI component (Textbox), the correct way to change the label content is by adding it through a SetLabel. (Option B), but here, the Label component only recognizes 1 input
As far as I remember, one of the cardinal rules of this plugin is to always change the components with a “Set…” component instead of feeding the values from behind the component. But in this case this doesn’t work.
Dynamic label input.gh (10.5 KB)
The reason you’re only seeing one value is because there is only one label element. When you feed “Set label” a list, it will simply run through the list and set the single label element to each value in turn. so, faster than you can see, it sets it to A, then B, then C, which is why you only see C.
Human UI is notoriously bad at “dynamic” elements. You just can’t add/remove elements on the fly.
If you can set a cap on the number of possible elements, then you can fake it a bit by creating, say, 20 labels, and dynamically hiding/showing them with Hide/Show Element, similar to this answer: HumanUI: ...but I DO need to drive the creation of elements with the results of a value listener...? - #2 by andheum
First of all, Thank you so much to spare your time to help on this.
As a previous nbbj architect, I always admired the tools you were developing for the studio and you inspired me to dive deeper into grasshopper.
Indeed the solution became way more simple than I thought.
In a nutshell, Is all about repeating values to a certain number and then replace and show the values we need and hide the ones we don’t. Better explained by looking at the script
Control components with multiple variable inputs.gh (23.6 KB)