Search Results for

    Show / Hide Table of Contents

    Class UIInstruction

    Provides the public UIInstruction interface, available in RW 5.12 and later. There is only one UIInstruction object per Rapid object, which is accessible through the UIInstruction property.

    Inheritance
    System.Object
    NamedObject
    SDKBase
    SDKControllerBoundBase
    UIInstruction
    Implements
    System.IComparable
    INamedObject
    System.IDisposable
    Inherited Members
    SDKControllerBoundBase.Controller
    SDKBase.Dispose()
    SDKBase.Dispose(Boolean)
    NamedObject.Equals(String)
    NamedObject.Equals(NamedObject)
    NamedObject.Equals(Object)
    NamedObject.CompareTo(String)
    NamedObject.CompareTo(NamedObject)
    NamedObject.CompareTo(Object)
    NamedObject.GetHashCode()
    NamedObject.ToString()
    NamedObject.Name
    Namespace: ABB.Robotics.Controllers.RapidDomain
    Assembly: ABB.Robotics.Controllers.PC.dll
    Syntax
    public class UIInstruction : SDKControllerBoundBase, IComparable, INamedObject, IDisposable

    Events

    UIInstructionEvent

    Unspecified UI-Instruction event (in RW 5.12 or later).

    Declaration
    public event UIInstructionEventHandler UIInstructionEvent
    Event Type
    Type Description
    UIInstructionEventHandler
    Remarks

    Cannot be used with RW releases earlier than RW 5.12!

    To transfer the response of the operator back to the RAPID program you cast the event argument object received with the event to an object of the correct type and call its SendAnswer method.

    Examples

    This example explains how a PC SDK application can use the UIInstructionEvent in order to let the operator handle RAPID UI- and TP-instructions from a PC application instead of the FlexPendant. First, a subscription to be notified whenever a UIInstruction event occur in the controller is set up. The event handler then gives some clues how to handle incoming events, indicating different actions depending on the kind of UIInstruction event.

    using ABB.Robotics;
    using ABB.Robotics.Controllers;
    ...
    Controller c = new Controller();
    c.Rapid.UIInstruction.UIInstructionEvent += OnUIInstructionEvent;
    ...
    private void OnUIInstructionEvent(object sender, UIInstructionEventArgs e)
    {
      try
      {   
           // Show the dialog if SEND event, discard any existing dialog if ABORT event,
           // just write or erase the text message in a "status" bar if POST event. 
           if (e.InstructionEventType == UIInstructionEventType.Send)
           {
                // Force execution from background thread to UI thread by invoking
                // a second event handler.
                this.Invoke(this.CreateUIInstructionDialog, e);
    
                // In the CreateUIInstructionDialog handler (not shown), check
                // InstructionType and cast the event argument to the correct type,
                // eg UITPReadFKEventArgs. Then create the dialog by using the information 
                // provided by the properties of the specialised UIInstructionEventArgs
                // object. The same object is used to transfer the response of the end-user
                // to the RAPID program (SendAnswer method).
           }
           else if (e.InstructionEventType == UIInstructionEventType.Abort)
           {
                // Invoke and remove the existing dialog
           }
           else if (e.InstructionEventType == UIInstructionEventType.Post)
           {
                // Check whether we should ADD new message to the info bar or DELETE an
                // existing message
                if (e.InstructionType == UIInstructionType.TPWrite)
                {
                    // Before writing the message, force execution to the GUI thread 
                    this.Invoke(this.WriteTPWriteMessage, e);
    
                    // In the second event handler (not shown) retrieve the string to write 
                    // by making a cast to UITPWriteEventArgs and calling its
                    // EventMessage property.
                }
                else if (e.InstructionType == UIInstructionType.TPErase)
                {
                    this.Invoke(this.ClearInfoBar, e);
                    // In the ClearInfoBar event handler (not shown), just remove any
                    // existing info in the "status bar". 
                }
    
           }
      }
      catch (System.Exception ex)
      {
        // TODO: Add error handling
      }
    }

    Implements

    System.IComparable
    INamedObject
    System.IDisposable
    In This Article
    Back to top Copyright © 2025 ABB