Hi, I have a question.
I add a descendant of Label or Math equation to the header/footer (for example, the text "a=10"). After that, I programmatically change the object's text to "a=20", which displays correctly. But when I save the document and reopen it, the text reverts to its original state of "a=10".
By the way, in the body of the main document, all changes are fixed normally. The problem only appears in the header/footer of TScaleRichView.
Please tell me, what could be the problem?
Header/footer save the initial state of the Label
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Header/footer save the initial state of the Label
What code do you use to change text?
Re: Header/footer save the initial state of the Label
In both cases, I change Text property due to change additional "Script" property. The object load/save "Script" property using _ExtraCustomProperty mechanism.
TRVScriptEquationItemInfo = class(TRVMathItemInfo)
TRVScriptTextItemInfo = class(TRVLabelItemInfo)
TRVScriptEquationItemInfo = class(TRVMathItemInfo)
Code: Select all
procedure TRVScriptEquationItemInfo.SetScript(const Value: string);
begin
if FScript <> Value then
begin
FScript := Value;
Text := '\text{' + FScript + '}';
end;
end;
Code: Select all
procedure TRVScriptTextItemInfo.SetScript(const Value: string);
begin
if FScript <> Value then
begin
FScript := Value;
Text := FScript;
end;
end;
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Header/footer save the initial state of the Label
Headers and footers are stored in SRV.SubDocuments[] (when they are not being edited), or in SRV.RVHeader/SRV.RVFooter (when they are being edited).
If the header/footer are not being edited, you can change properties of items in SRV.SubDocuments, and they will be saved to RVF.
If the header/footer is being edited (you can activate editing it using SRV.StartEditing()), you can change properties of items in SRV.RVHeader/SRV.RVFooter. Changes will be saved (first, to SRV.SubDocuments[], then to a file) when editing is finished (or when the document is being saved/printed). However, these changes are saved ONLY if the editor knows that they were made.
To inform the editor, you can use editing-style methods for changing properties: SetItemExtraStrPropertyExEd, SetCurrentItemExtraStrPropertyEx. Or, if you use non-editing methods, call SRV.RVHeader.Change (or SRV.RVFooter.Change) after the changes were made.
If the header/footer are not being edited, you can change properties of items in SRV.SubDocuments, and they will be saved to RVF.
If the header/footer is being edited (you can activate editing it using SRV.StartEditing()), you can change properties of items in SRV.RVHeader/SRV.RVFooter. Changes will be saved (first, to SRV.SubDocuments[], then to a file) when editing is finished (or when the document is being saved/printed). However, these changes are saved ONLY if the editor knows that they were made.
To inform the editor, you can use editing-style methods for changing properties: SetItemExtraStrPropertyExEd, SetCurrentItemExtraStrPropertyEx. Or, if you use non-editing methods, call SRV.RVHeader.Change (or SRV.RVFooter.Change) after the changes were made.
Re: Header/footer save the initial state of the Label
Hi Sergey,
thanks for your help! SRV.RVFooter.Change is a simple and quick solution.
thanks for your help! SRV.RVFooter.Change is a simple and quick solution.