From 39d5c08c5543c27f541845f4d5cbe3ee3a5332e9 Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Fri, 18 Mar 2022 18:20:31 +0100
Subject: [PATCH] VehicleForm: Corrected Enabling/Disabling Retarder Controls
 based on MotorPosition

---
 VECTO/GUI/VehicleForm.Designer.vb | 3 +++
 VECTO/GUI/VehicleForm.vb          | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb
index fef16cd262..a62e3c187f 100644
--- a/VECTO/GUI/VehicleForm.Designer.vb
+++ b/VECTO/GUI/VehicleForm.Designer.vb
@@ -1517,11 +1517,14 @@ Partial Class VehicleForm
         '
         'cbEmPos
         '
+        Me.cbEmPos.DisplayMember = "Value"
+        Me.cbEmPos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
         Me.cbEmPos.FormattingEnabled = true
         Me.cbEmPos.Location = New System.Drawing.Point(110, 52)
         Me.cbEmPos.Name = "cbEmPos"
         Me.cbEmPos.Size = New System.Drawing.Size(153, 21)
         Me.cbEmPos.TabIndex = 1
+        Me.cbEmPos.ValueMember = "Key"
         '
         'lblEmCount
         '
diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb
index f91a8c0c23..59d0dd389a 100644
--- a/VECTO/GUI/VehicleForm.vb
+++ b/VECTO/GUI/VehicleForm.vb
@@ -1230,7 +1230,14 @@ Public Class VehicleForm
 		gbRatiosPerGear.Enabled = cbEmPos.SelectedValue.Equals(PowertrainPosition.HybridP2_5)
 
 		if (VehicleType.IsOneOf(VectoSimulationJobType.BatteryElectricVehicle, VectoSimulationJobType.SerialHybridVehicle)) then
-			gbRetarderLosses.Enabled = PowertrainPosition.BatteryElectricE3.Equals(cbEmPos.SelectedValue)
+			if (PowertrainPosition.BatteryElectricE3.Equals(cbEmPos.SelectedValue)) then
+				gbRetarderLosses.Enabled = true
+			else
+				gbRetarderLosses.Enabled = false
+				CbRtType.SelectedValue = RetarderType.None
+				TbRtRatio.Text = ""
+				TbRtPath.Text = ""
+			end if
 		end if
 	End Sub
 
-- 
GitLab