Recent

Author Topic: TMemo.BorderSpacing.InnerBorder  (Read 366 times)

msocorcim

  • New member
  • *
  • Posts: 8
TMemo.BorderSpacing.InnerBorder
« on: July 07, 2022, 12:15:44 am »
The document at: https://lazarus-ccr.sourceforge.io/docs/lcl/controls/tcontrol.borderspacing.html leads me to understand that setting a control's BorderSpacing.InnerBorder can be used to set a margin around a TMemo's text. That doesn't seem to be happening for me. Is this by design?

Lazarus 2.2.2 (rev Unknown) FPC 3.2.2 x86_64-linux-gtk2
--------------------------------------------------------------------------------
TControl.BorderSpacing

Determines the inner and outer border spacing for this control.
Declaration

Source position: controls.pp line 1706

public property TControl.BorderSpacing : TControlBorderSpacing
  read FBorderSpacing
  write SetBorderSpacing;
Description

The outer border determines the minimal distance to sibling controls, the inner border is the area between the control's BoundsRect and ClientRect.

When a control sits in a cell of a table (Grid) control, its horizontal and vertical alignment inside the cell can be specified, too.
--------------------------------------------------------------------------------------

I've provided a sample project to demonstrate the "problem" and the workaround of making the TMemo a client of a TPanel.

Regards, Dennis

dsiders

  • Hero Member
  • *****
  • Posts: 672
Re: TMemo.BorderSpacing.InnerBorder
« Reply #1 on: July 07, 2022, 04:05:52 am »
The document at: https://lazarus-ccr.sourceforge.io/docs/lcl/controls/tcontrol.borderspacing.html leads me to understand that setting a control's BorderSpacing.InnerBorder can be used to set a margin around a TMemo's text. That doesn't seem to be happening for me. Is this by design?

Lazarus 2.2.2 (rev Unknown) FPC 3.2.2 x86_64-linux-gtk2
--------------------------------------------------------------------------------
TControl.BorderSpacing

Determines the inner and outer border spacing for this control.
Declaration

Source position: controls.pp line 1706

public property TControl.BorderSpacing : TControlBorderSpacing
  read FBorderSpacing
  write SetBorderSpacing;
Description

The outer border determines the minimal distance to sibling controls, the inner border is the area between the control's BoundsRect and ClientRect.

When a control sits in a cell of a table (Grid) control, its horizontal and vertical alignment inside the cell can be specified, too.
--------------------------------------------------------------------------------------

I've provided a sample project to demonstrate the "problem" and the workaround of making the TMemo a client of a TPanel.

Regards, Dennis

Use of InnerBorder seems to be erratic. Most controls ignore it altogerher. TEdit-derived controls add 2x the space at the bottom of the control.

The only control in LCL that actually uses InnerBorder for anything useful (that I could find) is TDateTimePicker which indents the date value by the amount.

[ Edit ]

... on Windows.
« Last Edit: July 07, 2022, 04:14:32 am by dsiders »
Preview Lazarus 2.3.0 documentation at: https://dsiders.gitlab.io/lazdocsnext

msocorcim

  • New member
  • *
  • Posts: 8
Re: TMemo.BorderSpacing.InnerBorder
« Reply #2 on: July 09, 2022, 03:00:03 pm »
So to correct this for the entire LCL, controls would simply need to offset their owner's client area inward by the amount of its InnerBorder?

jamie

  • Hero Member
  • *****
  • Posts: 4667
Re: TMemo.BorderSpacing.InnerBorder
« Reply #3 on: July 09, 2022, 03:48:33 pm »
The inner border does not work on Native controls because they draw the actual content and thus are govern by the OS.

 In Windows for the MEMO there is I believe a message you can send to adjust that to a degree of margin.

 But the other control area may also be problem too.
if you want that kind of control for a memo just drop it inside a panel and indicate no border.

 From there you can adjust border. That not only gives you the space you desire but It will also allow you to get advanced around the border to items like buttons etc.
The only true wisdom is knowing you know nothing

msocorcim

  • New member
  • *
  • Posts: 8
Re: TMemo.BorderSpacing.InnerBorder
« Reply #4 on: July 09, 2022, 05:50:35 pm »
Quote
But the other control area may also be problem too.
if you want that kind of control for a memo just drop it inside a panel and indicate no border.

That was my workaround. :)

 

TinyPortal © 2005-2018