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 row content or the cell content
  • Value of a cell in the current row
  • Value of a cell in a specific row
  • Content of current row
  • Content of specific row
  • Operations on the tree structure
  • Collapsing all nodes of a TreeView Table control
  • Expanding all nodes of a TreeView Table control
  • Finding out the number of collapsed/expanded row
  • Defining the next status during an addition
  • Finding out and modifying the images of 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 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 control without additional programming. ..Modified is set to True.
  • by programming:
    • with TableModify or 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 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 column name (like for an edit control) to modify the column content. To modify a column of a specific row, the row number 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 control).
WINDEVWINDEV Mobile

Resuming the input in a column

ReturnToCapture can be used to resume edit mode 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:
  • add a column into a TreeView Table control with ControlClone.
  • delete a column from a TreeView Table control with ControlDelete.

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 the TreeView Table deletes all values of columns for this row.
  • The syntax used for TableDeleteChild is as follows:
    TableDeleteChild(<Name of TreeView Table>, <Subscript of parent element>)

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

Selecting a row

A row can be selected with TableSelectPlus.
The syntax used is:
TableSelectPlus(<Name of TreeView table>[, <Subscript>])

Retrieving the row content or the cell content

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 a TreeView Table control
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 row subscript 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 current row:
<Value> = <Name of TreeView Table>

Content of specific row

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

Collapsing all nodes of a TreeView Table control

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

Expanding all 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 uses delayed sublevel filling with ..AddChildDelayed, the sublevel filling procedure will be performed for each new expanded item.
New in version 19
WINDEV Note: If the TreeView Table control uses delayed sublevel filling with ..AddChildDelayed, the sublevel filling procedure will be performed for each new expanded item.
WINDEV Note: If the TreeView Table control uses delayed sublevel filling with ..AddChildDelayed, the sublevel filling procedure will be performed for each new expanded item.

Finding out the number of 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 rows

To find out and modify the images of rows in a TreeView Table control, use the following properties:
// Modify the images of rows in a TreeView Table control
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 located next to 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 text in the columns of 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