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 ?
AppendRVFFromStream and Controls
-
Sergey Tkachenko
- Site Admin
- Posts: 18106
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: AppendRVFFromStream and Controls
Classes of all controls used in RVF must be registered before the first loading.
Such as:
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.
Such as:
Code: Select all
RegisterClasses([TButton, TEdit]);Do not forget to call Format after loading.
-
[email protected]
- Posts: 8
- Joined: Wed Mar 31, 2021 8:56 pm
Re: AppendRVFFromStream and Controls
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.
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.
-
Sergey Tkachenko
- Site Admin
- Posts: 18106
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: AppendRVFFromStream and Controls
Try debugging.
Open RVItem.pas.
Find the code in function TRVControlItemInfo.ReadRVFLine:
Is this code executed? Does ControlClass <> nil?
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;