TCustomRichView.SetAddParagraphMode

<< Click to display table of contents >>

TCustomRichView.SetAddParagraphMode

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):

do not add the first item (or the item after breaks or tables) in this mode;

do not switch paragraph style in this mode (all items in the same paragraph must have the same paragraph style).

See: valid documents

 

Example 1:

with MyRichView do

begin

  Clear;

  SetAddParagraphMode(True); // default mode

  AddNL('First',  00); // ok, starting 1st paragraph with style 0

  AddNL('Second'00); // ok, starting 2nd paragraph with style 0

  AddNL('Third',  01); // ok, starting 3rd paragraph with style 1

end;

Example 2:

with MyRichView do

begin

  Clear;

  SetAddParagraphMode(False);

  // error, do not add the first item in this mode!

  AddNL('First'00);

end;

Example 3:

with MyRichView do

begin

  Clear;

  SetAddParagraphMode(True); // default mode

  // ok, starting 1st paragraph with style 0

  AddNL('First',  00);

  SetAddParagraphMode(False);

  // ok, adding this item from new line inside the 1st paragraph

  AddNL('Second'00);

  // error, do not add items with another paragraph style in this mode!

  AddNL('Third',  01);

end;

 

See also

Paragraphs;

Building a document.