Howdy, Stranger!

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

In this Discussion

Docking - constrain/set dockpanel size

Is there a way to constrain or set the size of a floating dockpanel to prevent it getting too small? I have found that it is possible to have a floating dockpanel with a size of 0 x 0 so it disappears, don't ask me how - I was just messing with the panels and a floating one disappeared and the XML shows the <site> height and width were 0 . Constraining the panels or components on the dockpanel does not help, they just get clipped. Trying to set the size explicitly during DockManage.LoadFromFile or the Resize event does not work - at least not with these methods:

dpMyDockPanel.Height := max(dpMyDockPanel.Height,500);
GetParentForm(dpMyDockPanel).UndockHeight := max(dpMyDockPanel.Height,500);

With the UndockHeight method the parentform reported the size was changed from 0 to 500, however the actual panel remained invisible. Changing the <Site> Height and Width in the XML does fix the size.

Comments

  • 3 Comments sorted by Votes Date Added
  • There are no way to constrain the panel min/max sizes.
  • Can I suggest you consider trying to fix that? I see that as a significant flaw in the otherwise excellent Docking system!
  • If you speak about floating panels specifically, you can constrain floating forms, which are hosts for panels. Use DockManager's OnCreateFloatingSite event to get the reference to newly created site for a panel, and then the site's FloatingForm to get access to it's parent form.
    But note, that the form is different from the panel, because you can dock several panels into single floating site (form):

    procedure TfrmMain.DockManagerCreateFloatingSite(Sender: TObject;
      ASite: TLMDDockSite);
    begin
      ASite.FloatingForm.Constraints.MinWidth := 400;
      ASite.FloatingForm.Constraints.MinHeight := 400;
    end;
Sign In or Register to comment.