View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0003469 | JEDI VCL | 00 JVCL Components | public | 2006-01-25 10:13 | 2006-04-05 01:24 | 
| Reporter | vmarko | Assigned To | obones | ||
| Priority | normal | Severity | major | Reproducibility | always | 
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.10 | ||||
| Target Version | Fixed in Version | 3.30 | |||
| Summary | 0003469: TJvSpin.Thousands := True causes incorrect caret movement (fix) | ||||
| Description | TJvSpin component does not behave correctly after setting Thousands property to true and decimals is > 0. The position is calcuated incorrectly because it does not take decimal part of number into account. Crude fix attached. | ||||
| Additional Information | Related issue: 0002717 - same bug, improper fix, not resolved | ||||
| Tags | No tags attached. | ||||
| 
 2006-01-25 10:14 
 | 
 SpinEditFix.diff (2,231 bytes) 
 *** 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;
 | 
|  | The issue affects TJvSpinEdit, sorry for wrong identifier. | 
|  | To reproduce, you need these values: Decimals = 2 (default) Thousands = True ValueType = vtFloat | 
|  | Your fix is ready to be added in CVS, as soon as it is back online. | 
|  | This is now in CVS | 
| Date Modified | Username | Field | Change | 
|---|---|---|---|
| 2006-01-25 10:13 | vmarko | New Issue | |
| 2006-01-25 10:14 | vmarko | File Added: SpinEditFix.diff | |
| 2006-01-25 10:21 | vmarko | Note Added: 0008453 | |
| 2006-01-26 07:11 | obones | Note Added: 0008463 | |
| 2006-01-26 07:11 | obones | Status | new => confirmed | 
| 2006-04-04 09:24 | obones | Note Added: 0008915 | |
| 2006-04-05 01:24 | obones | Status | confirmed => resolved | 
| 2006-04-05 01:24 | obones | Resolution | open => fixed | 
| 2006-04-05 01:24 | obones | Assigned To | => obones | 
| 2006-04-05 01:24 | obones | Note Added: 0008948 | 
