Howdy, Stranger!

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

In this Discussion

How do I prevent Tool panels from being docked in the Tabbed Space zone.

I want to prevent a Tool panel from docking on the tabbed Space zone.
I see that I need to use the  UpdateHotSpots so I have written this:

procedure TfmIDEMain.dsMainUpdateHotSpots(Sender: TObject;
  AZone: TLMDDockZone; var EnabledAreas: TLMDActiveAreas);
begin
  if AZone.Panel.ClientKind = dkTool then
    Exclude(EnabledAreas, hsaZoneTabs)
end;

The documentation seems to be behind the code because when I created an OnUpdateHotSpots Event I see the EnabledAreas is of type TLMDActiveAreas  but that type is not recognized as a type and the TLMDHotSpotAreas is recognized.  

Can  you advise on what the datatypes should be and what changes I need to make to get type compatibility.
Tagged:

Comments

  • 9 Comments sorted by Votes Date Added
  • edited December 2022 Posts: 0 Accepted Answer Vote Up1Vote Down
    You should use TLMDActiveAreas type. It has been moved into LMDDckStyleElems.pas unit, so, please add the unit into your "uses" clause. TLMDHotSpotAreas is the old name, and it now declared as an alias to TLMDActiveAreas and marked as deprecated.
  • Thanks, that has resolved it.
  • Thank you, that has solved it and I understand now why it was Access Violating.  Your help is much appreciated.
  • You can install and use our source files for issues like this one.
  • I found the LMDDckStyleElems.int file to get the datatypes but will download the when I next update.
  • With the code above and with the addition of LMDDckStyleElems it compiles but as soon as I start a drag operation I get run time error then an access violation.

  • edited December 2022 Posts: 0Vote Up0Vote Down
    Hard to say whats going on. Please provide a small demo project.
  • Attached is a small demo.
    Run it, File, AddMemoPage to add a tabbed document
    Now start to drag left hand tool window and place it on the tabbed area.  Drop is allowed despite excluding hsaTabs in EnabledAreas
    Drag the tool window outside the app area and you get an access violation.


    zip
    zip
    DockDemo.zip
    101K
  • Please use OnUpdateHotSpotsEx event, which provides additional AClient parameter. It allows to disable hot-spots depending of the currently dragging client properties. 

    On the other side, AZone parameter provides access to the site's zone over which the client is currently dragged. It may be a panel zone and so, has its Panel set, or some other kind of zone, in which case the Panel will be nil. But, in any case AZone.Panel does not represent the dragging panel.

    procedure TfmIDEMain.dsMainUpdateHotSpotsEx(Sender: TObject;
      AClient: TControl; AZone: TLMDDockZone; var EnabledAreas:
      TLMDActiveAreas);
    begin
      if (AClient is TLMDDockPanel) and
         (TLMDDockPanel(AClient).ClientKind = dkTool) and
         (AZone = dsMain.SpaceZone) then
      begin
        EnabledAreas := EnabledAreas - [hsaTabs, hsaDocsLeft, hsaDocsTop,
                                        hsaDocsRight, hsaDocsBottom];
      end;
    end;
Sign In or Register to comment.