PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Initializing a TreeView Table control
  • Adding or modifying rows in a TreeView Table control
  • Adding rows into a TreeView Table control
  • Modifying a row or a column
  • Resuming the input in a column
  • Adding or deleting a column
  • Managing calculated columns
  • Operations on the rows and cells
  • Deleting a row
  • Selecting a row
  • Retrieving the content of a row or the content of a cell
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of current row
  • Content of a specific row
  • Operations on the tree structure
  • Collapsing all the nodes of a TreeView Table control
  • Expanding all the nodes of a TreeView Table control
  • Finding out the number of the collapsed/expanded row
  • Defining the next status during an addition
  • Finding out and modifying the images of the rows
  • Check Box treeview column
  • Finding out the parent or the children of an element
  • Properties specific to the TreeView Table controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The main concepts for programming the TreeView Table controls are as follows. Several WLanguage functions allow you to manage the TreeView Table controls by programming.
Do not hesitate to see the documentation about these functions. See list of functions for managing the TreeView Table controls for more details.
Versions 18 and later
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for the WEBDEV sites.
PHP The TreeView Table control is now available for the PHP sites.
New in version 18
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for the WEBDEV sites.
PHP The TreeView Table control is now available for the PHP sites.
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for the WEBDEV sites.
PHP The TreeView Table control is now available for the PHP sites.
Initializing a TreeView Table control
To fill a TreeView Table control by programming, you have the ability to use the following functions:
If a new row was added into a TreeView Table control by TableAdd, TableInsert, TableAddLine, TableAddChild, TableInsertLine or TableInsertChild, the ..NewLine property is set to True (otherwise, it is set to False).
Versions 19 and later
WINDEV Note: To optimize the filling of a TreeView Table control, you have the ability to use ..AddChildDelayed on the rows of the TreeView Table control.
In this case, the principle for filling the control is simplified:
  • When initializing the control, only the first-level elements are loaded. Each element is associated with ..AddChildDelayed.
  • When the user clicks the element of the first level to expand it, the procedure defined by ..AddChildDelayed is run. This procedure fills the level to expand. The search for children is performed only when the user wants to see them.
New in version 19
WINDEV Note: To optimize the filling of a TreeView Table control, you have the ability to use ..AddChildDelayed on the rows of the TreeView Table control.
In this case, the principle for filling the control is simplified:
  • When initializing the control, only the first-level elements are loaded. Each element is associated with ..AddChildDelayed.
  • When the user clicks the element of the first level to expand it, the procedure defined by ..AddChildDelayed is run. This procedure fills the level to expand. The search for children is performed only when the user wants to see them.
WINDEV Note: To optimize the filling of a TreeView Table control, you have the ability to use ..AddChildDelayed on the rows of the TreeView Table control.
In this case, the principle for filling the control is simplified:
  • When initializing the control, only the first-level elements are loaded. Each element is associated with ..AddChildDelayed.
  • When the user clicks the element of the first level to expand it, the procedure defined by ..AddChildDelayed is run. This procedure fills the level to expand. The search for children is performed only when the user wants to see them.
Adding or modifying rows in a TreeView Table control

Adding rows into a TreeView Table control

The creation of a row in a TreeView Table control is not automatically performed. It must be explicitly requested via a call to:
WINDEV Note: If the "Cascading input" option is not selected:
  • The TreeView Table control contains no row when it is created. In this case, no input can be performed. ..Empty is set to True.
  • To automatically insert a row into an empty TreeView Table control, use TableAdd or TableAddLine.

Modifying a row or a column

The content of the rows and columns found in a TreeVview Table control can be modified:
  • by the user, by performing an input in the columns. The modifications are automatically stored in the treeview table without additional programming. ..Modified is set to True.
  • by programming:
    • with TableModify or with TableModifyLine to modify the content of the current row or the content of a given row.
      For example:
      TableModify(TVT_CUSTOMER, "MOORE" + TAB + "Vince" + TAB + "Miami")

      Note: You also have the ability to use the name of the TreeView Table control directly:
      // Modify the current row
      TVT_CUSTOMER = "MOORE" + TAB + "Vince" + TAB + "Miami"
      // Modify the COL_DAY coloumn of row 3
      TableModify(COL_DAY, "Wednesday" + TAB + "Off", 3)
    • by specifying the name of the column (like for an edit control) to modify the content of the column. To modify a column of a specific row, the number of the row must be specified (subscript).
      For example:
      COL_NAME[Subscript] = CustomerName

      To modify a column of the current row, there is no need to specify the subscript.
      For example:
      COL_NAME = CustomerName

      ..Modified is set to False (it is set to True when an input is performed in the treeview table).
WINDEVWINDEV Mobile

Resuming the input in a column

ReturnToCapture can be used to go back to input in a column of the current row. For example:
// Entry process in the COL_QTY column
// COL_QTY cannot be entered if COL_PRODUCT is not entered
IF NoSpace(COL_PRODUCT) = "" THEN
Error("The Product column must be entered first")
ReturnToCapture(COL_PRODUCT)
END
WINDEVWINDEV Mobile

Adding or deleting a column

You can:

Managing calculated columns

The calculation formula of a calculated column must be described in the "Displaying a table row" process. For example:
// COL_PBT: calculated column
// COL_UPBT and COL_QTY: columns linked to memory zones
COL_PBT = COL_UPBT * COL_QTY
Operations on the rows and cells

Deleting a row

The deletion of a row must be explicitly requested by TableDelete and TableDeleteChild.
  • The syntax used for TableDelete is as follows:
    TableDelete(<Name of TreeView Table> [, <Subscript>])

    If the subscript is specified, TableDelete deletes the row corresponding to the subscript. Otherwise, the current row is deleted.
    Deleting a row from a treeview table deletes all the values of the columns for this row.
  • The syntax used for TableDeleteChild is as follows:
    TableDeleteChild(<Name of TreeView Table>, <Subscript of Parent Element>)

    All the child elements of the row identified by the subscript will be deleted.

