UnDock (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

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


Code

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;
}

Uses