Page 1 of 1

Paragraph style and ApplyParaStyleConversion

Posted: Tue Aug 04, 2020 5:43 pm
by jgkoehn
Greetings,
I'm working on a doing some quick format buttons for users and when I use ApplyParaStyleConversion from a demo
Specifically: RichViewEdit.ApplyParaStyleConversion(PARA_SPACE_DEFAULT); Note: GApplyStyle is set to rvs style before calling ApplyParaStyleCovnersion.

See the code below. Also see the attachment. I get a red border and multiline spacing, plus paragraph alignment, etc. when I'm just wanting to change spacing before and after the paragraph. Is it the combination of Actions and this?

Code: Select all

procedure TMainForm.rveParaStyleConversion(Sender: TCustomRichViewEdit; rvstyle: TRVStyle;
  StyleNo, UserData: Integer; AppliedToText: Boolean; var NewStyleNo: Integer);
var
  ParaInfo: TParaInfo;
begin

  ParaInfo := TParaInfo.Create(nil);
  try
    ParaInfo.Assign(GApplyStyle.ParaStyles[StyleNo]);
    case UserData of
      PARA_ALIGNMENT:
        ParaInfo.Alignment := GApplyStyle.ParaStyles[StyleNo].Alignment;
      PARA_INDENTINC:
        begin
          ParaInfo.LeftIndent := ParaInfo.LeftIndent + 20;
          if ParaInfo.LeftIndent > 200 then
            ParaInfo.LeftIndent := 200;
        end;
      PARA_INDENTDEC:
        begin
          ParaInfo.LeftIndent := ParaInfo.LeftIndent - 20;
          if ParaInfo.LeftIndent < 0 then
            ParaInfo.LeftIndent := 0;
      end;
      PARA_COLOR: ParaInfo.Background.Color := PParaColor;
      PARA_LINESPACE: ParaInfo.LineSpacing := PParaLineSpaceInt;
      PARA_SPACE_DEFAULT:
           begin
           ParaInfo.SpaceBefore:=0;
           ParaInfo.SpaceAfter:= 6;
       end;
      // add your code here....
    end;
    NewStyleNo := GApplyStyle.FindParaStyle(ParaInfo);
  finally
    ParaInfo.Free;
  end;
end; 

Re: Paragraph style and ApplyParaStyleConversion

Posted: Wed Aug 05, 2020 9:26 am
by Sergey Tkachenko
Is this the exact code?
OnParaStyleConversion does not have rvstyle parameter.
The code looks correct, if GApplyStyle really equals to Sender.Style.

Re: Paragraph style and ApplyParaStyleConversion

Posted: Wed Aug 05, 2020 1:34 pm
by jgkoehn
Greetings Sergey,
It is the code, I will need to revisit the rvstyle I think I added that but apparently don't use. I will double check a few things. Thank you