Using comboboxes in the inventor panel

Using comboboxes in the inventor panel

Anonymous
Not applicable
543 Views
4 Replies
Message 1 of 5

Using comboboxes in the inventor panel

Anonymous
Not applicable

Hi there,

I'm have made a ribbon panel with buttons and a comboxbox in inventor 2016 using C#.

 

With the code below I'm adding OnSelect handles to the com bobox.

 

private static void CreateComboBoxLinks(IEnumerable<ComboBoxDefinition> thecomboboxes)
{
foreach (ComboBoxDefinition thecombobox in thecomboboxes)
{

switch (thecombobox.InternalName)
{
case "Commando12":
thecombobox.OnSelect += Command12; //
break;
}

}
}

 

 

 


public static void Command12(NameValueMap context)
{

 

So here I want to determ which item is clikced in the combo box. 

 

How can I cast context to a combobox ??

Or does anyone have the code to use the items in a combobox.


MessageBox.Show(context.Item[0].ToString()); 
MessageBox.Show(context.Value["Item1"].ToString());  

MessageBox.Show(context.Name[0].ToString());

 

}

0 Likes
Accepted solutions (1)
544 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
No one ? Autodesk ? Anybody ?
0 Likes
Message 3 of 5

Anonymous
Not applicable
Accepted solution
Okay, found it myself, so just for completeness sake:

thecombobox.OnSelect += (NameValueMap context) => DrieWHelpTools.Commando12(thecombobox);

public static void Commando12(ComboBoxDefinition bov)
{
MessageBox.Show(@"YOu have clicked: " + bov.ListItem[bov.ListIndex]);
}
Message 4 of 5

Balaji_Ram
Alumni
Alumni

Hi Remy,

 

Sorry, it is not possible to know which of the combo box generated the select event from the Context information passed.

 

We have a request logged for it already with our engineering team.

 

As you see, the "Context.Count.ToString()" returns zero indicating an empty context.

 

The only way at present is to associate a different OnSelect callback for each of the combo boxes and access the 

ListIndex of the combo box that the event handler is associated with.

 

However, this would not be a common event handler for a group of combo boxes.

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 5

Anonymous
Not applicable

Hi Balaji,

 

Thanks for the reply. Like I wrote, I finally found a workaround.

 

 

0 Likes