Programming => Graphics and Multimedia => TAChart => Topic started by: arneolav on January 16, 2020, 11:05:40 pm

Title: How to create a project file to adjust chart and series properties My solution.
Post by: arneolav on January 16, 2020, 11:05:40 pm
I'm working on a project doing same as  user "barsoom" in the other thread.
I have some > 100 sensors of different types,

Using this:
XMLFile.pas by  XML Cofiguration File support  Copyright (C) 2012 Victor Rull 
Download here.

Examples (Not complete code, just to giv an idea:

   gConf : TXMLFile; // local/user configuration to get XML file
   wConf : TXMLFile; // local/user configuratio to write XML file

 function CreateSaveFileXML(Const SaveFileXML:String):Boolean;
    gConf := TXMLFile.Create(SaveFileXML, 'Configuration', True);
    wConf := TXMLFile.Create(SaveFileXML, 'Configuration', False);

 function FreeSaveFileXML:Boolean;
                     // (iKey1= 'Key', iToken = 'Token', sToken is the Token value)
procedure SavetoXML(iKeys, iKey1, sToken:String);
   wConf.WriteBoolean(iKey1, iFound, True);
   wConf.WriteString(iKey1 , iToken, sToken);   

function GetXML:Boolean(iKey1, iKey, skey:String);;
  Result :=  gConf.ReadBoolean(iKeys, iFound, False);
  if Result then
    sToken       := gConf.ReadString(iKey1, iToken, '');

 procedure SaveFormBoundsXML(aForm: TForm);
 var SectionName : string;
   if aForm.WindowState <> wsNormal then Exit;               // don't save if the window is maximized or minimized
   SectionName := aForm.Name+ iFormBounds ;                 
   wConf.WriteBoolean(SectionName, iFound, True);
   wConf.WriteInteger(SectionName, iLeft,   aForm.Left);
   wConf.WriteInteger(SectionName, iTop,    aForm.Top);
   wConf.WriteInteger(SectionName, iWidth,  aForm.Width);
   wConf.WriteInteger(SectionName, iHeight, aForm.Height);

There are some good examples in the XMLFile.pas
TinyPortal © 2005-2018