PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • 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 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 the nodes of a TreeView Table control
  • Expanding all the 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 through programming.
Do not hesitate to see the documentation about these functions. For more details, see list of functions for managing the TreeView Table controls.
Versions 18 and later
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for WEBDEV sites.
PHP The TreeView Table control is now available for PHP sites.
New in version 18
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for WEBDEV sites.
PHP The TreeView Table control is now available for PHP sites.
WEBDEV - Server codeWindowsLinux The TreeView Table control is now available for WEBDEV sites.
PHP The TreeView Table control is now available for PHP sites.
Initializing a TreeView Table control
To populate a TreeView Table control programmatically, 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 New property is set to True (otherwise, it is set to False).
Versions 19 and later
WINDEV Remark: To properly fill a TreeView Table control, you can use the AddChildDelayed property on the rows of the 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 the AddChildDelayed property.
  • When the user clicks the element on the first level to expand it, the procedure defined by the AddChildDelayed property is executed. 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 Remark: To properly fill a TreeView Table control, you can use the AddChildDelayed property on the rows of the 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 the AddChildDelayed property.
  • When the user clicks the element on the first level to expand it, the procedure defined by the AddChildDelayed property is executed. This procedure fills the level to expand. The search for children is performed only when the user wants to see them.
WINDEV Remark: To properly fill a TreeView Table control, you can use the AddChildDelayed property on the rows of the 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 the AddChildDelayed property.
  • When the user clicks the element on the first level to expand it, the procedure defined by the AddChildDelayed property is executed. 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 Remark: 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. The Empty property 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. The Modified property is set to True.
  • through programming:
    • with TableModify or TableModifyLine to modify the content of the current row or the content of a given row.
      For example:
      TVT_CUSTOMER.Modify("MOORE" + TAB + "Vince" + TAB + "Miami")

      Remark: You can also 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
      COL_DAY.Modify("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 (index).
      For example:
      COL_NAME[Index] = CustomerName

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

      The Modified property is set to False (it is set to True only when data is entered in the TreeView Table control).
WINDEV

Resuming input in a column

SetFocusAndReturnToUserInput can be used to resume input in a column, on the current row. For example:
// Event "Entry in" COL_QTY
// COL_QTY cannot be entered if COL_PRODUCT is not entered
IF NoSpace(COL_PRODUCT) = "" THEN
Error("The Product column must be entered first")
SetFocusAndReturnToUserInput(COL_PRODUCT)
END
WINDEV

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 event "Displaying a table row" of a Table control. For example:
// COL_PBT: calculated column
// COL_UPBT and COL_QTY: columns linked to memory areas
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:
    <TreeView Table control>.Delete([<Index>])

    If the index is specified, TableDelete deletes the row that corresponds to that index. 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:
    <TreeView Table control>.DeleteChild(<Parent element index>)

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

Selecting a row

A row can be selected with TableSelectPlus.
The following syntax is used:
<TreeView Table control>.SelectPlus([, <Index>])

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 index must be specified:
<Value> = <Column name>[<Index>]
For example:
// Add the total price before tax (PBT) for all the order lines
TotalPrice = 0
FOR Index = 1 TO TVT_ORDER.Count
TotalPrice = TotalPrice + COL_PBT[Index]
END

Content of current row

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

Content of specific row

To retrieve the content of the row whose index is <Index>:
<Value> = <TreeView Table control>[<Index>]

Remark: the index 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[TVT_CUSTOMER.Select()]
// Retrieve the content from the current row of the TVT_CUSTOMER TreeView Table control
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 syntax used is:
<TreeView Table control>.CollapseAll()

Expanding all the nodes of a Treeview Table control

To expand all the nodes of a TreeView Table control, use TableExpandAll. The following syntax is used:
<TreeView Table control>.ExpandAll()
Versions 19 and later
WINDEV Remark: If a delayed sub-level fill mode is enabled on a TreeView Table control via the AddChildDelayed property, the sub-level fill procedure will be executed for each new element expanded.
New in version 19
WINDEV Remark: If a delayed sub-level fill mode is enabled on a TreeView Table control via the AddChildDelayed property, the sub-level fill procedure will be executed for each new element expanded.
WINDEV Remark: If a delayed sub-level fill mode is enabled on a TreeView Table control via the AddChildDelayed property, the sub-level fill procedure will be executed for each new element expanded.

Finding out the number of collapsed/expanded row

To get the number of the row that is expanded or collapsed, simply use the "Collapsed, expanded" code of a node in the TreeView Table control:
// Which row is used?
Info(TVT_TreeviewTable[TVT_TreeviewTable])

Defining the next status during an addition

You can define the state of the next row that will be added to a TreeView Table control, (collapsed//expanded). To do so, use the Collapsed property.
// 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 = "OpenFolder.gif"
TVT_TreeViewTable.CollapsedImage = "ClosedFolder.gif"
WINDEV

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.
The Caption property of the row is used to get and change the text displayed next to the check box. The Value property of the row is used to get and change 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 through 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.
CollapsedDefines the state (collapsed or expanded) of new rows added to 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 get and change the default image of an expanded row in a TreeView Table control.
CollapsedImageUsed to get and change the default image of a collapsed row in a TreeView Table control.
Multi-selectionUsed 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 determine and change the sort options defined for a column in a 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.

For a complete list of WLanguage properties that can be used:
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment