Howdy, Stranger!

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

In this Discussion

LMDDocking: how to decrease a specific Zone's width

I have a docksite with 4 dockpanels side by side, like this:

-----------------------------------
|      |      |            |      |
|      |      |            |      |
|      |      |            |      |
|  A   |   B  |    X       |  C   |
|      |      |            |      |
|      |      |            |      |
|---------------------------------|


The X is my space zone.

I'm setting the zones to be Kind = zrkFixed by code, like this:

    for I := 0 to LMDDockSite1.RootZone.ZoneCount - 1 do
    begin
      if (LMDDockSite1.RootZone.Zones[i].ResizeKind <> zrkSpace) then
        LMDDockSite1.RootZone.Zones[i].ResizeKind := zrkFixed;
    end;


I want to reduce the width of X by 20 pixels, like this:
LMDDockSite1.RootZone.Zones[2].Width := LMDDockSite1.RootZone.Zones[2].Width -20;

That works, but not in the way I need, because I'd like it to take away 20 pixels from Panel 'C' (RootZone.Zones[3]), but it takes away the pixels from Panel 'A' (RootZone.Zones[0]).

So, it's doing this:
---------------------------------
|           |      |       |      |
|           |      |       |      |
|        
  |      |       |      |
|  A  
     |   B  |    X  |  C   |
|      
    |      |       |      |
|        
  |      |       |      |
|---------------------------------|


But I'd like to force it to do this:

-----------------------------------
|      |      |       |           |
|      |      |       |           |
|      |      |       |           |
|  A   |   B  |   X   |     C     |
|      |      |       |           |
|      |      |       |           |
|---------------------------------|


How can I achive that? How can I force A and B not to change, only C to change when I reduce the size of X?
Is there anyway I can set all the panels (zones)  Width individually but all at once, without them affecting the other's dimension, only after I'm done setting up the dimensions?

I appreciate any help


Comments

  • 4 Comments sorted by Votes Date Added
  • Right, overnight I managed to sort this out.
    I created this function that does the trick, based on the original procedure TLMDDockZone.SetWidth:
    Basically, if you pass a pSupportZone, it will take away (or add) the Value out of it, or use the classic behaviour if you pass pSupportZone = nil;

    procedure TLMDDockZone.IncWidth(const Value: Integer; pSupportZone: TLMDDockZone);
    begin
      if Value <> 0 then
      begin
        Inc(FWidth,Value);
        FDSize     := 0;
        FInserting := True;
        if pSupportZone <> nil then
           pSupportZone.Width := pSupportZone.Width - Value
        else
           FTree.FSite.UpdateLayout(True);
      end;
    end;


  • Hi,

    We do not provide a way of changing the size of several zones at ones. So, like with any other VCL control, you should change sizes separately one by one.

    What you actually want - is to change zone C size, so you can just change it without any additional functions.

    Btw, initial purpose of docking pack is is to allows **end user** changing UI layout.
  • Yes, I understand now that the whole docking pack was designed around the user actions, but for my purposes I have to adapt it so it is done programatically.
    Thanks
Sign In or Register to comment.