How to create a drop down list by node?


#1

Hello everyone,

My question is how to create a drop down list by node ?

Just like the Family Type / Levels / Categories/Element Types…

Q1

 

 

 

 

 

 

 

 

 

 

I had try to survey some information as the following:

1.https://github.com/DynamoDS/Dynamo/blob/a7940ff2b312a33029380c0eafb822992928705f/src/Libraries/CoreNodeModelsWpf/NodeViewCustomizations/DSDropDownBase.cs

2.https://github.com/DynamoDS/Dynamo/wiki/How-To-Create-Your-Own-Nodes

But I still can’t create the node.

Help me please and very Thanks.


#2

in the source code, check the SampleUI project:

https://github.com/DynamoDS/Dynamo/tree/master/src/Libraries/Samples/SampleLibraryUI


#3

Thanks for your reply,and I had tried to copying the code to the new project,but it is always error,as following:

" protected DSDropDownBase(string outputName)
{
OutPortData.Add(new PortData(outputName, string.Format(Properties.Resources.DropDownPortDataResultToolTip, outputName)));
RegisterAllPorts();
PopulateItems();
}"

  • Can't find the "Properties" in this project.....
Therefore,I rewrite the code like that:

OutPortData.Add(new PortData(outputName, string.Format(“Properties.Resources.DropDownPortDataResultToolTip”, outputName)));

And it was working! But the nodes looks very different…

Q2
How to use those node in the picture?
This file is my test project.

DropdownTEST03
Please give me a hand.

Thank you much!


#4

Hello, the properties file is a dictionary for localization / translation into different languages you can just put a string there :slight_smile:

 

also if you want custom UI to be loaded you have to add the dll that you make to the nodes folder in the dynamo folder, it looks like you’re importing these with the import library button?

 


#5

Hello Michael , thanks a lot ! I’m import the “.dll” file by the “import library button”.
What is the difference? And which folder is the right path?
If I put the file into the folder,can I get a drop down list node ?

Like this ?
Q1


#6

Hi Lu Chiming

I’m not sure if building a UI node with “import library” worked in the past and is now broken or never worked, but should in the future… For now, place your .dll in the path YourHD/ProgramFiles/Dynamo/Nodes/

It should be loaded at startup by dynamo and you should get a dropdown if your node is coded like the sample


#7

Hi Michael , Thanks again!
Although,I still can’t create the dropdown node.
Maybe I should learn more coding skill.
Anyway,thanks a lot!