How to start?
The following steps show you progressively how to start programming the
Exontrol's ExTree component:
- 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.
- 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.
- 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.
- 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.
- 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.
- Place the control to your form or dialog.
- Locate the Properties item, in the control's context menu, in design mode.
If your environment doesn't provide a Properties item in the control's
context menu, please try to locate in the Properties browser.
- Click it, and locate the Template page.
- Click the Help button. In the left side, you will see the component, in
the right side, you will see a x-script code that calls methods and
properties of the control.
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.