Ribbon combobox string

Ribbon combobox string

will.wydock
Advocate Advocate
1,080 Views
1 Reply
Message 1 of 2

Ribbon combobox string

will.wydock
Advocate
Advocate
I have a combobox located on my Ribbon. I would like to retrieve the selected value as a string to use in an external command. I set the value as a public string for the application but I can’t access it outside of it. Is there something special that needs to happen for this to work?
0 Likes
1,081 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Wwydock,

 

Thank you for your query.

 

This should be pretty simple.

 

The ADN Revit API labs (and my Xtra labs) include C# and VB projects UiCs and UiVb demonstrating how to create the combo boxes:

 

 

By the way: Prompted by my look at them for your question, I migrated the latter to Revit 2018, while I was at it.

 

Take a look at the lines 395 to 452 in 1_Ribbon.cs, defining the methods AddComboBox and comboBx_CurrentChanged, or the corresponding one in the VB version:

 

 

The comboBx_CurrentChanged event handler is notified and called when the combo box value changes.

 

Store the updated value somewhere and make it available via an externally accessible method or property on your class and you will be all set and ready to go.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes