TTMSFMXCalendarPicker and livebinding issue

Hi there,


I am using TTMSFMXCalendarPicker version 1.5.3.7

Delphi 10 Seattle

I have a complex form wired using livebinding to a BindSourceDB (with aurelius the other end)

It was working in xe5 and xe7.1

When I upgraded to Seattle it does not permit to change the value of the date. It let me assign the first value when it is a new record. If I try to change it after post it return to the previous value.

To test, I have added a TEdit field wired to the same table (bindsourcedb) and same field.

If i enter the date on the TEdit it does update correctly, and event the TTMSFMXCalendarPicker gets updated. If i change the value on the TTMSFMXCalendarPicker  if DOES NOT change the TEdit and does not change the field.

This behavior is happening in all TTMSFMXCalendarPicker across my application.

The problem happens when typing in, or selecting the date on the calendar, always after the post, when changing a value already existed.

This is a big issue for my application since I have delivered it with this issue.

Please I seek for any correction or idea to fix this problem.

Thanks 

Eduardo

Hi, 


The value in the TEdit is only posted when pressing Enter, the same behavior applies to the TTMSFMXCalendarPicker. The value isn't automatically posted, yet only when pressing enter in the field. We will investigate here if we can improve this behavior but please understand that this behavior is by design. If you want to workaround this, you can notify the observer of the picker when the date changes, this can be done with the following code:

procedure TForm112.TMSFMXCalendarPicker1Change(Sender: TObject);
begin
  if (Sender as TTMSFMXCalendarPicker).Observers.IsObserving(TObserverMapping.EditLinkID) then
    TLinkObservers.EditLinkUpdate((Sender as TTMSFMXCalendarPicker).Observers);
  if (Sender as TTMSFMXCalendarPicker).Observers.IsObserving(TObserverMapping.ControlValueID) then
    TLinkObservers.ControlValueUpdate((Sender as TTMSFMXCalendarPicker).Observers);
end;

Kind Regards, 
Pieter

thank you for the answer.


The problem is that from my perspective, there is a change of behavior from precious versions (xe5 and xe7.1) where you could change de data by entering on the edit box or by selecting on the calendar and in any of the both ways it updated table.

eduardo

Pieter,


Almost worked... if the user open the calendar and select the date, without ever focusing on the editbox it does not work.

However, if after selecting the date on the calendar and then selecting the edit box it does work

Eduardo

Hi, 


Can you try with the following code for notifying observer changes:

procedure TForm1.NotifyObserverStartEdit(AControl: TControl);
begin
  if AControl.Observers.IsObserving(TObserverMapping.EditLinkID) then
  begin
    try
      if TLinkObservers.EditLinkEdit(AControl.Observers) then
        TLinkObservers.EditLinkModified(AControl.Observers)
    except
      TLinkObservers.EditLinkReset(AControl.Observers);
    end;
  end;
end;

procedure TForm1.NotifyObserverStopEdit(AControl: TControl);
begin
  if AControl.Observers.IsObserving(TObserverMapping.EditLinkID) then
  begin
    try
      if TLinkObservers.EditLinkIsEditing(AControl.Observers) then
        TLinkObservers.EditLinkUpdate(AControl.Observers);
    except
      TLinkObservers.EditLinkReset(AControl.Observers);
    end;
  end;
end;

procedure TForm1.TMSFMXCalendarPicker1Change(Sender: TObject);
begin
  NotifyObserverStartEdit(Sender as TControl);
  NotifyObserverStopEdit(Sender as TControl);
end;

Kind Regards,
Pieter