Page 1 of 1
AppendRVFFromStream and Controls
Posted: Thu Apr 16, 2026 9:22 pm
I have a RichViiewEdit component on a form. If I use the the LoadRVFFromFile procedure, the controls on the document appear with no problem. However on the same component if I use the AppendRVFFromSteam procedure because I want to load several documents, the controls are not visible. They seem to be present because they will trigger the OnControlAction event and I can cycle through and see the correct count and class names.
Any ideas please ?
Re: AppendRVFFromStream and Controls
Posted: Mon Apr 20, 2026 1:45 pm
by Sergey Tkachenko
Classes of all controls used in RVF must be registered before the first loading.
Such as:
Code: Select all
RegisterClasses([TButton, TEdit]);
There must be no difference between LoadRVFFromStream and AppendRVFFromStream. Internally, they call the same method for loading content.
Do not forget to call Format after loading.
Re: AppendRVFFromStream and Controls
Posted: Thu Apr 23, 2026 8:40 pm
I should have added more detail initially.
I do register the appropriate classes on application startup.
Format is called after the files are loaded.
I created a separate small application that provides the same function. When I call AppendRVFFromStream and pick the same file, the controls appear just fine so I know it works. They do not appear in the main application however. I cannot see any difference in settings or properties between the RichViewEdit on the main application and the one on the test application. They have both been left at default settings, same with RVStyle. The code in the test application is essentially a copy and paste of the code in the main application (for this particular purpose of displaying the contents of an rvf file.
I am, admittedly, puzzled.
Re: AppendRVFFromStream and Controls
Posted: Sat Apr 25, 2026 1:14 pm
by Sergey Tkachenko
Try debugging.
Open RVItem.pas.
Find the code in function TRVControlItemInfo.ReadRVFLine:
Code: Select all
ControlClassName := RVU_AnsiToString(s);
ControlClass := TControlClass(GetClass(ControlClassName));
if ControlClass <> nil then
begin
Control := ControlClass.Create(nil);
Control.Visible := False;
Control.Parent := TCustomRVData(ARVData).GetParentControl.GetParentForChildControls;
end;
Is this code executed? Does ControlClass <> nil?