Delphi IDE


Object TreeView

A new tool for Delphi 6 is the usefull Object TreeView which displays a tree diagram of the visual and nonvisual components
that you have on your form. It is placed by default over the Object Inspector.
The Object TreeView displays the components logical relationships, such as parent-child and and property relationships.

You can use the Object TreeView to create other relationships and you can do this by dragging and dropping one component on top of another.

Here is an example of dragging and dropping:

Put a TPanel (Panel1) component on the form and then a TButton (Button1).
Next drag Button1 over to Panel1 and then drop it on Panel1, you will notice on the form that Button1 is now a child of Panel1, in other words Button1 is in Panel1.
If you try (on the form) to drag Button1 off Panel1 you can't.

If you now look at the Object TreeView list you will see that Button1 is a child of Panel1 and Button1 "branches out from" Panel1 in the tree.
To put Button1 back on the form just drag it and drop it on Form1 in the Object TreeView.
If you add a TMenu component to Form1 and then you try to drag Memo1 onto Button1 you are not able to do this, this is common sense because you cannot put a Memo onto a button. You can put the memo on Panel1.

Certain things are noticed when you drop some components on a form.
An example is when you put a TTable component on a form

You can see from the image above that a red question mark in a yellow circle is seen, and this is because the item is not completely defined or has some sort of problem.
If you set the DataBaseName (For Table1) then the question mark disappears, so if  you change the DataBaseName property in the Object Inspector to DBDemos then the question mark next to Alias is gone.
Next you change the Table1 TableName property to clients.dbf and the second question mark disappears as well.

Here is a screen shot of this result.

If you click on a component name in the Object TreeView you will see that the component becomes selected on the form.
You will also notice that if some components like a TMainMenu are listed in the Object TreeView and you right-click on the name (Example: MainMenu1) you will see listed the Menu Designer, this is very helpful.
This is because when you right-click an item in the tree diagram, you'll see an abridged version of the component's context menu, to be able to get the full menu, right-click on the same component in the form, frame or data module.

If you start with a new project and nothing is on the form (Form 1) then you can click on a component, in this case we will click on a TPanel (Panel1) component in the Component Palette, after clicking on the component take your finger off the mouse button and move the mouse cursor over to the Object TreeView you will notice the Drag mouse cursor when the mouse cursor is over the word Form1 in the Object TreeView, now click on the word Form1 and Panel1 will be on Form1.

We can do the same thing to add a TButton (Button1) to Panel1.
Just click on the Button component in the Component Palatte and then click on Panel one in the Object TreeView.
Note that we do not even have to drag the component over to the Object TreeView.

This little example shows how helpful the Object TreeView can be, you can now easily drop a component on another component even if you cannot see it on Form1, an example is if Panel1 is behind a bigger panel then you can still easily drop Button1 on Panel1 even if you cannot see Panel1.

If you want to you can also print the contents of the Object TreeView, just make sure the Object TreeView is selected by clicking on it and then select File|Print from the main menu.



 
Delphi IDE