API: ComboBox with Workobjects
Options
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.4K RobotStudio
- 384 UpFeed
- 14 Tutorials
- 12 RobotApps
- 291 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 247 ScreenMaker
- 2.7K Robot Controller
- 279 IRC5
- 46 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 736 RAPID Programming
- 15 Wizard Easy Programming
- 105 Collaborative Robots
- 3 Job listings