[Lazarus] Store empty string property in *.lfm

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Jun 22 20:28:18 CEST 2010


On Tue, 22 Jun 2010 18:18:38 +0200
theo <xpde at theo.ch> wrote:

> Thanks for your answer Matthias
> 
> > String properties always have as default value the empty string.
> > But you can define a stored procedure.
> > See the TControl.Caption property.
> 
> 
> 
> I don't get what you mean. There I read:
> 
>     property Caption: TCaption read GetText write SetText stored 
> IsCaptionStored;  
> 
> where afaics "IsCaptionStored" determines whether or not to store the 
> Caption value.
> But I simply want it always stored, even when empty.

TWriter does not support that directly.
But you can do something like this:

procedure TThumbControl.SetDirectory(const AValue: UTF8String);
begin
  if AValue=fDirectory then exit;
  if csLoading in ComponentState then fDirectoryLoaded:=true;
  ...
end;

procedure TThumbControl.Loaded;
begin
  if not fDirectoryLoaded then fDirectory:='';
  fDirectoryLoaded:=false;
end;


Mattias




More information about the Lazarus mailing list