[TMSFMXSpinner] wrong value displayed

Hi,

I'm testing the TMSFMXSpinner component (Delphi 10).
I would like to have 3 columns (day, month, year) in order to let choose a date.

So, I added 3 colums, and I set these properties :
- Column 1 :

Cyclic = True
DateRangeFrom = 01/01/1970
DateRangeTo = 30/12/2020
DateTimeValueFormat = dd
OnlyDate = True
RangeType = srtDateTime
Step = 1
StepType = sstDay

- Column 2, same values except :
DateTimeValueFormat  = mm
StepType = sstMonth

- Column 3, same values except :
DateTimeValueFormat  = yyyy
StepType = sstYear

In my code, I initialize the values of the 3 columns :
  TMSFMXSpinner.Columns[0].SelectedDateTime := Now;
  TMSFMXSpinner.Columns[1].SelectedDateTime := Now;
  TMSFMXSpinner.Columns[2].SelectedDateTime := Now;


I use the onSelectedValueChanged to get the date seleted (I write the value in a TMemo):

procedure TForm1.TMSFMXSpinnerSelectedValueChanged(Sender: TObject; Column: Integer; SelectedValue: Double; RangeType: TTMSFMXSpinnerRangeType);
begin
  Memo.Lines.Add(FormatDateTime('dd/mm/yyyy', EncodeDate(YearOf(TMSFMXSpinner.Columns[2].SelectedDateTime), MonthOf(TMSFMXSpinner.Columns[1].SelectedDateTime), DayOf(TMSFMXSpinner.Columns[0].SelectedDateTime))));
  Memo.Lines.Add('');
  Memo.SelStart := Length(Memo.Lines.Text);
end;


It works well, except the value displayed at the beginning.
Each column's value are incremented by 1.
So when I set the date 24/01/2017, I see 25/02/2018.

But, if I scroll the columns, the values displayed are the same as the values I get in onSelectedValueChanged.

For testing, I added this line after the initialization lines :

Memo.Lines.Add(FormatDateTime('dd/mm/yyyy', EncodeDate(YearOf(TMSFMXSpinner.Columns[2].SelectedDateTime), MonthOf(TMSFMXSpinner.Columns[1].SelectedDateTime), DayOf(TMSFMXSpinner.Columns[0].SelectedDateTime))));


And I get the good date.
So, I think it's only a little bug of the display at the begining.

Hi, 


We have investigated this here and have applied a fix for this issue. The next version will address this.

Thanks for your feedback.
Have you already scheduled a date for the next version ?

We plan the release for the first half of next week. 

Hi,

I have downloaded (and installed) the latest version v3.5.2.0 (February 16, 2017), and I still have the same bug.
Is there a special thing to do during the installation ?

Hi, 


With the code below, we are not experiencing any issues:

  TMSFMXSpinner1.BeginUpdate;
  TMSFMXSpinner1.Columns.Clear;
  with TMSFMXSpinner1.Columns.Add do
  begin
    Cyclic := True;
    DateRangeFrom := EncodeDate(1970, 1, 1);
    DateRangeTo := EncodeDate(2020, 12, 1);
    DateTimeValueFormat := 'dd';
    OnlyDate := True;
    RangeType := srtDateTime;
    Step := 1;
    StepType := sstDay;
  end;

  with TMSFMXSpinner1.Columns.Add do
  begin
    Cyclic := True;
    DateRangeFrom := EncodeDate(1970, 1, 1);
    DateRangeTo := EncodeDate(2020, 12, 1);
    DateTimeValueFormat := 'mm';
    OnlyDate := True;
    RangeType := srtDateTime;
    Step := 1;
    StepType := sstMonth;
  end;

  with TMSFMXSpinner1.Columns.Add do
  begin
    Cyclic := True;
    DateRangeFrom := EncodeDate(1970, 1, 1);
    DateRangeTo := EncodeDate(2020, 12, 1);
    DateTimeValueFormat := 'yyyy';
    OnlyDate := True;
    RangeType := srtDateTime;
    Step := 1;
    StepType := sstYear;
  end;
  TMSFMXSpinner1.EndUpdate;

  TMSFMXSpinner1.Columns[0].SelectedDateTime := Int(Now);
  TMSFMXSpinner1.Columns[1].SelectedDateTime := Int(Now);
  TMSFMXSpinner1.Columns[2].SelectedDateTime := Int(Now);

Kind Regards, 
Pieter

Thanks for help.    ;)
I tested your code as is, and this time the day is right, but the month and the year are still incremented by 1.
I don't know what to think about it ...

With the above code tested this here today on a default TTMSFMXSpinner (february 21, 2017) the day, month and year are initialized correctly.


Hi,

I made a new test :
- I have created a new project.
- I droped the TMSFMXSpinner on the form.
- I copied the code (as is) in the OnCreate.
- And I get :



But today, it's 24/02/2017. Not 24/03/2018.

Hi, 


Are you sure you are using / compiling against the latest version? We are no longer able to reproduce this here. If the issue persists, please contact us via email to obtain an incremental source update.


How to check the version ?
The property "version" of the TTMSFMXSpinner = 1.5.1.2

Hi, 


The latest version is 1.5.1.3 which contains the fix for initializing proper datetime values.
Looking at the global version number of the TMS FMX UI Pack the fix hasn't been released yet.
The next version will be released thursday.

Hi,

I finally found what was wrong.
I had to uninstall the previous versions manually.
And then, I was able to install the latest version, and delphi has load this version.
Now, the bug is resolved :  I get the current date.
Thanks for help.