Index: trunk/desktop/mainWindow.rbfrm
===================================================================
--- trunk/desktop/mainWindow.rbfrm	(revision 14)
+++ trunk/desktop/mainWindow.rbfrm	(revision 15)
@@ -59,5 +59,5 @@
       Cancel          =   ""
       Caption         =   "Write"
-      Default         =   True
+      Default         =   False
       Enabled         =   True
       Height          =   20
@@ -129,5 +129,5 @@
       Panels          =   ""
       Scope           =   0
-      SmallTabs       =   ""
+      SmallTabs       =   False
       TabDefinition   =   "Settings\rProfiles\rCar\rCustom"
       TabIndex        =   43
@@ -138,5 +138,5 @@
       Top             =   32
       Underline       =   ""
-      Value           =   1
+      Value           =   2
       Visible         =   True
       Width           =   637
@@ -957,5 +957,5 @@
             LockRight       =   ""
             LockTop         =   ""
-            Maximum         =   255
+            Maximum         =   10
             Minimum         =   1
             PageStep        =   20
@@ -2695,4 +2695,7 @@
 		Sub Open()
 		  StaticText_Version.Text = "Version " + str(app.NonReleaseVersion/100)
+		  
+		  //Set the default car type
+		  ICSSerialPort1.setCarType("MR-03")
 		End Sub
 	#tag EndEvent
@@ -2793,4 +2796,5 @@
 		  //Update punch
 		  Slider_Punch.Value = asc(ICSSerialPort1.Byte05)
+		  EditField_Punch.Text = str(asc(ICSSerialPort1.Byte05))
 		  
 		  //Update DBAND
@@ -2920,7 +2924,9 @@
 		  //Update Steering Gain
 		  Slider_STGain.Value = asc(ICSSerialPort1.Byte16)
+		  EditField_STGain.Text = str(asc(ICSSerialPort1.Byte16))
 		  
 		  //Update Throttle Gain
 		  Slider_THGain.Value = asc(ICSSerialPort1.Byte17)
+		  EditField_THGain.Text = str(asc(ICSSerialPort1.Byte17))
 		End Sub
 	#tag EndMethod
@@ -3046,4 +3052,12 @@
 	#tag EndEvent
 #tag EndEvents
+#tag Events TabPanel1
+	#tag Event
+		Sub Change()
+		  updateAdvancedScreen
+		  updateCarScreen
+		End Sub
+	#tag EndEvent
+#tag EndEvents
 #tag Events PopupMenu_Profile
 	#tag Event
@@ -3052,4 +3066,5 @@
 		    PushButton_SaveProfile.Visible = true
 		    PushButton_Delete.Visible = true
+		    ICSSerialPort1.loadProfile(me.Text)
 		  end if
 		End Sub
@@ -3089,5 +3104,32 @@
 		Sub ValueChanged()
 		  ICSSerialPort1.Byte17 = chrb(me.Value)
-		  EditField_THGain.Text = str(me.Value)
+		  //Check to see if we need to update the edit field
+		  //This prevents the edit field from triggering this event that then updates the edit field again
+		  //Causing the cursor to move to the begginning of the editfield
+		  if EditField_THGain.Text <> str(me.Value) then
+		    EditField_THGain.Text = str(me.Value)
+		  end if
+		  
+		  
+		End Sub
+	#tag EndEvent
+#tag EndEvents
+#tag Events EditField_THGain
+	#tag Event
+		Sub TextChange()
+		  //Make sure we have a valid value if not then set it to something
+		  if me.Text <> "" then
+		    if val(me.Text) > 255 or val(me.Text) < 1 then
+		      me.Text = "255"
+		    end if
+		  end if
+		  
+		  dim d as double
+		  dim i as integer
+		  d = val(me.Text)
+		  i = d
+		  ICSSerialPort1.Byte17 = chrb(i)
+		  
+		  Slider_THGain.Value = val(me.Text)
 		End Sub
 	#tag EndEvent
@@ -3097,5 +3139,31 @@
 		Sub ValueChanged()
 		  ICSSerialPort1.Byte16 = chrb(me.Value)
-		  EditField_STGain.Text = str(me.Value)
+		  //Check to see if we need to update the edit field
+		  //This prevents the edit field from triggering this event that then updates the edit field again 
+		  //Causing the cursor to move to the begginning of the editfield
+		  if EditField_STGain.Text <> str(me.Value) then
+		    EditField_STGain.Text = str(me.Value)
+		  end if
+		End Sub
+	#tag EndEvent
+#tag EndEvents
+#tag Events EditField_STGain
+	#tag Event
+		Sub TextChange()
+		  //Make sure we have a valid value if not then set it to something
+		  if me.Text <> "" then
+		    if val(me.Text) > 255 or val(me.Text) < 1 then
+		      me.Text = "255"
+		    end if
+		  end if
+		  
+		  dim d as double
+		  dim i as integer
+		  d = val(me.Text)
+		  i = d
+		  ICSSerialPort1.Byte16 = chrb(i)
+		  
+		  Slider_STGain.Value = val(me.Text)
+		  
 		  
 		End Sub
@@ -3220,6 +3288,32 @@
 		Sub ValueChanged()
 		  ICSSerialPort1.Byte05 = chrb(me.Value)
-		  EditField_Punch.Text = str(me.Value)
-		  
+		  //Check to see if we need to update the edit field
+		  //This prevents the edit field from triggering this event that then updates the edit field again
+		  //Causing the cursor to move to the begginning of the editfield
+		  if EditField_Punch.Text <> str(me.Value) then
+		    EditField_Punch.Text = str(me.Value)
+		  end if
+		  
+		  
+		End Sub
+	#tag EndEvent
+#tag EndEvents
+#tag Events EditField_Punch
+	#tag Event
+		Sub TextChange()
+		  //Make sure we have a valid value if not then set it to something
+		  if me.Text <> "" then
+		    if val(me.Text) > 255 or val(me.Text) < 1 then
+		      me.Text = "255"
+		    end if
+		  end if
+		  
+		  dim d as double
+		  dim i as integer
+		  d = val(me.Text)
+		  i = d
+		  ICSSerialPort1.Byte05 = chrb(i)
+		  
+		  Slider_Punch.Value = val(me.Text)
 		End Sub
 	#tag EndEvent
