도킹 폼에 다음과 같은 프로시져가 있습니다.
procedure CMDockClient(var Message: TCMDockClient); message CM_DOCKCLIENT;
CM_DOCKCLIENT 메시지를 받으면 실행 하는 프로시져 같은데 다음과 같습니다.
procedure TDockableForm.CMDockClient(var Message: TCMDockClient);
var
ARect: TRect;
DockType: TAlign;
Host: TForm;
Pt: TPoint;
begin
//Overriding this message allows the dock form to create host forms
//depending on the mouse position when docking occurs. If we don't override
//this message, the form will use VCL's default DockManager.
//NOTE: the only time ManualDock can be safely called during a drag
//operation is we override processing of CM_DOCKCLIENT.
if Message.DockSource.Control is TDockableForm then
begin
//Find out how to dock (Using a TAlign as the result of ComputeDockingRect)
Pt.x := Message.MousePos.x;
Pt.y := Message.MousePos.y;
DockType := ComputeDockingRect(ARect, Pt);
//if we are over a dockable form docked to a panel in the
//main window, manually dock the dragged form to the panel with
//the correct orientation.
if (HostDockSite is TPanel) then
begin
Message.DockSource.Control.ManualDock(HostDockSite, nil, DockType);
Exit;
end;
//alClient => Create a TabDockHost and manually dock both forms to the PageControl
//owned by the TabDockHost.
if DockType = alClient then
begin
Host := TTabDockHost.Create(Application);
Host.BoundsRect := Self.BoundsRect;
Self.ManualDock(TTabDockHost(Host).PageControl1, nil, alClient);
Message.DockSource.Control.ManualDock(TTabDockHost(Host).PageControl1, nil, alClient);
Host.Visible := True;
end
//if DockType <> alClient, create the ConjoinDockHost and manually dock both
//forms to it. Be sure to make dockable forms non-dockable when hosted by
// ConjoinDockForm, since it is using the VCL default DockManager.
else begin
Host := TConjoinDockHost.Create(Application);
Host.BoundsRect := Self.BoundsRect;
Self.ManualDock(Host, nil, alNone);
Self.DockSite := False;
Message.DockSource.Control.ManualDock(Host, nil, DockType);
TDockableForm(Message.DockSource.Control).DockSite := False;
Host.Visible := True;
end;
end;
end;
코드가 이해가 잘 되지 않아 그대로 따라 했는데 안 되는군요.
CM_DOCKCLIENT 메시지가 언제 어디서 날라 오는지 정말 모르겠군요.
좋은 답변 부탁드릴께요.
그럼 수고하세요.
메시지 정의
CM_DOCKCLIENT = CM_BASE + 56;
메시지 내용
TCMDockClient = packed record
Msg: Cardinal;
DockSource: TDragDockObject;
MousePos: TSmallPoint;
Result: Integer;
end;
그리고 메시지 hook을 해 보니...
DockOver -> CMDockclient -> DockDrop 순으로 메시지가
전달되는군요...
그리구 override 를 명시하지 않으면 기존 메서드를 완전히 대체하네요.
허접 자답이었습니다. 꾸벅...