How To…Refresh Data Tree

Question

“How can I refresh the Designer Data Tree via code?”

Solution

The following example shows how to refresh the Data Tree window.

Download: RefreshDataTreeInCode.zip

Sample Delphi code:

uses
  ppEndUsr, 
  ppToolWnTBX, 
  ppDesignLayoutManager,
  ppDesignToolManagerTBX;

procedure TForm1.ppDesigner1Show(Sender: TObject);
var
  lLayoutManager: TppDesignLayoutManager;
  lToolManager: TppDesignToolManager;
  lDataTree: TppDataTreeWindow;
begin

  lLayoutManager := ppDesigner1.Form.LayoutManager;

  // get the ToolManager 
  lToolManager := lLayoutManager.ToolManager;

  // use the ToolWindows[] array to access the DataTreeWindow
  lDataTree := TppDataTreeWindow(lToolManager.ToolWindows.ItemsByName['DataTreeWindow']);

  if lDataTree <> nil then
    lDataTree.Refresh;

end;