Selecting a row

The selection of a row is performed by TableSelectPlus.
The syntax used is:
TableSelectPlus(<Name of TreeView Table>[, <Subscript>])

Retrieving the content of a row or the content of a cell

The content of a TreeView Table control can be retrieved:
  • for the entire row.
  • cell by cell.

Value of a cell in the current row

To retrieve the value of a column (or cell) for the current row, the syntax is the same as for a simple edit control.
<Value> = <Column_Name>
For example:
// COL_QTY is a column of the treeview table
IF COL_QTY < 10 THEN
Info("Insufficient quantity")
END

Value of a cell in a specific row

To retrieve the value of a column not found on the current row, the subscript of the row must be specified.
<Value> = <Column Name>[<Subscript>]
For example:
// Add the total price before tax (PBT) for all the order lines
TotalPrice = 0
FOR Subscript = 1 TO TVT_ORDERS..Occurrence
TotalPrice = TotalPrice + COL_PBT[Subscript]
END

Content of current row

To retrieve the content of the current row:
<Value> = <Name of TreeView Table>

Content of a specific row

To retrieve the content of the row whose subscript is <Subscript>:
<Value> = <Name of TreeView Table>[<Subscript>]
Note: the subscript of current row is returned by TableSelect. For example:
// Retrieve the row 10 in the TVT_CUSTOMER treeview table
CurrentRow = TVT_CUSTOMER[10]
// Name of selected customer
CustomerName = COL_NAME[TableSelect(TVT_CUSTOMER)]
// Retrieve the current row in the TVT_CUSTOMER treeview table
CurrentRow = TVT_CUSTOMER
Operations on the tree structure

Collapsing all the nodes of a TreeView Table control

To collapse all the nodes of a TreeView Table control, use TableCollapseAll. The following syntax is used:
TableCollapseAll(<Name of TreeView Table>)

Expanding all the nodes of a TreeView Table control

To expand all the tree nodes of a TreeView Table control, use TableExpandAll. The following syntax is used:
TableExpandAll(<Name of TreeView Table>)
Versions 19 and later
WINDEV Note: If the TreeView Table control is using the delayed fill of sub-levels via ..AddChildDelayed, the procedure for filling sub-levels will be run for each new expanded element.
New in version 19
WINDEV Note: If the TreeView Table control is using the delayed fill of sub-levels via ..AddChildDelayed, the procedure for filling sub-levels will be run for each new expanded element.
WINDEV Note: If the TreeView Table control is using the delayed fill of sub-levels via ..AddChildDelayed, the procedure for filling sub-levels will be run for each new expanded element.

Finding out the number of the collapsed/expanded row

To find out the number of the row that is expanded or collapsed, all you have to do is use the "Collapsed, expanded" code of a node found in the TreeView Table control:
// Which row is used?
Info(TVT_TreeviewTable[TVT_TreeviewTable])

Defining the next status during an addition

You have the ability to define the status of the next row that will be added into a TreeView Table control, which means collapsed or expanded. To do so, use ..Collapsed.
// The next added rows will be automatically collapsed
TVT_TreeviewTable..Collapsed = True

Finding out and modifying the images of the rows

To find out and modify the images of the rows in a TreeView Table control, use the following properties:
// Modify the images of the rows in a treeview table
TVT_TreeviewTable..ExpandedImage = "OpenedFolder.gif"
TVT_TreeviewTable..CollapsedImage = "ClosedFolder.gif"

Check Box treeview column

A Check Box column can be defined as "TreeView Table column" in a TreeView Table control. In this case, the Check Box column can be used to manage the tree structure.
..Caption is used to find out and modify the caption found beside the check box. ..Value is used to find out and modify the value of the check box.

Finding out the parent or the children of an element

The following functions can be used to find out the parent or the children of an element:
  • TableGiveParent: Returns the "parent" of an element, which means the element of higher level.
  • TableGiveChild: Returns the "children" of an element, which means the elements of lower level.
Properties specific to the TreeView Table controls
The following properties are used to manage the characteristics of a TreeView Table control by programming.
Versions 19 and later
AddChildDelayed
New in version 19
AddChildDelayed
AddChildDelayed
Used to define the procedure that will be called later to fill a branch.
CollapsedAllows you to define the status (collapsed or expanded) that will be used when adding new rows into a TreeView Table control.
MergeUsed to find out whether the cells (or the titles of columns) found in a TreeView Table control are merged and to merge the cells (or the titles of columns) found in a TreeView Table control.
ExpandedImageUsed to find out and modify the default image in an expanded row of a TreeView Table control.
CollapsedImageUsed to find out and modify the default image in a collapsed row of a TreeView Table control.
MultiselectionUsed to find out and modify the mode for selecting a TreeView Table control.
Versions 19 and later
TotalNbChildren
New in version 19
TotalNbChildren
TotalNbChildren
Returns the total number of children for a branch in a TreeView Table control.
SortOptionUsed to find out and modify the sort options defined for a column in TreeView Table control.
LeftIndentUsed to find out or modify the available space found on the left of the text in the columns of a TreeView Table control.
BrowsedItemAllows you to find out and modify the item used for the automatic browse of TreeView Table controls.
SizeAllows you to find out and modify the number of columns in a TreeView Table control.
TotalsEnabledAllows you to find out the operating mode of automatic calculations in a TreeView Table control and to forbid or force the automatic calculations in a TreeView Table control.
To find out the entire list of WLanguage properties that can be used:
Minimum required version
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment