I have written a procedure that fills a RichEdit component depending on the input.
procedure LoadCPData(ResName: String);
begin
ResName := AnsiLowercase(ResName) + '_data';
rs := TResourceStream.Create(hInstance, ResName, RT_RCDATA);
try
rs.Position := 0;
info.reMeta.Lines.LoadFromStream(rs);
finally
rs.Free;
end;
end;
Note: The above procedure is stored in an external .pas file called Functions.
When I go to call the procedure in my form the RichEdit remains empty. However, if I were to place that code block in the form itself, the RichEdit component fills the data without a problem as expected. Now I could place the above code block in the form itself, but I plan on using the procedure multiple times in a case statement.
What will I need to include in order for my procedure to work?
Thank you in advanced!
We use the
TJvRichEditcontrol instead ofTRichEditso that we can support embedded OLE objects. This should work very similarly withTRichEdit.I adapted this from another routine, so it isn’t the exact same method we use. We stream the content from a database, so we don’t ever read from a file. But we do write the string on to a memory stream to load it into the RTF control, so this in essence does the same thing.