PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Operating mode
  • Special cases
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
The AddChildDelayed property indicates the procedure to be called when a row in a TreeView or TreeView Table control is clicked to be expanded. This procedure is used to fill the expanded branches only.
Therefore, the procedure for filling the control can be optimized.
Remark: To optimize the filling of browsing TreeView and TreeView Table controls, check "Delayed fill of sub-levels (faster)" in the "Content" tab of the control description window.
Example
sDir is string = fListDirectory("C:", frNotRecursive)
FOR EACH STRING sADir OF sDir SEPARATED BY CR
nLine is int = TableAddLine(TVT_Explorer, sADir)
// If this directory has children
sChild is string = fListDirectory(sADir, frNotRecursive)
IF sChild <> "" THEN
// Call to the AddDirectory procedure
// when the user clicks [+]
TVT_Explorer[nLine].AddChildDelayed = AddDirectory
END
END
PROCEDURE AddDirectory(sParentID is string)
nSubscript is int
 
sParentDir is string = TVT_Explorer.COL_NoName1[sParentID]
sParentDir = Replace(sParentDir, TAB, fSep())
sDirList is string = fListDirectory(sParentDir, frNotRecursive)
nSubscript = Val(sParentID) + 1
nSubscript2 is int = nSubscript
FOR EACH STRING sDir OF sDirList SEPARATED BY CR
sID is string = Replace(sDir, "\", TAB)
TableAddChild(TVT_Explorer, nSubscript-1, sDir)
sSubDirList is string = fListDirectory(sDir, frNotRecursive)
IF sSubDirList <> "" THEN
TVT_Explorer[nSubscript2].AddChildDelayed = AddDirectory
END
nSubscript2 = nSubscript2 + 1
END
Syntax

Modifying the procedure to run Hide the details

<Element>.AddChildDelayed = <WLanguage procedure>
<Element>: Character string
Row of the Table or Treeview Table control to use.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure that will be run during the click on the element.
For TreeView controls, the procedure has the following format:
PROCEDURE <Procedure name>(<ParentPath> is string)
where <ParentPath> corresponds to the full path of the row to expand.
For TreeView Table controls, the procedure has the following format:
PROCEDURE <Procedure name>(<ParentID> is int)
where <ParentID> corresponds to the number of the row to expand.
If this parameter corresponds to an empty string (""), no procedure will be associated with the element.
Remarks

Operating mode

If the AddChildDelayed property corresponds to the name of a procedure::
  • a "+" sign is displayed on the row in the control.
  • the first time the user tries to expand the row (by clicking the "+" sign for example), the procedure is called, allowing to add child elements. Then, the branch is expanded.
    If no child element is added, the "+" sign is deleted from the element.
Once the procedure has been executed (the branch has been filled), an empty string is assigned to the AddChildDelayed property: it will not be run anymore.

Special cases

  • The specified procedure will be run BEFORE the "Collapsing, expanding a node" event of the control.
  • When the TableExpand or TreeExpand functions are called, if the specified branch has an associated procedure via the AddChildDelayed property, this procedure will be executed.
  • Versions 20 and later
    When the TableExpandAll or TreeExpandAll functions are called, if the specified branch and/or one of its children has an associated procedure via the AddChildDelayed property, this procedure will be executed.
    New in version 20
    When the TableExpandAll or TreeExpandAll functions are called, if the specified branch and/or one of its children has an associated procedure via the AddChildDelayed property, this procedure will be executed.
    When the TableExpandAll or TreeExpandAll functions are called, if the specified branch and/or one of its children has an associated procedure via the AddChildDelayed property, this procedure will be executed.
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment