Class tstatfile

Unit

Declaration

type tstatfile = class(tactcomponent, istatfile)

Description

Persists component state to a UTF-8 text file (by default status.sta), in a simple [section] / name=value format. Most edit widgets (and many other components) have a statfile property: set it to a tstatfile instance to save and restore their state automatically. A form's own tstatfile is read and written automatically if fo_autoreadstat/ fo_autowritestat is set in tcustommseform.options; a datamodule has no such automatic mechanism, so call readstat in oncreate and writestat in ondestroy instead.

Hierarchy

Overview

Fields

Protected fstate: statfilestatesty;

Methods

Protected procedure objevent(const sender: iobjectlink; const event: objecteventty); override;
Protected procedure objectevent(const sender: tobject; const event: objecteventty); override;
Protected procedure updateoptions(const afiler: tstatfiler);
Protected function defaultfile(const adirs: filenamearty): filenamety;
Protected procedure dostatread(const reader: tstatreader);
Protected procedure dostatwrite(const writer: tstatwriter);
Protected procedure statreading;
Protected procedure statread;
Protected function getstatvarname: msestring;
Protected function getstatpriority: integer;
Public constructor create(aowner: tcomponent); override;
Public procedure initnewcomponent(const ascale: real); override;
Public procedure readstat(const stream: ttextstream = nil); overload;
Public procedure readstat(const afilename: filenamety); overload;
Public procedure readstat(const aname: msestring; const statreader: tstatreader); overload;
Public procedure writestat(const stream: ttextstream = nil); overload;
Public procedure writestat(const afilename: filenamety); overload;
Public procedure writestat(const aname: msestring; const statwriter: tstatwriter); overload;
Public procedure updatestat(const aname: msestring; const statfiler: tstatfiler);

Properties

Public property mode: statfilemodety read getmode;
Published property filename: filenamety read ffilename write setfilename nodefault;
Published property filedir: filenamety read ffiledir write setfiledir;
Published property encoding: charencodingty read fencoding write fencoding default ce_utf8;
Published property options: statfileoptionsty read foptions write foptions default defaultstatfileoptions;
Published property statfile: tstatfile read fstatfile write setstatfile;
Published property savedmemoryfiles: msestring read fsavedmemoryfiles write fsavedmemoryfiles;
Published property statvarname: msestring read getstatvarname write fstatvarname;
Published property statpriority: integer read fstatpriority write fstatpriority default 0;
Published property cryptohandler: tcustomcryptohandler read fcryptohandler write setcryptohandler;
Published property activator;
Published property next: tstatfile read fnext write setnext;
Published property onstatupdate: statupdateeventty read fonstatupdate write fonstatupdate;
Published property onstatread: statreadeventty read fonstatread write fonstatread;
Published property onstatwrite: statwriteeventty read fonstatwrite write fonstatwrite;
Published property onstatbeforewrite: notifyeventty read fonstatbeforewrite write fonstatbeforewrite;
Published property onstatafterwrite: notifyeventty read fonstatafterwrite write fonstatafterwrite;
Published property onstatbeforeread: notifyeventty read fonstatbeforeread write fonstatbeforeread;
Published property onstatafterread: notifyeventty read fonstatafterread write fonstatafterread;
Published property onfilemissing: statfilemissingeventty read fonfilemissing write fonfilemissing;

Description

Fields

Protected fstate: statfilestatesty;

This item has no description.

Methods

Protected procedure objevent(const sender: iobjectlink; const event: objecteventty); override;

This item has no description.

Protected procedure objectevent(const sender: tobject; const event: objecteventty); override;

This item has no description.

Protected procedure updateoptions(const afiler: tstatfiler);

This item has no description.

Protected function defaultfile(const adirs: filenamearty): filenamety;

This item has no description.

Protected procedure dostatread(const reader: tstatreader);

This item has no description.

Protected procedure dostatwrite(const writer: tstatwriter);

This item has no description.

Protected procedure statreading;

This item has no description.

Protected procedure statread;

This item has no description.

Protected function getstatvarname: msestring;

This item has no description.

Protected function getstatpriority: integer;

This item has no description.

Public constructor create(aowner: tcomponent); override;

This item has no description.

Public procedure initnewcomponent(const ascale: real); override;

This item has no description.

Public procedure readstat(const stream: ttextstream = nil); overload;

This item has no description.

Public procedure readstat(const afilename: filenamety); overload;

This item has no description.

Public procedure readstat(const aname: msestring; const statreader: tstatreader); overload;

This item has no description.

Public procedure writestat(const stream: ttextstream = nil); overload;

This item has no description.

Public procedure writestat(const afilename: filenamety); overload;

This item has no description.

Public procedure writestat(const aname: msestring; const statwriter: tstatwriter); overload;

This item has no description.

Public procedure updatestat(const aname: msestring; const statfiler: tstatfiler);

This item has no description.

Properties

Public property mode: statfilemodety read getmode;

This item has no description.

Published property filename: filenamety read ffilename write setfilename nodefault;

This item has no description.

Published property filedir: filenamety read ffiledir write setfiledir;

Can list several candidate directories (e.g. '"~/Podpiska" "."') — on reading, the last one where the file is actually found is used; on writing, the same directory is used again. If the file is found in none of them, the first directory is used to create it.

Published property encoding: charencodingty read fencoding write fencoding default ce_utf8;

This item has no description.

Published property options: statfileoptionsty read foptions write foptions default defaultstatfileoptions;

This item has no description.

Published property statfile: tstatfile read fstatfile write setstatfile;

Link a "sub" tstatfile to a master one by setting its statfile property to the master instance and its own options to include sfo_memory (kept in memory rather than its own file) and sfo_savedata (saved into the master statfile, under a unique filename, when the master is written) — useful to share a single settings file across several unrelated forms whose components are created and destroyed dynamically.

Published property savedmemoryfiles: msestring read fsavedmemoryfiles write fsavedmemoryfiles;

This item has no description.

Published property statvarname: msestring read getstatvarname write fstatvarname;

This item has no description.

Published property statpriority: integer read fstatpriority write fstatpriority default 0;

This item has no description.

Published property cryptohandler: tcustomcryptohandler read fcryptohandler write setcryptohandler;

This item has no description.

Published property activator;

This item has no description.

Published property next: tstatfile read fnext write setnext;

This item has no description.

Published property onstatupdate: statupdateeventty read fonstatupdate write fonstatupdate;

To save additional values beyond the connected components' own state, use onstatread (with the read* functions of treader, e.g. readboolean/readinteger), onstatwrite (with the matching write* functions of twriter), or onstatupdate — called for both reading and writing — with the updatevalue overloads of tstatfiler, which read or write depending on direction (initialize the variable before use, since it is left unchanged if the file or the value is missing).

Published property onstatread: statreadeventty read fonstatread write fonstatread;

This item has no description.

Published property onstatwrite: statwriteeventty read fonstatwrite write fonstatwrite;

This item has no description.

Published property onstatbeforewrite: notifyeventty read fonstatbeforewrite write fonstatbeforewrite;

This item has no description.

Published property onstatafterwrite: notifyeventty read fonstatafterwrite write fonstatafterwrite;

This item has no description.

Published property onstatbeforeread: notifyeventty read fonstatbeforeread write fonstatbeforeread;

This item has no description.

Published property onstatafterread: notifyeventty read fonstatafterread write fonstatafterread;

This item has no description.

Published property onfilemissing: statfilemissingeventty read fonfilemissing write fonfilemissing;

This item has no description.


Generated by PasDoc 1.0.4.