Article submitted by: Anand Gopalakrishnan for the Delphi Programming Quickies Contest.
A TreeView of data
This sample project uses one Page control, 3 TabSheets, 2 Combo Boxes, a BitBtn, Splitter, Memo, Listbox, Dbgrid and 2 Treeviews.
Usage of tabsheets on the pagecontrol:
- General Used for Structure Definition from a fields in the table.
- Data view displays the treeview with records in a hierarchial order.
- Grid View displays query result in a grid.
General tabsheet has the following treeview for structure definition which forms the base. Two ComboBoxes each for selecting the alias and table; as soon as they are selected, the fields of the selected table are displayed in the list box.
Dragging can be done from the list box on to the treeview for structure definition.
Thats all! After the structure is defined just click the "view data" button. Query statement is displayed in the memo just below the tree view. Switching tab sheets will show you the data view. Treeview items containing the record values filled from the table and then the grid view display of records in a DBGrid.