ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Organization Chart control
  • Overview
  • Manipulating Organization Chart controls programmatically
  • Adding a root element
  • Adding child elements
  • Deleting an element
  • Manipulating an element in an Organization Chart control
  • Changing the orientation of an element
  • Properties specific to Organization Chart controls
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
An Organization Chart control can be:
  • manipulated programmatically.
  • linked to a data file.
WINDEV includes Organization Chart functions to programmatically manipulate Organization Chart controls.
This help page explains how to programmatically manipulate Organizational Chart controls.
Manipulating Organization Chart controls programmatically

Adding a root element

A root element of an organization chart is the element from which the entire tree structure is built. A "root" element can be added to an Organization Chart control with <Organization Chart>.Add.
This function accepts two syntaxes:
  • syntax for specifying element characteristics: title, image, etc, ...
    Example:
    // Ajoute un élément racine 
    ORGA_DRH.Ajoute("Emma Moutier")

    Note The <Organization Chart>.Add function inserts an image into the element (to the left of the text).
  • syntax that handles a variable of type OrgElement.
    // Ajout d'éléments dans le champ Organigramme
    // Elément Racine
    ElémentPDG is OrgElement
    ElémentPDG.Title = "Big Boss"
    ORGA_DIRECTION.Ajoute(ElémentPDG)

    Note Using the OrgElement type allows you to configure many specific options:
    • tooltip,
    • background color of the element,
    • background image of the element,
    • font of the title and content,
    • orientation of the element.

Adding child elements

Adding child elements into an Organization Chart control is performed by <Organization Chart>.AddChild. This function accepts two syntaxes:
  • syntax for specifying element characteristics: title, content, etc, ...
    ORGA_SansNom1.Ajoute("Emma")
    ORGA_SansNom1.AjouteFils(1, "Paul Moulin")
    ORGA_SansNom1.AjouteFils(1, "Florence Marcellin")
    ORGA_SansNom1.AjouteFils(3, "Gilles Preau")
    ORGA_SansNom1.AjouteFils(3, "Jérome Deschamps")
  • syntax that handles a variable of type OrgElement.
    // Add elements to the Organization Chart control
    // Root element
    ElementCEO is OrgElement
    ElementCEO.Title = "Big Boss"
    ORG_EXECUTIVE.Add(ElementCEO)
    
    // Child elements
    Element2 is OrgElement
    Element2.Title = "Production"
    ORG_EXECUTIVE.AddChild(1, Element2)
    
    Element3 is OrgElement
    Element3.Title = "Sales"
    ORG_EXECUTIVE.AddChild(1, Element3)

    The BackgroundColor property of the OrgElement variable is used to define the color used to display an element. If no background color is defined, the Organization Chart control will automatically use the default color.

Deleting an element

<Organization Chart>.Delete is used to delete an element (as well as its children) from an Organization Chart control.
// Supprime l'élément 15 et ses fils
ORGA_MonOrganigramme.Supprime(15)
<Organization Chart>.DeleteAll is used to delete all elements found in an Organization Chart control.
Manipulating an element in an Organization Chart control
The elements of an Organization Chart control are handled using their indexes. Each element of the Organization Chart control is associated with an identifier (index). This index is returned:
This index is used by all functions for handling elements (selection, deletion, etc.).
To handle or modify a specific element in the Organization Chart control, simply:
  • define a variable of type OrgElement.
  • assign the desired element of the Organizational Chart control to it.
Then, the element can be handled by the OrgElement properties.
For example:
MonElément is OrgElement 
MonElément = ORGA_MonOrganigramme[2]

Trace(MonElément.Title)

Changing the orientation of an element

To change the orientation of an element in the Organization Chart control, use the Orientation90 property of the OrgElement type. Therefore, a child element can be displayed on the right of its parent.
For example:
The following code is used to change the orientation of the element that was clicked:
// Sélection d'un élément de ORGA_SansNom1
MonElément is OrgElement 
MonElément = ORGA_SansNom1[ORGA_SansNom1]
MonElément.Orientation90 = NOT MonElément.Orientation90
ORGA_SansNom1[ORGA_SansNom1] <- MonElément
Properties specific to Organization Chart controls
The following properties are specific to programming Organization Chart control..
CountThe Count property returns the number of elements in a given set.
ElementHeightThe ElementHeight property is used to:
  • Find out or modify the height of the elements in an Organization Chart control.
  • Find out or modify the height of the cells in a Dashboard control.
ElementOrientationThe ElementOrientation property gets and sets the orientation of an Organization Chart control.
ElementWidthThe ElementWidth property is used to:
  • Find out or modify the width of the elements in an Organization Chart control.
  • Find out or modify the width of the cells in a Dashboard control.
MaxLeafPerRowThe MaxLeafPerRow property gets and sets the maximum number of elements in a row in an Organization Chart control.
VerticalThe Vertical property is used to:
  • determine if a control is oriented horizontally or vertically.
  • change the orientation of Table and Looper controls (switch from vertical to horizontal and conversely).
ZoomThe Zoom property gets or sets the zoom value:
  • in an Image control.
  • in a Map control.
  • in an Organization Chart control.
  • in a Table, TreeView Table, Pivot Table, Spreadsheet or List Box control.
  • in a Word Processing control.
  • in a PDF Reader control.
  • in a Camera control.
  • in a Diagram Editor control;
  • in a window.
For a complete list of WLanguage properties that can be used with Organization Chart controls, see Organization Chart control properties.
Minimum version required
  • Version 23
Comments
Click [Add] to post a comment

Last update: 09/26/2024

Send a report | Local help