Hello,
I have a TDBRichViewEdit control on a form, bound to a field in a database. There is also a RVStyle object bound to the TDBRichViewEdit field. In the RVStyle object the default styles are stored (I have made no modification there). In addition, there are several toolbars for text formatting (copied with all events from the ActionText2007 example).
When a record is edited all text formatting can be done in the TDBRichViewEdit field and saved and reloaded successfully. When a record is loaded and edited again, the Font and FontSize comboboxes in the toolbar show the correct font and size relative to the text where the focus moves - everything fine.
But when creating a new record the Font and FontSize comboboxes are initially blank (no font name is shown, and no font size is shown). I can edit text and the text is initially formatted to Arial 10 (as in the standard style in the RVStyle object). This is good - but how can I show the current font and font size in a brand new record?
Joe
TDBRichViewEdit: default font and size in new record
-
- Site Admin
- Posts: 17561
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Use OnNewDocument event.
In this event, you can set the default text and paragraph styles, for example:
The last line must update combo boxes (if they are updated inside this event. However, it is strange that they are not updated automatically. I'll test tomorrow.
In this event, you can set the default text and paragraph styles, for example:
Code: Select all
RVStyle1.TextStyles.Clear;
with RVStyle1.TextStyles.Add do begin
FontName := 'Arial';
FontSize := 10;
end;
RVStyle1.ParaStyles.Clear;
RVStyle1.ParaStyles.Add;
RVStyle1.ListStyles.Clear;
DBRichViewEdit1.OnCurTextStyleChange(DBRichViewEdit1);