Creating a DocumentWindow with Categories
This example provides information on creating the DocumentWindow in RobotStudio with categories.
Solution
Create a DocumentWindow using an empty Control.
// Create the first control and document window. Control firstControl = new Control(); DocumentWindow firstWindow = new DocumentWindow(Guid.NewGuid(), firstControl, "MyDocumentWindow1");Assign category to the DocumentWindow.
// Define a category name for the document windows. string categoryName = "MyCategory"; firstWindow.Category = categoryName;Add window to the UI.
// Add the first window to the UI. UIEnvironment.Windows.Add(firstWindow);
Example
This example provides information on creating DocumentWindows in RobotStudio with categories.
public void AddCategoryDocumentWindow()
{
// Begin UndoStep
Project.UndoContext.BeginUndoStep("AddDocumentWindow");
try
{
// Create the first control and document window.
Control firstControl = new Control();
DocumentWindow firstWindow = new DocumentWindow(Guid.NewGuid(), firstControl, "MyDocumentWindow1");
// Define a category name for the document windows.
string categoryName = "MyCategory";
firstWindow.Category = categoryName;
// Add the first window to the UI.
UIEnvironment.Windows.Add(firstWindow);
// Create the second control and document window, set its category, and add it to the UI.
Control secondControl = new Control();
DocumentWindow secondWindow = new DocumentWindow(Guid.NewGuid(), secondControl, "MyDocumentWindow2");
secondWindow.Category = categoryName;
UIEnvironment.Windows.Add(secondWindow);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
}
Required Namespaces
ABB.Robotics.RobotStudio.Environment