How to start?

The following steps show you progressively how to start programming the Exontrol's ExTree component: 

  1. Adding columns. The control supports multiple columns, so at least one column must be added, before anything else. The Columns.Add method adds a new column to the control's columns collection. Another option to add columns is using the DataSource method of the control. If you have an ADO or DAO recordset just pass it to the DataSource property, and it will do the rest. The AddColumn event notifies your application that a new column has been added. Check the Column object for all options you can apply to a column.
  2. Adding items/data. The Items object holds a collection of items. Each item is identified by an handle. Each item contains a set of cells, one for each column in the control. Each cell is identified by its index in the item. So, an item is always referred as ItemProperty(h), and the cell as CellProperty(h,c). The control provides several ways to add items. If you are using the DataSource method as described in the step 1, the fields from the recordset are automatically loaded to the control. When you are doing manually, use the Items.AddItem to add a root item, whenever you need to display data as a list,  or the Items.InsertItem or Items.InsertControlItem to insert child items, or child items that host ActiveX control, when you need to display your data as a tree. The PutItems method takes an array of data and fetches in the control. The AddItem event notifies your application that a new items is added.
  3. Filling the cells. If your control contains a single column, the data in the column is automatically put at adding time, because any of the AddItem or InsertItem method contains a Caption parameter that may be used at loading time. If you have a control with multiple columns, you need to use the CellCaption property to specify the captions for the rest of the columns. The AddItem or InsertItem method may use array of data as parameters in order to specify captions for all cells in the data.
  4. Adding options for cells and items. The Items object holds the entire collection of options that may be applied to a cell. For instance, the CellBold property bolds a cell, the ItemForeColor property changes the foreground color for the entire item, the CellImage property assigns an icon to a cell, or the CellHasCheckBox property assigns a checkbox to a cell.
  5. Adding events. The control supports events for most of the UI operations. For instance, the user clicks a checkbox, the CellStateChanged event is fired, or the user changes the cell's value so the Change event is fired.

No matter what programming language you are using, you can have a quick view of the component's features using the WYSWYG Template editor. It's a nice feature and we don't want you to miss it. 

The Template feature lets you to use a simple x-script language to call properties and methods of the control at design as well at runtime. You can use this feature to build x-script strings to pass them at runtime. You can find a short description of the x-script language here

Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.