Problem with DBRichViewEdit and Textstyle
Posted: Fri Mar 16, 2018 1:19 pm
I have a strange problem with DBRichViewEdit and styles.
On a DBCtrlGrid there is a DBRichViewEdit, two DBRichViewEdits are visible (Rowcount 2 in DBCtrlGrid)
In record 1 the text is default
In record 2, the text is
1 line smaller (with rvActionFontShrinkOnePoint)
2 line larger (with rvActionFontGrowOnePoint)
3 line red (with rvActionFontColor)
So far everything works, the formatted text is displayed correctly in DBRichViewEdit.
When I quit and restart the program, everything is also displayed correctly in both DBRichViewEdits.
But if I have a
then the formatting is not present in the saved text.
If I enter the second (formatted) record once in the form, then it works.
With a test
I see that if I just start the program (the focus is in the first record) I only get the default styles used in the first record.
But if I go to the second record and then test, I get more styles and the correct styles are displayed.
If I go to the second record and back to the first record it works too.
It seems to me that the style information is only complete once all records have been the active record.
Maybe anybody have any idea how to solve this?
I can't go programatically to all records in all tables before saving them without DisableControls.
Additional data:
Trichview 13.0.5, Text stored as RTF
Delphi 5
Advantage Database Server 10.10.0.28 with TAdsTable
DBRichViewEdit has his own TRStyle
Update after some further testing:
If i insert
before the test, it works fine.
But if i use (to avoid the "screen-action")
i only get the default styles from the first record
Greetings
Björn
On a DBCtrlGrid there is a DBRichViewEdit, two DBRichViewEdits are visible (Rowcount 2 in DBCtrlGrid)
In record 1 the text is default
In record 2, the text is
1 line smaller (with rvActionFontShrinkOnePoint)
2 line larger (with rvActionFontGrowOnePoint)
3 line red (with rvActionFontColor)
So far everything works, the formatted text is displayed correctly in DBRichViewEdit.
When I quit and restart the program, everything is also displayed correctly in both DBRichViewEdits.
But if I have a
Code: Select all
MyTable.DisableControls;
MyTable.First;
For i := 1 to MyTable RecordCount do
Begin
Save as HTML
End;
If I enter the second (formatted) record once in the form, then it works.
With a test
Code: Select all
DummyStr :='';
for i := 0 to MyDBRichViewEdit.Style.TextStyles.Count - 1 do
begin
DummyStr := DummyStr + IntToStr(i)+':size:'+IntToStr(MyDBRichViewEdit.Style.TextStyles[i].Size)+'/color:'
+RV_GetHTMLRGBStr(MyDBRichViewEdit.style.TextStyles[i].Color,False)+ '#13+#10';
end;
ShowMessage((DummyStr));
But if I go to the second record and then test, I get more styles and the correct styles are displayed.
If I go to the second record and back to the first record it works too.
It seems to me that the style information is only complete once all records have been the active record.
Maybe anybody have any idea how to solve this?
I can't go programatically to all records in all tables before saving them without DisableControls.
Additional data:
Trichview 13.0.5, Text stored as RTF
Delphi 5
Advantage Database Server 10.10.0.28 with TAdsTable
DBRichViewEdit has his own TRStyle
Update after some further testing:
If i insert
Code: Select all
MyTable.First;
while not MyTable.Eof do
begin
MyTable.Next;
end;
MyTable.First;
But if i use (to avoid the "screen-action")
Code: Select all
MyTable.DisableControls;
MyTable.First;
while not MyTable.Eof do
begin
MyTable.Next;
end;
MyTable.First;
MyTable.EnableControls;
Greetings
Björn