Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Docking: change docked panel size in code

Is there a way to change the width / height of a docked panel in code? I have tried all the obvious paths without any success. 

I can understand that all the panels in a zone need to be the same height if horizontal, or width if vertical but I can't find a way to change the panels parent zone size. 

Is there a way to change the height of a panel in a vertical zone or width in a horizontal zone?

Comments

  • 4 Comments sorted by Votes Date Added
  • You should use Zone.Width or Zone.Height for that. Note that:

      - Zone.Width will only work if Zone.Parent.Kind = zkHorz.
      - Zone.Height will only work if Zone.Parent.Kind = zkVert.
  • So what do I do to change the width of a column of panels? If I have 4 panels in a single column down the left side of the app, how do I change the width of the zone - and therefore the 4 panels? I can do that in the designer.
  • edited April 2023 Posts: 0 Accepted Answer Vote Up0Vote Down
    Zones are organized in a tree. So (given your description):

    - Each of your panels resides in its own zkPanel zone.
    - Mentioned panel zones reside in a parent zkTabs zone. That's why they cannot be resized directly.
    - Tabs zone resides in a parent zkHorz zone. That's why changing Width of that tabs zone should be possible.

    So, you can simply search for a zone, which parent zone is of zkHorz kind:

    zn := MyPanel.Zone; // One of your 4 panels.
    while (zn.Parent <> nil) and (zn.Parent.Kind <> zkHorz) do
      zn := zn.Parent;
    if zn <> nil then
      zn.Width := NewValue;
  • Ahh, OK got it now. I needed to go up one more level
Sign In or Register to comment.