Jump to content
Sign in to follow this  
Stano

Write data to dfm

Recommended Posts

The data was written to me in dfm. Not now. I'm talking about writing at design time (ComponentEditor).
I enter the data, compile it and (supposedly) writes the data. Gives me back the number of bytes
I have tried all the methods listed here.
With Writer I get after completing all the functions (3)

There is no notification when using Stream. Does anyone have any type where the mistake is?

Quote

[dcc32 Error] E2161 Error: RLINK32: Error opening file "D:\Dokumenty\Delphi XE7\A Pokusy\MainForm.dfm"

procedure TjstVstDBNavigator.WriteCaptionAdded(Stream: TStream);
begin
  var S: String := FCaptionsAdded.Text;
  var Len: Integer := Length(S);
  Stream.Write(Len, SizeOf(Integer));
  if Len > 0 then
    Stream.Write(S[1], Len * SizeOf(Char));
//  Stream.Write(PByte(@S[1])^, Len * SizeOf(Char));
end;

procedure TjstVstDBNavigator.WriteShortCutAdded(Stream: TStream);
begin
  var Count: Integer := FShortCutsAdded.Count;
  Stream.Write(Count, SizeOf(Integer));
  for var SC: TShortCut in FShortCutsAdded do
    Stream.Write(SC, SizeOf(SC));
end; 

procedure TjstVstDBNavigator.WriterCaptionAdded(Writer: TWriter);
begin
   Writer.WriteListBegin;
   try
     for var I := 0 to FCaptionsAdded.Count - 1 do
       Writer.WriteString(FCaptionsAdded[I]);
   finally
     Writer.WriteListEnd;
   end;
end;

 

Share this post


Link to post

The error was in the file itself. I set him full access rights. Nothing.
I created a new one. Both writing and reading work. I can debug it.

Share this post


Link to post

The dfm file is obviously annoyed by the manual intervention in its contents.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×