Develop a NetLogic that sets label text

This runtime NetLogic changes the text of a label. The NetLogic can be triggered with an MouseClickEvent event.

Prerequisites

Set the default external code editor. See Set the default code editor.

To develop the NetLogic
  1. In Project view, right-click the NetLogic folder and select New > Runtime NetLogic.
  2. Double-click the NetLogic.
    The external code editor opens.
  3. Edit the NetLogic by replacing the existingRuntimeNetLogic1 class with the following code. See Edit a NetLogic.
    #region Using directives
    using System;
    using UAManagedCore;
    using OpcUa = UAManagedCore.OpcUa;
    using FTOptix.HMIProject;
    using FTOptix.UI;
    using FTOptix.NativeUI;
    using FTOptix.Core;
    using FTOptix.CoreBase;
    using FTOptix.NetLogic;
    #endregion
    
    public class RuntimeNetLogic1 : FTOptix.NetLogic.BaseNetLogic
    {
        [ExportMethod]
        public void SetLabelTextToHelloWord(NodeId labelNodeId)
        {
            var label = InformationModel.Get<Label>(labelNodeId);
            label.Text = "Changed label text";
        }
    }
  4. Save the code.