Sample Application for Tree and List View Controls


This sample demonstrates the use of tree views and list views in an XML Container.

About XML Containers

An XML Containers is a screen control (field) that renders based on XML data supplied to the control at runtime. To use an XML Container, you simply paint a control on a screen and nominate function (FieldAction) to execute when an event occurs. Then you populate the container by sending xml data to the control at runtime.

Use the following steps to add an XML Container to a screen:

  1. Paint the XML Container on the screen. Select the Container Style (i.e. Multicol for listview, TabCtrl for TabView etc).
  2. Set the Field Action to a function to execute on an event in the container. For some XML Container types you can also specify a double-click action.
  3. Set the InputXML. This is the default xml subset (for example "mytabs") to use to render the container contents on screen display. To re-render the contents, use the SCREEN *RENDER command. The Output XML is not required as this is specified as "@EventSubset" in the Input XML.
  4. Set other characteristics for the control such as color, fonts etc. Normally you will want "Perform on Show" to be true.
  5. Using the Blob Editor, select "New from Template" and select the desired XML Container type (listview, treeview etc.). Alter the template to suit your requirements. Save the blob.
  6. In the Screen source function or the function that calls the screen, create an xml subset from the static blob (i.e. XML *OPEN "mytabs" *BLOB= "tabs").
  7. Optionally modify the subset to reflect runtime conditions.
  8. When the screen is displayed, the XML Container will render based on the information in the xml subset.

To change the conents of the XML Container after the initial display use the SCREEN *RENDER command.

SCREEN *RENDER "fieldnameref" *SUBSET= "subsetdataref"


IF L-User = "Advanced" THEN
SCREEN *RENDER "tabfield" *SUBSET= "alltabs"
SCREEN *RENDER "tabfield" *SUBSET= "basictabs"

Once rendered, the XML Container will notify the server of events by running the function nominated in "FieldAction". In your event function, read the contents of the subset nominated at "OutputXML" or as specified in your "EventSubset" in the creation xml.

To activate an event in an XML Container other than the user clicking on the control, use the SCREEN *REFRESH command. A *REFRESH will force event logic to be performed.

About the TreeView XML Container

The TreeView XML Container is used to display Windows tree views with the following functionality:

Any number of tree nodes and children can be displayed.

Tree node contents can be pre-populated or retrieved on the expand event.

A tree node can selected and expanded programmatically.

Tree node children can be replaced or appended.

Individual Tree Nodes can be modified without drawing the complete structure.

About the ListView XML Container

The ListView XML Container is used to display Windows multi-column list views with the following functionality:

Any number of list items can be displayed.

Events that can be triggered programmatically include item select, delete and modify.

Events that can be tracked by the developer include click (select) and double click.

The columnid to sort by can be set on creation. The current sort order is returned with every select event.

A alternate Sort value can be supplied per column and row to force custom sorting at the client.

List items can be programmatically modified either by replacing the complete row or a specific column value.

Example Application

Download the treedemo application for examples on using the TreeView and ListView XML Container.

XML Schema and Examples

XML Schema XSD for TreeView and TreeView Event subsets.

XML Schema XSD for ListView and ListView Event subsets.