-
Notifications
You must be signed in to change notification settings - Fork 4
(Use case) Button with short press and long press event
Stephan Stricker edited this page Apr 21, 2020
·
4 revisions
- Automation Studio 4.4
- mappView 5.5
This example shows how to create a button that generates a short and long press event.
- Create a new timer
- Add a new button in mappView
Create a new timer
In the mappView Configuration (1) add a new timer (2) according to the following window.
Add a new button in mappView
Add a new standard button in mappView and add the following code to the event binding file.
<!-- Start new timer on mouse down event />-->
<EventBinding id="Main.Button1.MouseDown">
<Source contentRefId="Main" widgetRefId="Button1" xsi:type="widgets.brease.Button.Event" event="MouseDown" />
<EventHandler>
<Action>
<Target xsi:type="session.TimerAction" refId="LongPress" >
<Method xsi:type="session.TimerAction.Start" />
</Target>
</Action>
</EventHandler>
</EventBinding>
<!-- This is the long press event when the timer runs to the end />-->
<EventBinding id="LongPress" >
<Source xsi:type="session.Timer.Event" refId="LongPress" event="Elapsed"/>
<EventHandler>
<Sequence>
<!-- Reset timer />-->
<Step order="0">
<Action>
<Target xsi:type="session.TimerAction" refId="LongPress" >
<Method xsi:type="session.TimerAction.Stop" />
</Target>
</Action>
</Step>
<!-- Open a dialog box />-->
<Step order="1">
<Action>
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.OpenDialog" dialogId="DialogSelectionMachine" />
</Target>
</Action>
</Step>
</Sequence>
</EventHandler>
</EventBinding>
<!-- This is the short press event when the mouse goes up before the timer finishes />-->
<EventBinding id="Main.Button1.MouseUp">
<Source contentRefId="Main" widgetRefId="Button1" xsi:type="widgets.brease.Button.Event" event="MouseUp" />
<!-- Read timer status />-->
<Operand name="IsRunning" datatype="BOOL">
<ReadTarget xsi:type="session.TimerAction.Read" refId="LongPress" >
<Method xsi:type="session.TimerAction.IsRunning" />
</ReadTarget>
</Operand>
<EventHandler condition="IsRunning=true">
<Sequence>
<!-- Reset timer />-->
<Step order="0">
<Action>
<Target xsi:type="session.TimerAction" refId="LongPress" >
<Method xsi:type="session.TimerAction.Stop" />
</Target>
</Action>
</Step>
<!-- Switch to next page />-->
<Step order="1">
<Action>
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.Navigate" pageId="DataPage" />
</Target>
</Action>
</Step>
</Sequence>
</EventHandler>
</EventBinding>
General Information
Direct binding
Event binding
Use cases
- General
- Widgets
- Styles
- Text
- Content