trichview.support
Re: Another question about ParaStyles |
Author |
Message |
Sergey Tkachenko |
Posted: 09/24/2003 17:58:12 > Sergey: I created and small application and I can see that the error not > reproduced, it must be elsewere in my application. > A guess: before calling ApplyTextStyles (as well as all methods of TRichViewEdit that marked in the help file as "editing-style" methods), the document must be formatted. ("Formatted" documents are ready to be displayed and processed by editing-style methods, or by methods working with the selection). When applying "editing-style" methods to unformatted documents, errors may occur, including "out of bounds" exception. Some methods (introduced in TRichView, marked in the help file as "viewer-style" methods) make the document unformatted. Example of such method - AddNL, adding text to the end of the document. Or LoadRTF. In order to make the document formatted after such methods, you need to call Format. (why it is implemented so? because of efficiency - in this way, "viewer-style" methods are very fast). For example: rve.Clear; rve.AddNL('Some text', 0, 0); rve.AddNL('More text', 0, 0); rve.Format; // !!! rve.SetSelectionBounds(0, rve.GetOffsBeforeItem(0), 0, rve.GetOffsAfterItem(0)); rve.ApplyTextStyle(1); |
Powered by ABC Amber Outlook Express Converter