Skip to content

Commit

Permalink
[BUG] The numerical views should stop changing their values when ente…
Browse files Browse the repository at this point in the history
…red for editing. (#108)

* Create draft PR for #107

* fix editing of values when more updatevaluesonchanges events occurs

---------

Co-authored-by: Specter-13 <Specter-13@users.noreply.github.com>
Co-authored-by: Specter-13 <56168909+Specter-13@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 2, 2023
1 parent 97c4da2 commit 6fb68d1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class="w-100 form-control @AccessStatus"
type=@IsNumeric(typeof(T))
step=any
@onfocus="@( () => HasFocus = true )"
@onfocus="@( () => {HasFocus = true; LastValue = Onliner.LastValue;} )"
@onblur="@( () => HasFocus = false )"
@bind="Value" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override Task OnInitializedAsync()
{
EnumToIntConverter = new EnumToIntConverter(EnumDiscriminatorAttribute);
Names = Enum.GetNames(EnumDiscriminatorAttribute.EnumeratorType);
UpdateValuesOnChange(Onliner);
UpdateShadowValuesOnChange(Onliner);
return base.OnInitializedAsync();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ public partial class TemplateBase<T> : RenderableComponentBase
[Parameter]
public bool IsReadOnly { get; set; }

protected T LastValue { get; set; }

protected T Value
{
get
{
return Onliner.Cyclic;
if (!HasFocus)
{
return Onliner.Cyclic;
}
else
{
return LastValue;
}
}
set
{
Onliner.Edit = value;
}

}

internal string AccessStatus { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</div>


<RenderableContentControl Context="Component.my_int" Presentation="Control"></RenderableContentControl>
@code {
protected override void OnInitialized()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@
<h3>Tab</h3>
<RenderableContentControl Context="@Entry.Plc.test_example.primitives_tabs" Presentation="Control"></RenderableContentControl>

<RenderableContentControl Context="Entry.Plc.ixcomponent"></RenderableContentControl>

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public partial class ix_integration_plcTwinController : ITwinController

public MeasurementExample.Measurements measurements { get; }

public ixcomponent ixcomponent { get; }

public MonsterData.Monster monster { get; }

public ix_integration_plcTwinController(Ix.Connector.ConnectorAdapter adapter, object[] parameters)
Expand All @@ -52,6 +54,7 @@ public ix_integration_plcTwinController(Ix.Connector.ConnectorAdapter adapter, o
weather_readOnly.MakeReadOnly();
test_example = new example(this.Connector, "", "test_example");
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
monster = new MonsterData.Monster(this.Connector, "", "monster");
}

Expand All @@ -75,6 +78,7 @@ public ix_integration_plcTwinController(Ix.Connector.ConnectorAdapter adapter)
weather_readOnly.MakeReadOnly();
test_example = new example(this.Connector, "", "test_example");
measurements = new MeasurementExample.Measurements(this.Connector, "", "measurements");
ixcomponent = new ixcomponent(this.Connector, "", "ixcomponent");
monster = new MonsterData.Monster(this.Connector, "", "monster");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public partial class ix_integration_plc
public Layouts.Stacked.weather weather_readOnly { get; set; } = new Layouts.Stacked.weather();
public example test_example { get; set; } = new example();
public MeasurementExample.Measurements measurements { get; set; } = new MeasurementExample.Measurements();
public ixcomponent ixcomponent { get; set; } = new ixcomponent();
public MonsterData.Monster monster { get; set; } = new MonsterData.Monster();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ CONFIGURATION MyConfiguration

test_example: example;
measurements : MeasurementExample.Measurements;
ixcomponent : ixcomponent;
monster : Monster;
END_VAR
END_CONFIGURATION
4 changes: 4 additions & 0 deletions src/sanbox/integration/ix-integration-plc/src/ixcomponent.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ CLASS ixcomponent
{#ix-set:AttributeName = "My bool"}
my_bool : BOOL;
END_VAR

METHOD PUBLIC Simulate
my_int := my_int + INT#1;
END_METHOD
END_CLASS

NAMESPACE MySecondNamespace
Expand Down
2 changes: 2 additions & 0 deletions src/sanbox/integration/ix-integration-plc/src/program.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PROGRAM MyProgram
weather_readOnce : Layouts.Stacked.weather;
test_example: example;
measurements : MeasurementExample.Measurements;
ixcomponent : ixcomponent;
END_VAR

VAR
Expand All @@ -28,6 +29,7 @@ PROGRAM MyProgram
weather_readOnce.StartCounter := all_primitives.myINT;

measurements.Simulate();
ixcomponent.Simulate();


END_PROGRAM

0 comments on commit 6fb68d1

Please sign in to comment.