Recent

Author Topic: [bug] anchor editor breaks visibility of LabeledEdit  (Read 1331 times)

Muso

  • Sr. Member
  • ****
  • Posts: 356
[bug] anchor editor breaks visibility of LabeledEdit
« on: July 29, 2022, 08:14:56 pm »
The anchor editor (https://wiki.freepascal.org/Anchor_Sides) breaks for me the visiblity on LabeledEdits:
- take the attached simple Form
- select there the LabeledEdit and open the anchor editor
- enable the top anchor

result: the label is hidden under the panel

- to add space between the panel and the edit, add top border space

result: you can add as much space as you want and the label keeps invisible. The bug is that the space is added between the edit and the label and not between the LabeledEdit and the panel.

Bart

  • Hero Member
  • *****
  • Posts: 5288
    • Bart en Mariska's Webstek
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #1 on: July 29, 2022, 09:08:36 pm »
A TLabeledEdit cannot properly be alligned since the "alignment mechanism" only "sees" the TEdit part, so that one becomes aligned.
The same happens in Delphi.

Our TEditButton controls (basically a TEdit plus a TSpeedButton) don't have this problem since they are embedded in a TCustomControl, adn the TCustomControl gets aligned.
The drawback with that design is that you have to "forward" each and every property and method of the TEdit, whic is a lot of overhead.

If TLabeledEdit were redisigned like TEditButton, that the alignment problems would vanish.

Bart

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #2 on: August 01, 2022, 02:59:32 pm »
A TLabeledEdit cannot properly be alligned since the "alignment mechanism" only "sees" the TEdit part, so that one becomes aligned.
The same happens in Delphi.
I understand, but why is the label part moved away from the edit part when I align?
I thought: "OK, the alignment only sees the edit part, so I add some space on top to make the label part visible". Instead the label part is then shifted upwards so that it stays invisible behind the object I want the LabeledEdit to be aligned below.

Bart

  • Hero Member
  • *****
  • Posts: 5288
    • Bart en Mariska's Webstek
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #3 on: August 01, 2022, 09:55:34 pm »
I have no idea.

Bart

jamie

  • Hero Member
  • *****
  • Posts: 6128
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #4 on: August 01, 2022, 10:34:13 pm »
Put the label Edit inside a TPanel..

Align the Panel instead and set the TLabelEdit for autosize etc.

The only true wisdom is knowing you know nothing

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #5 on: August 04, 2022, 08:13:12 pm »
Align the Panel instead and set the TLabelEdit for autosize etc.
Thanks.

However, I thought that the behaviour of TLabeledEditcould be improved somehow.

Bart

  • Hero Member
  • *****
  • Posts: 5288
    • Bart en Mariska's Webstek
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #6 on: August 04, 2022, 10:17:05 pm »
It can, in the way I described.
And then people will complain that it is not Delphi compatible anmore.

Bart

wp

  • Hero Member
  • *****
  • Posts: 11906
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #7 on: August 05, 2022, 12:14:23 am »
I don't understand jamie's description. Here's what I would do:
  • Don't use TLabeledEdit.
  • Put the label and the edit into a panel.
  • Set the panel's ChildSizing.ControlsPerLine to 1, .EnlargeHorizontal to crsHomegenousChildResize and .Layout to cclLeftToRightThenTopToBottom.
  • Set the Panel's AutoSize to true and its Constraints.MinWidth to the desired width of the edit box.
This can be applied to any combination of labels and controls (e.g. a "TLabeledCombobox")

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: [bug] anchor editor breaks visibility of LabeledEdit
« Reply #8 on: August 05, 2022, 12:34:01 am »
I don't understand jamie's description. Here's what I would do:
  • Don't use TLabeledEdit.
  • Put the label and the edit into a panel.
  • Set the panel's ChildSizing.ControlsPerLine to 1, .EnlargeHorizontal to crsHomegenousChildResize and .Layout to cclLeftToRightThenTopToBottom.
  • Set the Panel's AutoSize to true and its Constraints.MinWidth to the desired width of the edit box.
This can be applied to any combination of labels and controls (e.g. a "TLabeledCombobox")
or make it a frame so you can drop as many as needed.

 

TinyPortal © 2005-2018