Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TMSFNCHTMLText Border?

 Post Reply Post Reply
Author
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Topic: TMSFNCHTMLText Border?
    Posted: 01 Apr 2020 at 12:01am
The TMSFNCHTMLText control has a border and I need to get rid of it.  I've tried various properties but can't make it go away.  

Anyway to use this control and not have it render a border?

I have it parented in a TRectangle because I need to be able to have round corners to match the style of the app.

The image attached has 2 TMSFNCHTMLText controls stacked on top of each other.

Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 2:38pm
hi,

Can you try calling DisableBackground programmatically?
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 4:20pm
Originally posted by Pieter Scheldeman

hi,

Can you try calling DisableBackground programmatically?

That doesn't work because I need the color, just not the border.  Calling that method removes the background color.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 4:26pm
Set the stroke color to the same color as the fill color to "disable" the border.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 4:57pm
Originally posted by Pieter Scheldeman

Set the stroke color to the same color as the fill color to "disable" the border.

I've already tried that with variations on the Stroke.Kind, Stroke.Opacity, and Stroke.Width

That doesn't work.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 5:48pm
We have tried with the following code and are not able to reproduce the border:

procedure TForm18.FormCreate(Sender: TObject);
var
  r: TRectangle;
  h: TTMSFNCHTMLText;
begin
  r := TRectangle.Create(Self);
  r.Parent := Self;
  r.Width := 200;
  r.Height := 200;
  r.Position.X := 100;
  r.Position.Y := 100;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Client;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';

end;
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 5:51pm
Originally posted by Pieter Scheldeman

Set the stroke color to the same color as the fill color to "disable" the border.

Adding the following code to the AfterDraw method it appears the Border is one pixel outside (lower) of the ARect : TRectF parameter being passed.

1: var LowerLeft : TPointF;
 2:     LowerRight: TPointF;
 3: begin
 4:  LowerLeft.X := ARect.Left;
 5:  LowerLeft.Y := ARect.Bottom;
 6:  LowerRight.X := ARect.Right;
 7:  LowerRight.Y := ARect.Bottom;
 8: 
 9: // AGraphics.Fill.Color := clBlue;
10:  AGraphics.Canvas.Stroke.Color := clBlue;
11:  AGraphics.Canvas.DrawLine(LowerLeft, LowerRight, 1);
12: 
13:  LowerLeft.X := ARect.Left;
14:  LowerLeft.Y := ARect.Bottom + 1;
15:  LowerRight.X := ARect.Right;
16:  LowerRight.Y := ARect.Bottom + 1;
17: 
18:  AGraphics.Canvas.Stroke.Color := clBlue;
19:  AGraphics.Canvas.DrawLine(LowerLeft, LowerRight, 1);

Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 5:58pm
Did you try with the code in my previous post? We are not able to reproduce this issue out of the box.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 5:59pm
Originally posted by Pieter Scheldeman

We have tried with the following code and are not able to reproduce the border:

procedure TForm18.FormCreate(Sender: TObject);
var
  r: TRectangle;
  h: TTMSFNCHTMLText;
begin
  r := TRectangle.Create(Self);
  r.Parent := Self;
  r.Width := 200;
  r.Height := 200;
  r.Position.X := 100;
  r.Position.Y := 100;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Client;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';

end;

I installed the latest and my version shows 1.1.0.0  What is yours?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 6:06pm
The same, but have you tried? If you did and have the same results, please send us as sample that reproduces this.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 6:07pm
Originally posted by Pieter Scheldeman

We have tried with the following code and are not able to reproduce the border:

procedure TForm18.FormCreate(Sender: TObject);
var
  r: TRectangle;
  h: TTMSFNCHTMLText;
begin
  r := TRectangle.Create(Self);
  r.Parent := Self;
  r.Width := 200;
  r.Height := 200;
  r.Position.X := 100;
  r.Position.Y := 100;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Client;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';

end;

Your code works when the controls are created at run time, but it still doesn't work when the components are dropped and properties manipulated at design time.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 6:07pm
Originally posted by Pieter Scheldeman

The same, but have you tried? If you did and have the same results, please send us as sample that reproduces this.

OK, will do.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 10:08pm
Originally posted by Pieter Scheldeman

We have tried with the following code and are not able to reproduce the border:

procedure TForm18.FormCreate(Sender: TObject);
var
  r: TRectangle;
  h: TTMSFNCHTMLText;
begin
  r := TRectangle.Create(Self);
  r.Parent := Self;
  r.Width := 200;
  r.Height := 200;
  r.Position.X := 100;
  r.Position.Y := 100;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Client;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';

end;

Change your test to the following:

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := Rectangle33;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h.WordWrapping := True;
  h.AutoSize := True;
  h.AutoHeight := True;
  h.AutoWidth := False;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := Rectangle33;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 02 Apr 2020 at 3:59pm
With this code we were able to reproduce the issue. Next version will address this.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2020 at 12:24am
Originally posted by Pieter Scheldeman

With this code we were able to reproduce the issue. Next version will address this.

Know what would be cool to do while you are fixing this.  Add a property such that the Text being rendered respects the Padding property.  Just sayin'

Or is there a built in way to do this now, without having to owner draw stuff?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2020 at 9:59am
The Padding property is for child controls. The Text is part of the control, and is not a child control. If you want to use padding, please include the TTMSFNCHTMLText inside another container control, such as a TPanel, or a TRectangle.
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 07 Apr 2020 at 6:08pm
Originally posted by Pieter Scheldeman

The Padding property is for child controls. The Text is part of the control, and is not a child control. If you want to use padding, please include the TTMSFNCHTMLText inside another container control, such as a TPanel, or a TRectangle.

I would, but having it inside of another control leads to more issues when you have AutoSize and WordWrap turned on because you have to then resize the parent control to adjust to the height if it changes.

Which is why I asked the question.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3728
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 07 Apr 2020 at 8:24pm
Perhaps you can use Margins on the child control instead?
Back to Top
Bracey Mark View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2012
Posts: 31
Post Options Post Options   Quote Bracey Mark Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 2020 at 1:19am
Originally posted by Pieter Scheldeman

Perhaps you can use Margins on the child control instead?

The TMSFNCHTMLText  would be the child control so the fill color wouldn't work.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down