GapX

edited May 2017 in FastReport VCL 5
it seems gapx creates an indent from left AND right side independent from text-alignment!
In my opinion the indent has only to be respected at the aligned side. Are there plans to modify this and how are the experiences of the other users?

Comments

  • gpigpi
    edited 9:20PM
    wrote:
    it seems gapx creates an indent from left AND right side independent from text-alignment!
    Yes, this is expected behavior
  • edited 9:20PM
    but this doesn't make sense (for me). I need an alternative behavior. Where can I modify thisin the sources?
  • gpigpi
    edited 9:20PM
    wrote:
    Where can I modify thisin the sources?
    Search for GapX in the frxClass.pas
  • edited 9:20PM
    solved:
    procedure TfrxCustomMemoView.BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
    var
      bx, by, bx1, by1, wx1, wx2, wy1, wy2, gx1, gy1: Integer;
    begin
      inherited BeginDraw(Canvas, ScaleX, ScaleY, OffsetX, OffsetY);
      wx1 := Round((Frame.Width * ScaleX - 1) / 2);
      wx2 := Round(Frame.Width * ScaleX / 2);
      wy1 := Round((Frame.Width * ScaleY - 1) / 2);
      wy2 := Round(Frame.Width * ScaleY / 2);
      bx := FX;
      by := FY;
      bx1 := FX1;
      by1 := FY1;
      if ftLeft in Frame.Typ then
        Inc(bx, wx1);
      if ftRight in Frame.Typ then
        Dec(bx1, wx2);
      if ftTop in Frame.Typ then
        Inc(by, wy1);
      if ftBottom in Frame.Typ then
        Dec(by1, wy2);
      gx1 := Round(GapX * ScaleX);
      gy1 := Round(GapY * ScaleY);
     // GapX-Position in relation to current HAlign 
      case HAlign of
        haCenter,
        haBlock  : FTextRect := Rect(bx + gx1, by + gy1, bx1 - gx1 + 1, by1 - gy1 + 1);
        haLeft   : FTextRect := Rect(bx + gx1, by + gy1, bx1 + 1, by1 - gy1 + 1);
        haRight  : FTextRect := Rect(bx, by + gy1, bx1 - gx1 + 1, by1 - gy1 + 1);
      end;
    end;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.