Transfert setting FNC Editor VCL to Web Appli at run time

Hello,
FNC components are cross-platform compatible.
I would like to change the appearance FNC at run time VCL to WEB application (Miletus or other) without recompiling.

Step 1) create a simple "Editor" VCL application with two components
TMSFNCWidgetProgress1 And TMSFNCObjectInspector1 for modify some simple appearance properties (color, etc) at run time.

I save these objects from the VCL Editor application for example
F:= ExtractFilePath(ApplicaTion.ExeName) + 'FNCProgress1';
TMSFNCWidgetProgress1.SaveToJSONFile(F+'.Json');
TMSFNCWidgetProgress1.SaveSettingsToFile(F+'.setapp');
It's ok create too files

Step 2) Creation a simple MILETUS "Viewer" WEB application with the same TMSFNCWidgetProgress1 component on it
Run and after launching on click Webbutton for retreive new proporties (from Vcl file alfter)
code exemple
If (pos('.json',F) > 0) then
TMSFNCWidgetProgress1.LoadFromJSONFile(F);
If (pos('.setapp',F)> 0) then
TMSFNCWidgetProgress1.LoadSettingsFromFile(F);

// TMSFNCWidgetProgress1.Refresh;

If Load JSON file ==> Error
If Load only setting appearance ==> Ok but no change visual apparence

Q1) in Miletus do you have refresh or repaint component forcing?
Q2) Is it possible to transfer Appearance FNC Properties from VCL >> same FNC WEB component on Miletus or Other web?

Hi,

You cannot load from files directly in WEB. You could use a stream instead but even then there are encoding issues between the files saved from VCL and what is expected to be loaded in WEB. We'll look to add encoding support in the future.

What you can try instead are the ToJSON and FromJSON methods as they are working with strings.
From VCL:

procedure TForm1.Button1Click(Sender: TObject);
var
  f, s: string;
  ms: TStringStream;
begin
  f := ExtractFilePath(ApplicaTion.ExeName) + 'FNCProgress1.setapp';
  s := TMSFNCWidgetProgress1.ToJSON;

  ms := TStringStream.Create(s);
  try
    ms.SaveToFile(f);
  finally
    ms.Free;
  end;
end;

And from the WEB through a TWebOpenDialog:

procedure TForm2.WebButton1Click(Sender: TObject);
begin
  WebOpenDialog1.Execute;
end;

procedure TForm2.WebOpenDialog1Change(Sender: TObject);
begin
  if WebOpenDialog1.Files.Count = 1 then
    WebOpenDialog1.Files[0].GetFileAsText;
end;

procedure TForm2.WebOpenDialog1GetFileAsText(Sender: TObject;
  AFileIndex: Integer; AText: string);
begin
  TMSFNCWidgetProgress1.FromJSON(AText);
end;