HumanUI Dynamic Element creation help

trying to experiment with some HumanUI dynamic elements wherein the quantity of pull-down menu and checklist elements are automatically generated depending on a list length attached (i.e., a list of Honeybee zones for example). Everything is working 99% of the way and luckily I’m not getting any create/set warnings as the 2nd set of pull downs are dependent on the Honeybee zone program component outputs.

BUT…what is not working properly is the Value Listener on the pull-down elements. when a pull-down menu is selected, the LIVE Value Listener is not receiving the input value/index #…ONLY does the value listener do a mass receive when the LAST pull down menu item is selected. So in the example image I provided, when “Retail” is selected for zone08, the values for zones01-07 are populated in the value listener…same for the second set of pull downs…only when “Retail::Retail” is selected are all the above Office sub-program types populated in the value listener.

any insight would be great to get the value listener to update on each and every pull down selection! GH file attached.


Dynamic Element Creation.gh (504.8 KB)

Hi there –

The problem with your definition stems from the fact that the Value listener does not play nicely with Tree inputs – if you flatten the E input on the value listeners, the values come out properly.

That said – I’m not sure if you plan on changing the number of zones that display programmatically, but if you do, you will need to use a Show/Hide paradigm to manage the number of pulldowns instead of generating them directly. Failing to do so will cause the whole UI to regenerate each time the number of zones displayed changes.

To do that properly, you would set up a large number of possible zones (larger than the number you ever expect to be displayed), use a Set paradigm to set their contents accordingly, and then show only the ones that are relevant. It’s not ideal, but it’s the way it works. :slight_smile:

Cheers,
Marc

Thanks Marc…after playing around with the script this weekend I came to that same conclusion that my bottleneck was the fact that whenever I change the “building program” pulldown the entire “zone program” side refreshes and I lose all the inputs I had previously put in which is not a good thing!

for now, my workaround is to have the list contents of the “zone program” a static list that doesn’t ever update…the good thing is that I don’t have the refresh/regenerate issue, the bad thing is that that zone list is 121 items long and doesn’t “filter” to only show the zone types associated with the selected building type…oh well!

thanks for your insight!

I think I might have misundertood your original question. I thought you were saying that you were trying to programmatically generated a variable number of rows of sliders (e.g., variable number of zones). This you would need to do with a show/hide paradigm. For the second column of Pulldowns, you can automate and programmatically change the number of items using a Set Listbox component with no problem. That’s the point of the Set components, in fact, changing them after initial instantiation.

Really the only problem in your script in terms of values not updating was the flattening of the inputs of the Value Listeners.

Cheers,
Marc

thanks Marc…I got it working with the flattening of the inputs on the Value Listeners AND removing the “-1” from the “set list initial item selected” and moved the “-1” to the initial state…there is code in the Honeybee Zone Programs specific to a “-1” input and I believe that was causing the refresh as well.

while I have you…with the HumanUI Chart element…how can I get a NEGATIVE bar chart…right now the value label shows but I was hoping for the bar chart to actually graphically show the negative scale too.

image