Setting the entries in a value list?

You can. You just need to add " " around the values, so that it knows its a string (don’t know why you don’t need it for the keys). Just use Concatenate for that:

set_dropdown.gh (7.4 KB)

Hi,

Thanks again :slight_smile:.
I have included it in the script, see below.

There is only 1 thing I must admit, which I would like to change.

If you add an item to the key list and click on the Set ‘Button’. Then all the value lists are ‘resetted’ to the upper Key item.

This while I would like to retain the item which was in the previous selection. After which you have the opportunity to select the ‘newly added Key’ item.

2021-01-07 Dropdown based on inputs_RE.gh (8.9 KB)

do you have any suggestions?

Thanks :slight_smile:

You can track the currently selected key, and select it again after editing the key/values, if it exists:

210108_PopulateValueList_00.gh (5.5 KB)

3 Likes

So cool. Now it doesn’t need the Set button any longer really and we can have more dynamically updating dropdowns. As it happens its exactly what I need right now :slight_smile:

1 Like

Ahh nice!
This is really handy! :slight_smile:

Only 1 small thing question;
If I would like to add another ‘value List’ and would like to link it to the same PVL dropdown list;
If I add another value list, and simply adjust the name it does not ‘connect/automatically select the dowpdown’. Or what do I have to do to ‘connect’ these?

The copy paste function does work btw, but I am just interested in how it works :slight_smile:

thanks again!

It should work the same. The PVL component needs to run again in order to edit the new value list. So you can just recompute the canvas (or add a toggle button as an input to the PVL component again).

1 Like

Thanks you are right! Pefect! :+1: :+1:

1 Like

This thread is almost TLTR, considering it was “solved” in post #2, but I read it all. The only code I tried was your last post (210108_PopulateValueList_00.gh) and I have a bug to report and a suggestion.

If you connect either of your two text panels (both labeled “Keys”?) to both the ‘Keys’ and ‘Values’ inputs of your Python component, it behaves as expected; the dropdown value is also the output.

However, if you disconnect the PVL ‘Values’ input there is trouble.

  • BUG: 1. Solution exception:‘NoneType’ object has no attribute ‘Name’ and reconnecting the wire doesn’t make it go away (that’s bad!).

  • SUGGESTION: If there is no ‘Values’ input, use the Keys as the Values.

The bug is so severe that I’m not sure how the PVL component can be used at all on a blank canvas? Further testing shows that when the Value List component is empty, either by editing it or by the Python component, it becomes inaccessible and generates the error.

It’s only a bug if there are software requirements. Anywho, you can add this line to prevent the code running before it has something to work with (i.e. attempting to populate with nothing):


210108_PopulateValueList_01.gh (4.2 KB)

And these bits to avoid the item selection error raised when populating an empty value list:


210108_PopulateValueList_02.gh (4.4 KB)

It’s getting quite complicated. So I’ll leave to you to add all the use-cases you can think off.

It’s definitely a bug! I found it immediately and there is no obvious way to recover from it, such as reconnecting the text panel. Your fix doesn’t address my suggestion but adding this line does:

if not Values:
    Values = Keys;

ValueList_suggestion

You don’t need the semicolon there at the end.

Super cool and had an immediate use for it: I needed a dropdown in GH to select a Layer from Rhino. Using Human’s Layer Table and this I can now pick a layer in GH and it even still works if layers are added as it will “remember” the selected item.

2 Likes

For what it’s worth, that’s also true of the item selector (and its original envisioned use case!) It will “remember” the value you had selected even if the input changes, as long as it doesn’t disappear.

Yes, and I have used it as well for that purpose. I prefer using “normal” dropdowns since we always have a sort of cockpit area with all the inputs and having 1 blue dropdown stick out kind of hurts my designer eyes and it needs to have a label on it since it wont be next to the component any longer. Placing UI elements near the components is okay for tiny patches, but not for large ones usually.

I mean really I would love to use Human UI for all of that, but haven’t found the time to get into it.

I am still hoping one day we get dropdown support in the RCP and the RCP doesn’t quite look as shitty as it does now. Could we get something that works like the RCP, but looks more like Human UI!?

1 Like