i have some srichview in a form
to manage they have same style collection, then i make a style to assign as external style for each srichview. the problem are:
- external style look doesn't effect and srichview use internal style instead
- even i try to add collection at runtime, it doesn't change the collection
- i try to add collection on richviewedit.style, added but when i call richviewedit.clear, the style reset
also could you please give me a sample to show,
- a form have more then two srichview
- all srv have same collections
- rvactions function to all srv
- combo for font & size also work for them
sorry asking this, since i'm stuck make them work, even i checks any related topic in this forum. moreover i have to construct them into a single document with certain format
thanks & regards
external style
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
How can I reproduce the problem with an external RVStyle?
I made the following test:
- placed SRichViewEdit1 on a form
- placed RVStyle1 on a form
- in the Object Inspector, assigned SRichViewEdit1.ExternalRVStyle = RVStyle1
- in the Object Inspector, changed RVStyle1.TextStyles[0].Color = clFuchsia
When I ran the program, I typed some text in SRichViewEdit1, and color of this text is clFuchsia, as expected.
I made the following test:
- placed SRichViewEdit1 on a form
- placed RVStyle1 on a form
- in the Object Inspector, assigned SRichViewEdit1.ExternalRVStyle = RVStyle1
- in the Object Inspector, changed RVStyle1.TextStyles[0].Color = clFuchsia
When I ran the program, I typed some text in SRichViewEdit1, and color of this text is clFuchsia, as expected.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The examples with multiple TSRichViewEdits on the same form are in
Demos\ActionTestTabs\
Demos\ActionTestTabsRibbon\
They all have actions and font comboboxes working with the active editor.
However, they do not use the same collection of styles, and I strongly advise against it. A shared RVStyle for several editors can be used if you work with a predefined set of styles. But RichViewActions add styles, and even worse, they delete styles styles unused by the current editor (on New and Load commands).
If some editor changes the collections of styles (for example, when loading RVF file), it affects all other editors using this RVStyle (and it may lead to bugs)
Demos\ActionTestTabs\
Demos\ActionTestTabsRibbon\
They all have actions and font comboboxes working with the active editor.
However, they do not use the same collection of styles, and I strongly advise against it. A shared RVStyle for several editors can be used if you work with a predefined set of styles. But RichViewActions add styles, and even worse, they delete styles styles unused by the current editor (on New and Load commands).
If some editor changes the collections of styles (for example, when loading RVF file), it affects all other editors using this RVStyle (and it may lead to bugs)
thanks for the response.
so, the externalstyle only set as predefined style. the rest, any modification will apply only in each TSRichViewEdits? cmiiw
may you have solution, i need to build a document from multiple TSRichViewEdits and has similar style. Since i have a problem joining part of the documents into one, it's always complaint about style index out of bound.
regards
so, the externalstyle only set as predefined style. the rest, any modification will apply only in each TSRichViewEdits? cmiiw
may you have solution, i need to build a document from multiple TSRichViewEdits and has similar style. Since i have a problem joining part of the documents into one, it's always complaint about style index out of bound.
regards
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
External RVStyle makes sense to define styles at design time. At run time, there is no difference if you use the default RVStyle stored inside of TSRichViewEdit, or an external RVStyle.
This code copies SRichViewEdit2+SRichViewEdit3 to SRichViewEdit1.
This code copies SRichViewEdit2+SRichViewEdit3 to SRichViewEdit1.
Code: Select all
procedure AddDoc(source, dest: TCustomRichView);
var Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
source.SaveRVFToStream(Stream, False);
Stream.Position := 0;
dest.InsertRVFFromStream(Stream, rv.ItemCount);
Stream.Free;
end;
...
SRichViewEdit1.Clear;
SRichViewEdit1.RichViewEdit.DeleteUnusedStyles(True, True, True);
AddDoc(SRichViewEdit2.RichViewEdit, SRichViewEdit1.RichViewEdit);
AddDoc(SRichViewEdit3.RichViewEdit, SRichViewEdit1.RichViewEdit);
SRichViewEdit1.Format;