View Issue Details

IDProjectCategoryView StatusLast Update
0003469JEDI VCL00 JVCL Componentspublic2006-04-05 01:24
ReportervmarkoAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.10 
Target VersionFixed in Version3.30 
Summary0003469: TJvSpin.Thousands := True causes incorrect caret movement (fix)
DescriptionTJvSpin 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 InformationRelated issue: 0002717 - same bug, improper fix, not resolved
TagsNo tags attached.

Activities

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;
SpinEditFix.diff (2,231 bytes)

vmarko

2006-01-25 10:21

reporter   ~0008453

The issue affects TJvSpinEdit, sorry for wrong identifier.

obones

2006-01-26 07:11

administrator   ~0008463

To reproduce, you need these values:

Decimals = 2 (default)
Thousands = True
ValueType = vtFloat

obones

2006-04-04 09:24

administrator   ~0008915

Your fix is ready to be added in CVS, as soon as it is back online.

obones

2006-04-05 01:24

administrator   ~0008948

This is now in CVS

Issue History

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