API: ComboBox with Workobjects
in RobotStudio
Hello
I have made a ComboBox that I fill with all workobjects that are in the active task but i would like to refill it when the user adds a new workobject to the task.
//Get all workobjects
cbParentWobj.Items.Clear();
cbDispWobj.Items.Clear();
foreach (RsDataDeclaration rsdd in stn.ActiveTask.DataDeclarations)
{
if (rsdd.DataType == "wobjdata")
{
cbParentWobj.Items.Add(new CommandBarComboBoxItem(rsdd.Name));
cbDispWobj.Items.Add(new CommandBarComboBoxItem(rsdd.Name));
//Select the active workobject
if (rsdd.Name == stn.ActiveTask.ActiveWorkObject.Name)
{
cbParentWobj.SelectedIndex = cbParentWobj.Items.Count - 1;
cbDispWobj.SelectedIndex = cbDispWobj.Items.Count - 1;
}
}
}
Are there any good events that I can use that fires when a new data declaration is made?
Or are there any ready data collections with all workobjects that will be updated?
There are a similar combobox under home and settings. I would like the same function as that one.
I have made a ComboBox that I fill with all workobjects that are in the active task but i would like to refill it when the user adds a new workobject to the task.
//Get all workobjects
cbParentWobj.Items.Clear();
cbDispWobj.Items.Clear();
foreach (RsDataDeclaration rsdd in stn.ActiveTask.DataDeclarations)
{
if (rsdd.DataType == "wobjdata")
{
cbParentWobj.Items.Add(new CommandBarComboBoxItem(rsdd.Name));
cbDispWobj.Items.Add(new CommandBarComboBoxItem(rsdd.Name));
//Select the active workobject
if (rsdd.Name == stn.ActiveTask.ActiveWorkObject.Name)
{
cbParentWobj.SelectedIndex = cbParentWobj.Items.Count - 1;
cbDispWobj.SelectedIndex = cbDispWobj.Items.Count - 1;
}
}
}
Are there any good events that I can use that fires when a new data declaration is made?
Or are there any ready data collections with all workobjects that will be updated?
There are a similar combobox under home and settings. I would like the same function as that one.
0
Comments
-
Hi Patrik,
I would recommend using the ComboBox.DropDown event to re-fill the combo when the user clicks it. That way you don't have to depend on RS events to keep the contents in sync.
regards,
Johannes
Johannes Weiman
Software Engineer
ABB Robotics0 -
Perfect I will try that tomorrow..
0 -
I used the DropDown event and it works good for my scope of use..
Thanks
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings