Howdy, Stranger!

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

In this Discussion

Prevent a dkTool client from docking to a panel used for just dkDocument clients?

My form is basically a center panel with several dkDocument clients in tabs.  Around the that center panel I have a bunch of dkTool clients.  Is there any way to prevent a dkTool client from docking to the panel containing all my dkDocument clients?

Comments

  • 4 Comments sorted by Votes Date Added
  • You can use Site.OnDockOver event for this.
  • Not much documentation that I could find on this event, so I took a stab at it anyway with some help from your dock demo.  Seems a bit lengthy but seems to work.  Is there a better way?

      if (Source.Control is TLMDDockPanel) and
        (TLMDDockPanel(Source.Control).ClientKind = dkTool) and
        (AZone.Kind = zkTabs) and (AZone.Tabs[0].Zone <> nil) and
        (AZone.Tabs[0].Zone.Kind = zkPanel) and
        (AZone.Tabs[0].Zone.Panel.ClientKind = dkDocument) then
      begin
        Accept := false;
      end;

  • Hi,

    I have the same kind of question. I have 2 forms with a TLMDDockSite.
    I want to prevent that a panel from one form can be dropped on the other form.

    My solution is sing the Site.OnDockOver like this:

    if TLMDDockPanel(Source.Control).Site.Name <> printDocksite.Name then
            Accept := false;

    Where the 2 TLMDDockSite components are:

    TLMDDockPanel(Source.Control).Site --> place on form A
    printDocksite   --> placed on form B

    I did it also via versa.


  • Name property is not a best solution, I think. 
    You can use any other control property, which does not change over time. For this task Owner property will fit well (it set to panel's parent form, if you created dock panels at design-time in Delphi's form designer).
Sign In or Register to comment.