Recent

Author Topic: How to create a project file to adjust chart and series properties My solution.  (Read 1619 times)

arneolav

  • Full Member
  • ***
  • Posts: 195
    • ElTranslador
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. https://sourceforge.net/projects/xmltreeeditor/files/

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

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


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

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

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

 procedure SaveFormBoundsXML(aForm: TForm);
 var SectionName : string;
 begin                                                             
   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);
end;


There are some good examples in the XMLFile.pas
« Last Edit: January 16, 2020, 11:45:42 pm by arneolav »
Win XP, Win7, Win 10, Win 11, win64 , Lazarus 3.0RC1
Delphi/DevExpress

barsoom

  • Jr. Member
  • **
  • Posts: 51
Hi @arneolav,
Thanks for your post. Covid made me to have a complex year and i was not able to check your solution.  Both things are quite interesting, your program, and your solution.

I will explote it. Thnaks for the tip!

 

TinyPortal © 2005-2018