Anyone know of a good docking component ?

Hey!

I want to develop an application that supports docking forms on each of the 4 borders.  I have seen the example included in delphi and it has a bug that I can't find a way to fix it.  The problem is if one has a status bar, when a form is docked in the bottom dock-site the status bar is shifted above the docked form.

Can someone tell me of a good docking component that includes source ? ... I will increase the points to 500 if someone provides me with a sample app that does this (without using any 3rd party components)
LVL 7
jcondeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

geobulCommented:
Hi,

Here is an example. You may change the value of SnapArea variable which is 10 pixels here. Its value determines how close to a border docking takes place.

------
type

  TMovingSide = wmsz_Left..wmsz_BottomRight;
  TMovingSides = set of TMovingSide;

  TWMMoving = record
    Msg: Cardinal;
    Side: TMovingSides;
    Rect: PRect;
    Result: Longint;
  end;

  TForm1 = class(TForm)
    StatusBar1: TStatusBar;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    FDockable: boolean;
    FSnapArea: integer;
    DispLeft, DispTop, DispRight, DispBottom: Integer;
    procedure WMEnterSizeMove(var Message: TMessage); message WM_ENTERSIZEMOVE;
    procedure WMMoving(var Message: TWMMoving); message WM_MOVING;
  public
    { Public declarations }
    property Dockable: boolean read FDockable write FDockable;
    property SnapArea: integer read FSnapArea write FSnapArea;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMEnterSizeMove(var Message: TMessage);
begin
  if not Dockable then exit;
  DispLeft:=0;
  DispTop:=0;
  DispRight:=0;
  DispBottom:=0;
end;

procedure TForm1.WMMoving(var Message: TWMMoving);
var
  OfsX, OfsY: Integer;
  r: TRect;
begin
  if not Dockable then exit;
  SystemParametersInfo( SPI_GETWORKAREA, 0, @r, 0 );
  with Message.Rect^ do begin

    if Abs(DispLeft + Left - r.Left) < SnapArea then begin
      OfsX:=r.Left-Left;
      DispLeft:=DispLeft + Left-r.Left;
    end else begin
      OfsX:=DispLeft;
      DispLeft:=0;
    end;

    if Abs(DispRight+Right-r.Right)<SnapArea then begin
      OfsX:=r.Right-Right;
      DispRight:=DispRight+Right-r.Right;
    end else begin
      OfsX:=OfsX+DispRight;
      DispRight:=0;
    end;

    if Abs(DispTop+Top-r.Top)<SnapArea then begin
      OfsY:=r.Top-Top;
      DispTop:=DispTop+Top-r.Top;
    end else begin
      OfsY:=DispTop;
      DispTop:=0;
    end;

    if Abs(DispBottom+Bottom-r.Bottom)<SnapArea then begin
      OfsY:=r.Bottom-Bottom;
      DispBottom:=DispBottom+Bottom-r.Bottom;
    end else begin
      OfsY:=OfsY+DispBottom;
      DispBottom:=0;
    end;

  end;
  OffsetRect(Message.Rect^,OfsX,OfsY);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  SnapArea := 10;
  Dockable := true;
end;

end.
------------
Regards, Geo

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BlackManCommented:
Not free, but you should check ExpressBars 5 from www.devexpress.com - cool docking functionality, just like VS.NET
geobulCommented:
Thanks for the grade but you promised 500 points for source code.
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

jcondeAuthor Commented:
sorry, that was my mistake.

I will add a question for you to answer in the main delphi forum for 325 ok ?
geobulCommented:
It would be nice if you don't mind, have these points and still think that the code was helpful enough :-) Usually such questions are 'points for <expert name here>'. And yes, it should be in the Delphi area.

Regards
jcondeAuthor Commented:
its already there :)  ... even before you posted this comment !
geobulCommented:
Thank you very much. Have a nice day :-)
dzkadCommented:
I meet the same question in C++ builder,can someone provide a example code.
thank u firstly
dzkad@netease.com
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.