[Compound Widget] Increase value with 1 when pressing a button

The solution was indeed not far away. You sir, are brilliant, thanks! That works like a charm!

The main issue was that I forget to add the ‘value="=’ in the code, so this also works:

		<EventBinding id="IncreaseSpeed5">
			<Source xsi:type="widget.Event" widgetRefId="pbSpeedUp" event="Click" />
			<EventHandler condition="">
				<Action>
					<ReadTarget xsi:type="widget.Action.Read" widgetRefId="niSpeed">	 
						<Method name="GetValue"/>
					</ReadTarget>
					<Result>
						<ResultHandler condition="">
							<Action>
								<Target xsi:type="widget.Action" widgetRefId="niSpeed">
									<Method name="SetValue" value="=result+1" />
								</Target>
							</Action>
						</ResultHandler>
					</Result>
				</Action>
			</EventHandler> 
		</EventBinding>

But to conclude this matter, the final code can be found below. This code also takes the min / max values into account:

		<!-- Increase Speed -->
		<EventBinding id="IncreaseSpeed">
			<Source xsi:type="widget.Event" widgetRefId="pbSpeedUp" event="Click" />
			<Operand name="ManualSpeed" datatype="ANY_REAL">
				<ReadTarget xsi:type="widget.Action.Read" widgetRefId="niSpeed">	 
					<Method name="GetValue"/>
				</ReadTarget>
			</Operand>
			<Operand name="ManualSpeedMax" datatype="ANY_REAL">
				<ReadTarget xsi:type="widget.Action.Read" widgetRefId="niSpeedMax">	 
					<Method name="GetValue"/>
				</ReadTarget>
			</Operand>
			 <EventHandler condition="ManualSpeed&lt;ManualSpeedMax"> <!-- Speed < Speed max --> 
				<Action>
					<Target xsi:type="widget.Action" widgetRefId="niSpeed">
						<Method name="SetValue" value="=ManualSpeed+1" />
					</Target>
				</Action>
			</EventHandler> 
		</EventBinding>
		
		<!-- Decrease Speed -->
		<EventBinding id="DecreaseSpeed">
			<Source xsi:type="widget.Event" widgetRefId="pbSpeedDown" event="Click" />
			<Operand name="ManualSpeed" datatype="ANY_REAL">
				<ReadTarget xsi:type="widget.Action.Read" widgetRefId="niSpeed">	 
					<Method name="GetValue"/>
				</ReadTarget>
			</Operand>
			<Operand name="ManualSpeedMin" datatype="ANY_REAL">
				<ReadTarget xsi:type="widget.Action.Read" widgetRefId="niSpeedMin">	 
					<Method name="GetValue"/>
				</ReadTarget>
			</Operand>
			<EventHandler condition="ManualSpeed&gt;ManualSpeedMin"> <!-- Speed > Speed min --> 
				<Action>
					<Target xsi:type="widget.Action" widgetRefId="niSpeed">
						<Method name="SetValue" value="=ManualSpeed-1" />
					</Target>
				</Action>
			</EventHandler> 
		</EventBinding>

So thanks again for the very fast reply!

3 Likes