View Issue Details

IDProjectCategoryView StatusLast Update
0004572JEDI VCL00 JVCL Componentspublic2008-12-10 13:44
ReporterdeadcantdanceAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.34 
Target VersionFixed in Version3.36 
Summary0004572: JvSpinEdit: Cannot enter negative value directly if actual value is 0
DescriptionWhen a JvSpinEdit has an actual value 0, you can't enter a value like -5 directly. You have to enter 5, after that you can enter the minus-sign.
TagsNo tags attached.

Activities

obones

2008-11-07 08:08

administrator   ~0014982

Please provide the zipped sources of a sample application showing this.

2008-11-07 09:37

 

JvSpinEdit.zip (6,463 bytes)

deadcantdance

2008-11-07 09:37

reporter   ~0014984

Sample is attached now.

2008-12-10 11:45

 

JvSpin_Mantis4572.patch (999 bytes)
Index: JvSpin.pas
===================================================================
--- JvSpin.pas	(revision 12069)
+++ JvSpin.pas	(working copy)
@@ -169,6 +169,7 @@
     // FButtonKind: TSpinButtonKind;
     FUpDown: TCustomUpDown;
     FThousands: Boolean; // New
+    FIsNegative: Boolean;
     function StoreCheckMaxValue: Boolean;
     function StoreCheckMinValue: Boolean;
     procedure SetCheckMaxValue(NewValue: Boolean);
@@ -684,6 +685,8 @@
   OldSelStart := SelStart;
   try
     OldText := inherited Text;
+    if (length(OldText)>0) then
+      IsNegative := Text[1] = '-';
     try
       if not (csDesigning in ComponentState) and (coCheckOnChange in CheckOptions) then
       begin
@@ -1845,6 +1848,8 @@
       //Text := IntToStr(Round(CheckValue(NewValue)));
       Text := FloatToStrF(CheckValue(NewValue), FloatFormat, 15, 0);
     end;
+    if (FIsNegative and (Text[1] <> '-')) then
+      Text := '-' + Text;
     DataChanged;
   finally
     Modified := WasModified;

deadcantdance

2008-12-10 11:46

reporter   ~0015088

Last edited: 2008-12-10 11:46

I've added a patch, check it, if you like it put it into trunk :)

AHUser

2008-12-10 13:44

developer   ~0015091

Fixed in SVN. Thanks for the patch.

Issue History

Date Modified Username Field Change
2008-11-07 07:39 deadcantdance New Issue
2008-11-07 08:08 obones Note Added: 0014982
2008-11-07 08:08 obones Status new => feedback
2008-11-07 09:37 deadcantdance File Added: JvSpinEdit.zip
2008-11-07 09:37 deadcantdance Note Added: 0014984
2008-12-10 11:46 deadcantdance File Added: JvSpin_Mantis4572.patch
2008-12-10 11:46 deadcantdance Note Added: 0015088
2008-12-10 13:44 AHUser Note Added: 0015091
2008-12-10 13:44 AHUser Status feedback => resolved
2008-12-10 13:44 AHUser Fixed in Version => Daily / SVN
2008-12-10 13:44 AHUser Resolution open => fixed
2008-12-10 13:44 AHUser Assigned To => AHUser