In Human UI, I understand that you aren’t recommended to drive the creation of elements with the results of a value listener, in order to prevent “freezing” behaviour.
However, what if I want to have an element that controls which other elements are displayed in the window?
Example: For a Ladybug script, I want to allow the user some control to define the analysis period. Either, they can select time frames (e.g. summer mornings), or a single hour of year.
If they choose the former, I want them to be able to select seasons and times of day through dropdowns:
If they choose the latter, I want them to select an hour of year using 3 sliders (month, day, hour):
I’ve marked the connection that causes the freezing behaviour and the warning in the AddElements component:
- In general, it’s not a good idea to drive the creation of
elements with the results of a value listener. Instead, use
the value listener to drive a “Set” operation, from the
UI Output tab, to update the contents of an existing element
in the window. Otherwise, every time something in the window
changes, triggering your value listener, the entire window needs
to be re-generated. This can create the appearance of a “freezing”
behavior. See the example files for more information on the appropriate
configuration of “Create” and “Set” components in Human UI.
…but I can’t think of another way to create the functionality I’m looking for. Any Ideas?
unnamed.gh (17.5 KB)