0

Is there any Option in Embarcadero Delphi Anchor Sides/AnchorToNeighbour?

Currently, it is possible in Lazarus to anchor-align the components to Left-Right/Top Bottom etc to the neighboring components. I need some image screenshot or any functional way of achieving this in Delphi Seattle 10!!

Danilo Casa
  • 506
  • 1
  • 9
  • 18
ShadYantra
  • 15
  • 4

1 Answers1

1

In VCL, there is nothing to automatically anchor a control relative to a neighboring control. The Anchors property is meant for aligning a control relative to the edges of its Parent, not relative to other controls. However, windowed controls (not graphical controls) have OnAlignInsertBefore and OnAlignPosition events that can be used for custom alignment when the Align property is set to alCustom. Otherwise, you have to use OnResize event handlers to manually position/size controls as needed.

In FireMonkey, there are TLayout-derived components (TFlowLayout, TGridLayout, TScaledLayout) to help arrange components (see Using Layouts to Arrange Components for more details), but this does not necessary equate to anchoring a control to a neighboring control, it is still relative to the Parent, just a bit more flexible than what VCL offers.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Thank you for your suggestion. I tried it and worked as expected. Howeer, I'm wondering why Lazarus and Embarcadero Delphi communities are going separate ways after DX7 – ShadYantra Apr 16 '16 at 08:20
  • Good suggestion. I also tried and checked TGridPanel and TFlowPanel and to some extent it helped me. – ShadYantra Apr 16 '16 at 08:52