Cancel
Showing results for 
Search instead for 
Did you mean: 

TxRobot in TxObjComboboxCtrl

Creator
Creator

Hello, 

 I want to add all robots available in production cell into TxObjComboboxCtrl as dropdownlist.

I get all robots by below command

TxObjectList Robots = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxRobot)));

Now, Next step is confusing, how can i add all robots into dropdownlist?

Can u give some idea ?

 

Thanx all

 

 

 

5 REPLIES

Re: TxRobot in TxObjComboboxCtrl

Phenom
Phenom

Hello @Bishen

 

Use TxObjComboBoxCtrl instead of custom combobox control. To add elements to this control use the AddItem method. Example to add robotic programs to a combobox control:

 

//1 - Get all robotic programs from root
TxObjectList robProgramList = TxApplication.ActiveDocument.RoboticProgramRoot.DirectChildPrograms;

//2 - Add all robotic programs to combobox selection if (robProgramList.Count > 0) foreach (TxRoboticProgram robProgram in robProgramList) this.roboticProgramComboBoxCtrl.AddItem(robProgram.Name, robProgram);

Regards

 

 

Re: TxRobot in TxObjComboboxCtrl

Valued Contributor
Valued Contributor

Hello Fred,

 

what about a WPF TxObjectComboBoxCotrol? Which property have I use to populate the combobox with items?

 

Witalij.

Re: TxRobot in TxObjComboboxCtrl

Phenom
Phenom

Hi @Witalij

 

I believe we're talking about the same object. You need to use AddItem method, passing the string to be displayed in the combobox for a specific object (the second arg of AddItem method), to populate it.

 

Regards,

Re: TxRobot in TxObjComboboxCtrl

Valued Contributor
Valued Contributor

Hi, Fred

 

isn't here any property, that I can bind to a collection of TxObjectComboBoxItem?

Re: TxRobot in TxObjComboboxCtrl

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Witalij,

 

You can bind the ComboBoxItemsSource property, it is of type ObservableCollection<TxObjectComboBoxItem>

 

 ComboBoxItemsSource="{Binding Robots, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Best Regards,

DianaG