rvico TRichView Reference | Version History

New in version 11

Top  Previous  Next

The main feature of this update is compatibility with Delphi and C++Builder 2009.

Compatibility issues

New string types

New string types are declared in RVTypes.pas: TRVAnsiString, TRVUnicodeString, TRVRawByteString. These string types are used instead of String and WideString in many methods, properties and events.

TRVAnsiString is used for parameters and variables containing ANSI strings.

TRVUnicodeString is used for parameters and variables containing Unicode strings.

TRVRawByteString is used for parameters and variables containing either ANSI or “raw Unicode” strings.

The standard String type is used for parameters and variables containing ANSI strings in older versions of Delphi/C++Builder, and Unicode strings for Delphi/C++Builder 2009.

Changed parameters of events

In the following events, type of some parameters was changed from String to TRVRawByteString: OnDrawStyleText, OnReadHyperlink, OnItemAction, OnSaveItemToFile, OnRVDblClick, OnRVRightClick, OnItemTextEdit. In existing projects, change types of parameters in these events manually.

In OnSaveComponentToFile event, it is assumed that OutStr parameter is ANSI string (for Delphi/C++Builder versions prior to 2009). When saving to UTF-8 HTML files, it is converted to UTF-8 automatically. In previous versions of TRichView, programmers need to return UTF-8 string in this case.

Removing (renaming) "not recommended for Unicode applications" methods

In older versions of TRichView, there were a group of methods marked as "not recommended for Unicode applications". In TRichView version 11, these all these methods were renamed, R is added to the end of names of these methods. For example, "GetItemText" was renamed to GetItemTextR. These methods have TRVRawByteString parameters. These methods are not described in the help file any more (you will not see "not recommended for Unicode applications" remark in this help file any more). Instead of these methods, a new group of methods is introduced: methods working with String type (Unicode for Delphi/C++Builder 2009, ANSI for older versions).

For example, GetItemTextA always returns ANSI string, GetItemTextW always returns Unicode string, GetItemText returns ANSI/Unicode string depending on Delphi version. The methods without -A and -W postfixes can be used to create projects portable to all versions of Delphi.

The affected methods are:

AddNLTag (and its versions);

GetWordAt;

GetItemText;

SetItemText;

GetCurrentItemText;

SetItemTextEd;

SetCurrentItemText.

The same naming convention is applied to the methods that previously had two versions (ANSI and Unicode):

CopyText;

GetSelText;

InsertStringTag;

InsertText;

PasteText;

SearchText.

The following methods have only String (ANSI/Unicode string depending on Delphi version) version:

AddFmt;

AddItem;

InsertItem;

GetTextInfo;

GetCurrentTextInfo.

The following method is removed (only -R version): AddTextBlockNL.

These changes break some existing low level code, especially the changes in GetItemText and SetItemText. Specifically, in the following examples GetItemText/SetItemText must be changed to GetItemTextR/SetItemTextR:

conversion to/from Unicode (ConvertToUnicode);

removing text formatting.

Delphi and C++Builder 2009

In the new versions of Delphi/C++Builder, String type is Unicode by default.

Many properties and parameters in TRichView become Unicode in Delphi/C++Builder 2009:

tag strings (in tags-are-PChars mode);

extra item properties;

names of checkpoints;

visible text in labels, numbered sequences, endnotes, footnotes;

text in list markers (not only bullets, but all numbering);

live spelling interface;

hypertext targets (OnReadHyperlink, OnWriteHyperlink);

and others.

Default (initial) values of the following properties are changed in Delphi/C++Builder 2009:

Unicode property of text style (from False to True);

TRichView.RTFReadProperties.UnicodeMode (from rvruNoUnicode to rvruOnlyUnicode);

TRichView.Options (rvoAutoCopyUnicodeText is included, rvoAutoCopyText is excluded).

When saving text styles (in RVF files or Delphi forms) in older versions of Delphi/C++Builder, only non-default value (True) of Unicode property of text style is saved. When saving text styles (in RVF files or Delphi forms) in Delphi/C++Builder 2009, value of Unicode property is always saved, default or not. The main consequence is the following: when loading forms/RVF files with styles saved by older versions of Delphi/C++Builder in Delphi/C++Builder 2009+, Unicode property of all text styles become True. For RVF files, all text in text items is converted to Unicode automatically.

Events parameters of TRVRawByteString type (OnDrawStyleText, OnReadHyperlink, OnItemAction, OnSaveItemToFile, OnRVDblClick, OnRVRightClick, OnItemTextEdit) must be converted to String before using. For example, for OnRVDblClick event:

// Example for Delphi 2009 or newer!!!

procedure TForm1.RichView1RVDblClick(Sender: TCustomRichView;

  ClickedWord: TRVRawByteString; Style: Integer);

var s: String;

begin

  if (Style>=0and Sender.Style.TextStyles[Style].Unicode then

     s := RVU_RawUnicodeToWideString(ClickedWord) // converting from "raw Unicode" to UnicodeString

  else

     s := RVU_RawUnicodeToWideString(  // converting from ANSI to UnicodeString

      RVU_AnsiToUnicode(Sender.RVData.GetStyleCodePage(Style), ClickedWord));

  Panel1.Caption := s;

end;

New methods, properties and events

New TCustomRichView.OnAddStyle event.

New NoVScroll property of TRichView.

New options for line spacing ("at least" and "exactly" options).

New in saving and loading

RTF:

New option for saving formatted header and footer in RTF: include rvrtfSaveHeaderFooter in RTFOptions.

New properties for RTFReadProperties: CharsetForUnicode and UseCharsetForUnicode.

RVF:

Applications compiled in Delphi/C++Builder 2009 save RVF version 1.3.1, applications compiled in the older versions of Delphi saves RVF version 1.3 (previous version of RVF). RVF version 1.3.1 stores many strings (checkpoints names, DocProperties, tags, and others) in UTF-8 encoding.

Other

Special support for non-breaking hyphens in Unicode text, better table layout algorithm, copying multicell selection as text (in addition to RVF), making multicell selection with keyboard.


TRichView © trichview.com