|
TCustomRichView.SetAddParagraphMode |
Top Previous Next |
|
Sets mode for adding items from new line for all Add*** methods. procedure SetAddParagraphMode(AllowNewPara: Boolean); (Introduced in version 1.2) By default (if SetAddParagraphMode was not called), all items that will be added from new line will start new paragraphs. You can change this mode calling SetAddParagraphMode(False), and then return this mode again calling SetAddParagraphMode(True). After SetAddParagraphMode(False) items that will be added from new line will not start new paragraphs but will be displayed from new line inside the previous paragraph.
Warning: be careful using SetAddParagraphMode(False):
See: valid documents
Example 1: with MyRichView do begin SetAddParagraphMode(True); // default mode AddNL('First', 0, 0); // ok, starting 1st paragraph with style 0 AddNL('Second', 0, 0); // ok, starting 2nd paragraph with style 0 AddNL('Third', 0, 1); // ok, starting 3rd paragraph with style 1 end; Example 2: with MyRichView do begin Clear; SetAddParagraphMode(False); AddNL('First', 0, 0); // error, do not add the first item in this mode! end; Example 3: with MyRichView do begin Clear; SetAddParagraphMode(True); // default mode AddNL('First', 0, 0); // ok, starting 1st paragraph with style 0 SetAddParagraphMode(False); AddNL('Second', 0, 0); // ok, adding this item from new line inside the 1st paragraph AddNL('Third', 0, 1); // error, do not add items with another paragraph style in this mode! end;
See also |