RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TControl.UndockWidth Property

Specifies the width of the control when it is floating.

Pascal
property UndockWidth: Integer;
C++
__property int UndockWidth;

Read UndockWidth to get the width of the control from the last time it was floating. Set UndockWidth to indicate the width the control should have the next time it is undocked. 

UndockWidth allows a control to "remember" its floating size even when its width changes because it is docked.  

C++ Examples: 

 

/*
This example shows how to undock a dockable object.  This example
is part of the Docking Demo.
*/

void __fastcall TTabDockHost::FormClose(TObject *Sender, TCloseAction &Action)
{
  TRect ARect;
  TPoint point;
  if (PageControl1->DockClientCount == 1)
  {
    point =  PageControl1->DockClients[0]->ClientToScreen(Point(0, 0));
    ARect.left = point.x;
    ARect.top = point.y;
    point = PageControl1->DockClients[0]->ClientToScreen(
      Point(PageControl1->DockClients[0]->UndockWidth, PageControl1->DockClients[0]->UndockHeight));
    ARect.right = point.x;
    ARect.bottom = point.y;
    PageControl1->DockClients[0]->ManualFloat(ARect);
    Action = caFree;
  }
  else
    Action = caHide;
}

 

Delphi Examples: 

{
This example shows how to undock a dockable object.  This example
is part of the Docking Demo.
}
procedure TTabDockHost.FormClose(Sender: TObject;
  var Action: TCloseAction);
var
  ARect: TRect;
begin
  if PageControl1.DockClientCount = 1 then
  begin
    with PageControl1.DockClients[0] do
    begin
      ARect.TopLeft := ClientToScreen(Point(0, 0));
      ARect.BottomRight := ClientToScreen(Point(UndockWidth, UndockHeight));
      ManualFloat(ARect);
    end;
    Action := caFree;
  end else
    Action := caHide;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!