memo.InsertPageBreak and memo.RemoveCurrentPageBreak

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

memo.InsertPageBreak and memo.RemoveCurrentPageBreak

Post by j&b »

Hello,

I want to use the same button to make insertPageBreak and RemoveCurrentPageBreak.

I don't kow how I have to ask in an IF ... else part.

Jürgen
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

var ItemNo: Integer;
  PB: Boolean;
begin
  if memo.InplaceEditor<>nil then
    exit; // do not add page breaks in table cells
  
  ItemNo := memo.CurItemNo;
  if memo.OffsetInCurItem > memo.GetOffsBeforeItem(ItemNo) then
    PB := False // we are not at the beginning of item, 
                // so we are not at the beginning of paragraph
  else begin
    if (ItemNo>0) and (memo.GetItemStyle(ItemNo-1)=rvsListMarker) then
      dec(ItemNo);
    PB := memo.PageBreaksBeforeItems[ItemNo];
  end;
  if PB then
    memo.RemoveCurrentPageBreak
  else
    memo.InsertPageBreak;
end;
Post Reply