2004. december 13., hétfő
Stream forms to and from disk
Problem/Question/Abstract:
I have a form that creates an advanced SQL string and I am trying to stream the entire form (TAdvanced) to disk in order to save the state of the form, and then be able to easily recall it later without having to decode the SQL string. However, after successfully (I think) streaming it to disk, I get the error "A component named PageControl1 already exists". I have tried all kinds of variations on this, but there always seems to be some conflict - either TAdvanced can't be assigned to TAdvanced or the current, or others. Any suggestions would be appreciated. Do I need to manually iterate through the components of the form and write each one in turn to the stream?
Answer:
I would use Read/ WriteComponentResFile with code similar to:
constructor TFrmPersistent.Create(AOwner: TComponent);
begin
if FileExists('Persistent.xGS') then
begin
inherited CreateNew(AOwner);
ReadComponentResFile('Persistent.xGS', self);
self.Visible := false;
FormCreate(self);
end
else
inherited Create(AOwner);
end;
procedure TFrmPersistent.FormDestroy(Sender: TObject);
begin
WriteComponentResFile('Persistent.xGS', self);
end;
Feliratkozás:
Megjegyzések küldése (Atom)
VálaszTörlésBrazzers sex sayesinde kaliteli brazzers porno izleyebilirsiniz.