Skip to content

(Event Binding) Examples

Stephan Stricker edited this page Nov 16, 2019 · 3 revisions

Description

These are examples for different event bindings.


OPC variables

OPC Source

Select first entry of a list box when OPC variable changes

<!-- Select first entry in list box item after init />-->
 <EventBinding id="Recorder_1.CMD.Init_0">
  <Source xsi:type="opcUa.Event" refId="::AsGlobalPV:Recorder_1.CMD.Init" event="ValueChanged" />
   <EventHandler condition="NOT newValue" >
    <Action>					
     <Target xsi:type="widgets.brease.ListBox.Action" contentRefId="contentRecorder" widgetRefId="lstRecNames" >
      <Method xsi:type="widgets.brease.ListBox.Action.SetSelectedIndex" index="0" />
     </Target>
    </Action>
   </EventHandler>
 </EventBinding>

OPC Target

On button click, read client ID, write client ID to OPC variable, set OPC bool variable, use sequencing

<!-- Command refresh recipe list />-->
 <EventBinding id="Recorder_1.btnRecRefresh.Click">
  <Source contentRefId="contentRecorder" widgetRefId="btnRecRefresh" xsi:type="widgets.brease.Button.Event" event="Click" />
  <!-- Read session id />-->
  <Operand name="slotId" datatype="ANY_INT">
   <ReadTarget xsi:type="session.VariableAction.Read" refId="::SYSTEM:clientInfo.slotId" >
    <Method xsi:type="session.VariableAction.GetValue" />
   </ReadTarget>
  </Operand>
  <EventHandler>
   <Sequence>
    <!-- Set slot ID />-->
     <Step order="1">
      <Action>
       <Target xsi:type="opcUa.NodeAction" refId="::AsGlobalPV:Recorder_1.PAR.VisuSlotID" >
        <Method xsi:type="opcUa.NodeAction.SetValueNumber" value="=slotId" />
       </Target>
      </Action>
     </Step>
    <!-- Set command />-->
     <Step order="2">
      <Action>
       <Target xsi:type="opcUa.NodeAction" refId="::AsGlobalPV:Recorder_1.CMD.Init" >
        <Method xsi:type="opcUa.NodeAction.SetValueBool" value="true" />
       </Target>
     </Action>
    </Step>
   </Sequence>				
  </EventHandler>
</EventBinding>

System

Page load

Select first entry of a list box

<!-- Select first entry in list when page is loaded />-->
 <EventBinding>
  <Source xsi:type="clientSystem.Event" event="ContentLoaded" />
   <EventHandler>
    <Action>					
     <Target xsi:type="widgets.brease.ListBox.Action" contentRefId="contentRecorder" widgetRefId="lstRecNames" >
      <Method xsi:type="widgets.brease.ListBox.Action.SetSelectedIndex" index="0" />
     </Target>
    </Action>
   </EventHandler>
 </EventBinding>
Clone this wiki locally