Hello

Hello,

I've finally release a new demo for the AlignWeigth property of my TGraphicPanel

https://quality.embarcadero.com/browse/RSP-20201

https://github.com/tothpaul/Delphi/tree/master/GraphicPanels/Demo1
https://github.com/tothpaul/Delphi/tree/master/GraphicPanels/Demo1

Comments

  1. Hello Paul, it's not obvious to me what does it actually do.

    ReplyDelete
  2. Edwin Yip look at the picture, GraphicPanel2, 3, 4, 5 and 8 have the same parent, using Align and AlignWeigth properties it is possible to have GraphiccPanel4 in alRight with full height of it's parent, GraphicPanel2 with alLeft at the right of TGraphicPanel3 with alTop.
    GraphicPanel6 & 7 are ordered with AlignWeigth regardless of the Top propertie (you can show/hide them they will always been sorted the same way)

    ReplyDelete
  3. Attila Kovacs my request is to add this property to TControl not to create a new component. Like the possibility to have parented TGraphicControl, the purpose is to reduice the number of HWnd used in a form just for layout purpose

    ReplyDelete
  4. Plus, it becomes a nightmare if you have multiple nested panels and need to dynamically change the position of some of them.

    ReplyDelete
  5. Interesting. The same could probably be implemented with alCustom, if I understand it correctly. But I do see the benefit in using a designer property and writing less code, if this feature doesn't interfere with the existing properties.

    ReplyDelete
  6. Ondrej Kelle with the default value 0 for AlignWeight you have the same behavior as yet.

    With alCustom it is possible to do the same but the components will be aligned individually in a almost random order, so it could be quit complicated to achieve.

    BTW my implementation of AlignControls seems better than the actual code to me. I build a list of components, sorts this list according to Align and AlignWeight and then put the components in the ClientRect one by one, reducing the rectangle at each step.

    github.com - Delphi

    ReplyDelete
  7. Paul TOTH With alCustom you have full control to align everything in code exactly as intended, it's not random at all. But it's more complicated, sure.

    ReplyDelete
  8. Ondrej Kelle I know, but for one component it's easy, for a bunch of components in the same layout it's more complicated.

    ReplyDelete
  9. In FMX you can do something similar, but not as flexible as your solution. In FMX you have both a "Top" and a "MostTop" Align option. Same for Left, Right and Bottom.

    ReplyDelete
  10. I find this idea interesting... we'll consider it

    ReplyDelete
  11. Also, a big plus can be the fact that the less non-visual panels for layout purposes you use the better all those skins work! I have had to tweak panel-panel setups for all skins not to draw an extra line and such.

    I have seen you posts regarding this. I though you, Paul TOTH, were designing yet another panel. Hate to have to choose components like that (panel, gridpanel, flowpanel, skinnedflowfrombottompanel...).

    Cool! Tell us when to vote!

    ReplyDelete
  12. Jeff Dyer misspelling, my french is a bit better but I guess you prefer bad english instead of good french :)

    ReplyDelete
  13. Maybe "Priority" (or "AlignPriority") is a better name? As I understand your solution (without having looked into the source), the Weight setting controls the order that the controls will be aligned.

    ReplyDelete
  14. Hans Lavdal Jakobsen I don't really care for the name of the property :) but Weight is the name used in Android layouts
    developer.android.com - Linear Layout

    ReplyDelete
  15. Attila Kovacs just put an higher weight on the most left panel and they will be ever in the same order. Delphi use panels positions to reorder them, so when you show/hide panels their position usually change :)

    ReplyDelete
  16. Attila Kovacs my request is that Embt includes this property in the VCL :) I could create a TWeightedPanel but you'll have to put those panels as parent of any other component, it's not the goal :)

    ReplyDelete

Post a Comment