Show / Hide Table of Contents

Creating a DocumentWindow with Categories

This example provides information on creating the DocumentWindow in RobotStudio with categories.

Solution

  1. 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");
    
  2. Assign category to the DocumentWindow.

    // Define a category name for the document windows.
    string categoryName = "MyCategory";
    firstWindow.Category = categoryName;
    
  3. 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

See Also

  • Creating New View
In this article
Back to top Copyright © 2025 ABB