RobotStudio event

RobotStudio API - ToolWindow DockStyle

Options

Hi,

Just wondering if it is possible to have a "floating" tool window in RobotStudio. The tool window controls are designed through a UserControl. I have tried the following code, using VS 2005:

public static void AddinMain()
{
    ToolWindow tw = new ToolWindow();'
    UserControl1 uc = new UserControl1()
    tw.Control = uc;

    UIEnvironment.Windows.AddDocked(tw, DockStyle.None);
}

When RobotStudio starts up the following message appears in the RS ouput window:

"Value does not fall within the expected range"

and the addin does not load. The same happens if I use DockStyle.Fill



Changing the DockStyle property to "Dockstyle.Right", the add in loads up with no error.



Thanks in advance,
Neil

neil2008-2-11 15:49:2

Comments

  • Hi Neil,<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    if you want to have a floating ToolWindow just call Windows.Add instead:

    public static void AddinMain()
    {
      ToolWindow tw = new ToolWindow();
      tw.Caption = "MyFloatingToolwindow";
      Button b = new Button();
      b.Text = "ClickMe";
      b.Size = new Size(100, 100);
      tw.Control = b;         &nbs p;  
      UIEnvironment.Windows.Add(tw);              
    }

    The reason you got an exception was that the method Windows.AddDocked() does not support DockStyle.None, because it means that the window is not docked. I will update the exception message text to be more descriptive.


    Best Regards, Niklas Skoglund
    ABB Robotics

    Developer Center
    RobotStudio Blog
  • Bernd
    Options
    I tried this example and after starting my Add-In a message box pops up with the information "RobotStudio has encountered a user-defined breakpoint."
     

     image

     

    After clicking "Close" the Add-In is loaded and the toolWindow is visible.

     

    The Debugger stops at the last line of the code snippet (UIEnvironment.Windows.Add(tw);)

     

    Does anybody know how to fix that problem?

     

    Thank you,

    Bernd