delphidelphi-10-seattlejvcl

TJvAppXMLFileStorage OnGetFileName event never executed


In Delphi 10 Seattle, with JVCL 3.48, after having implemented TJvAppXMLFileStorage OnGetFileName event handler, it never gets executed:

procedure TForm1.JvAppXMLFileStorage1GetFileName(Sender:
    TJvCustomAppStorage; var FileName: TFileName);
begin
  // never gets executed!
  CodeSite.Send('JvAppXMLFileStorage1GetFileName', FileName.ToString);
end;

I need this event to set the JvAppXMLFileStorage1.Location property with the var FileName parameter depending from other settings.

So how can I get this event executed?


Solution

  • A quick look at JvAppStorage.pas seems to show that the only place that calls DoGetFileName (which is where OnGetFileName is triggered if there is one assigned) is in TJvCustomAppMemoryFileStorage.RecalculateFullFileName. Looking at that method, DoGetFileName is only called from the case Location of branch for flCustom.

    This seems to indicate that the event is only fired if it's assigned and the Location is flCustom.