*** JvSpin.pas.orig	Tue Dec 27 19:08:02 2005
--- JvSpin.pas	Tue Dec 27 19:43:36 2005
***************
*** 48,54 ****
    {$IFDEF VisualCLX}
    QComboEdits, JvQExComboEdits, QComCtrlsEx,
    {$ENDIF VisualCLX}
!   JvEdit, JvExMask, JvMaskEdit, JvComponent;
  
  type
    TSpinButtonState = (sbNotDown, sbTopDown, sbBottomDown);
--- 48,54 ----
    {$IFDEF VisualCLX}
    QComboEdits, JvQExComboEdits, QComCtrlsEx,
    {$ENDIF VisualCLX}
!   JvEdit, JvExMask, JvMaskEdit, JvComponent, JclStrings;
  
  type
    TSpinButtonState = (sbNotDown, sbTopDown, sbBottomDown);
***************
*** 643,649 ****
  
  procedure TJvCustomSpinEdit.Change;
  var
!   //  OldText: string;
    OldSelStart: Integer;
  begin
    { (rb) Maybe move to CMTextChanged }
--- 643,649 ----
  
  procedure TJvCustomSpinEdit.Change;
  var
!   OldText: string;
    OldSelStart: Integer;
  begin
    { (rb) Maybe move to CMTextChanged }
***************
*** 653,659 ****
    FChanging := True;
    OldSelStart := SelStart;
    try
!     //    OldText := inherited Text;
      try
        if not (csDesigning in ComponentState) and (coCheckOnChange in CheckOptions) then
        begin
--- 653,659 ----
    FChanging := True;
    OldSelStart := SelStart;
    try
!     OldText := inherited Text;
      try
        if not (csDesigning in ComponentState) and (coCheckOnChange in CheckOptions) then
        begin
***************
*** 666,678 ****
    finally
      FChanging := False;
    end;
!   
    SelStart := OldSelStart;
  
    if FOldValue <> Value then
    begin
      if Thousands and (Length(Text) mod 4 = 1) and (SelStart > 0) then
        SelStart := SelStart + 1;
      inherited Change;
      FOldValue := Value;
    end;
--- 666,682 ----
    finally
      FChanging := False;
    end;
! 
    SelStart := OldSelStart;
  
    if FOldValue <> Value then
    begin
+     if Thousands then
+       SelStart := SelStart + StrCharCount(Text, ThousandSeparator) - StrCharCount(OldText,ThousandSeparator);
+       {
      if Thousands and (Length(Text) mod 4 = 1) and (SelStart > 0) then
        SelStart := SelStart + 1;
+       }
      inherited Change;
      FOldValue := Value;
    end;
