featured products
exgrid excalendar exedit

How do you find the control's help / documentation on your computer:

Frequently Asked Questions - General

Click the programming language you use for general questions:

How-To Questions

Click the programming language you use for how-to questions:

Exontrol Software - ExOrgChart FAQ page

Frequently Asked Questions - ExOrgChart Component

Listed below are the questions that we are asked quite often. Before you write us, be sure to check here. 

Are you looking for something?

Just press CTRL+F ( or select Tab\Find menu item ) and you have a dialog that will help you to locate the string that are you looking for.

Where can I find the control's release notes?

The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link. 

Is there any property that changes the default paper size when using exPrint component?

The exPrint component uses the settings for default printer. Use your Control Panel/Printers to configure the settings for your default printer. 
  • From the Start menu, point to Settings, and then click Control Panel
  • Locate the Printers item and look for your default printer
  • Right click on your default printer, and select the Printing Preferences...
  • Select the orientation of the page and the paper size.
  • Click the Apply button

How can I set the maximum width of the chart to fit the control's client area?

The ZoomWidth property specifies a value indicating how large the chart will appear on horizontal axis. The ZoomWidthMode property specifies a value that indicates whether the ZoomWidth property is updated when the control is resized. The following sample resizes the chart to fit the client's area:
With ChartView1
        .BeginUpdate
            .ZoomWidthMode = exControlSize
            .ZoomHeightMode = exControlSize
        .EndUpdate
End With

How can I load the chart from my hierarchical table?

The Nodes.Add method inserts a node to the chart. For instance, using ADO, you can load a hierarchical table, if your table contains a field that identifies the key of the record ( "EmployeeID" ), and a field that holds the key to the parent record ( "ReportsTo" ), like in the following sample:   
Option Explicit

Private Sub Form_Load()
    Dim i As Long
    Dim rs As Object, t As IPictureDisp
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open "Select * From Employees", _
            "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\sample.mdb", _
            3
   
    With ChartView1
        .BeginUpdate
        While Not rs.EOF()
            With .Nodes
                With .Add(getInfo(rs), rs("ReportsTo").Value, rs("EmployeeID").Value)
                    .ToolTip = rs("Notes") + "<br><upline><dotline><r><b>" + _
                               rs("FirstName") + " " + rs("LastName") + "<b>"
                End With
            End With
            rs.MoveNext
        Wend
        .EndUpdate
    End With
    Exit Sub
End Sub

Private Function getInfo(ByVal r As Object) As String
    getInfo = r("TitleOfCourtesy") + " <b><fgcolor=000080>" + r("FirstName") + _
              " " + r("LastName") + "</fgcolor></b><br>" + _
              r("Title") + "<br><upline><dotline>" + _
              r("City") + "<br> " + r("Address")
End Function

Is there any print and print preview support?

Yes, the Exontrol ExPrint component ( exprint.dll ) provides Print and Print Preview capabilities for the exOrgChart component. Once that you can have the exPrint component in your Components list, insert a new instance of "ExPrint 1.0 Control Library" to your form and add the following code:

Private Sub Command1_Click()
    With Print1
        Set .PrintExt = ChartView1.Object
        .Preview
    End With
End Sub

The Exontrol Print Preview mainframe looks like follows:

The exPrint component is free of charge, if you are registered user of the exOrgChart component.

The following VB sample opens the Print Preview frame:

With Print1
    Set .PrintExt = ChartView1.Object
    .Preview
End With

The following C++ sample opens the Print Preview frame:

m_print.SetPrintExt( m_chartview.GetControlUnknown() );
m_print.Preview();

The following VB.NET sample opens the Print Preview frame:

With AxPrint1
    .PrintExt = AxChartView1.GetOcx()
    .Preview()
End With

The following C# sample opens the Print Preview frame:

axPrint1.PrintExt = axChartView1.GetOcx();
axPrint1.Preview();

The following VFP sample opens the Print Preview frame:

with thisform.Print1.Object
    .PrintExt = thisform.ChartView1.Object
    .Preview()
endwith

Can I add nodes at design mode?

Yes. The exOrgChart component provides WYSWYG Template/Layout Editor that helps you to initialize the control at design mode. In design mode, select 'Properties' item from object's context menu. A template file is a collection of instructions that control loads at runtime. In other words the template file holds a collection of properties and their values, methods and objects, into a TEXT file. The template file combines XML style with something close to VBScript. We call it X-Script. It is important to specify that the editor and the X-Script DO NOT USE any external VB script engine, Active script engine, XML parser or DOM. The X-Script was implemented from scratch as lite as possible to let users customize the control in design mode no matter what programming languages they are using. The template files are the same for any programming language, and do the same thing for all! For instance, you can copy and paste the template file from a VFP control to a C++ control! The editor automatically updates the control's look and feel while you are editing the template file. This way you can learn easy how a property or a method reacts! Also, the editor provides a type library context menu that helps you to find quickly a property ( CTRL + SPACE invokes it )

The following template loads nodes at design mode:

BeginUpdate
Root
{
	ForeColor = RGB(0,0,255)
	BackColor = RGB(255,255,0)
	Caption = "<r><dotline><b>CObject</b><br>CObject is the principal base class for the Microsoft Foundation Class Library.<br><upline><dotline>Methods:<r>4"
	Image = 1
}
Nodes
{
	Add("<r><dotline><b>CCmdTarget</b><br>CCmdTarget is the base class for the Microsoft Foundation Class Library message-map architecture.<br><upline><dotline>Methods:<r>14",,"target") 
	{
		ForeColor = RGB(0,0,255)
		BackColor = RGB(255,255,0)
	}
	Add("<r><dotline><b>CWnd</b><br>This class provides the base functionality for all window classes in MFC.<br><upline><dotline>Methods:<r>18","target","wnd")
	Add("<r><dotline><b>CControlBar</b><br>CControlBar is the base class for the control-bar classes CStatusBar, CToolBar, CDialogBar, CReBar, and COleResizeBar.<br><upline><dotline>Methods:<r>18","wnd","cb")
	Add("<r><dotline><b>CDialogBar</b><br>The CDialogBar class provides the functionality of a Windows modeless dialog box in a control bar.<br><upline><dotline>Methods:<r>18","cb","db")
	Add("<r><dotline><b>CDialog</b><br>This class provides the base functionality for all dialog classes in MFC.<br><upline><dotline>Methods:<r>18","wnd","dialog")
	Add("<r><dotline>Exceptions<br>Exceptions occur when a program executes abnormally because of conditions outside the program's control.",,"exceptions") 
	Add("<r><dotline>Graphichal Drawing Objects<br>Windows provides a variety of drawing tools to use in device contexts.",,"gdi") .Width = 255
	Add("<r><dotline>Syncronization<br>Classes that use arrays can also implement their own synchronization using the SyncRoot property..",,"sync") 
}
EndUpdate

Is there any option to copy the control's content to a Microsoft Word document?

The user can copy the control's content to the clipboard by pressing the CTRL + C key. For instance, if you want to include the control's content to a Microsoft Word document, you have to copy the control's content and paste it in the document. Use the Copy method to programmatically copy the control's content to the cliboard.

The connection between the nodes and their parent seems to be hidden on the left side. What I am doing wrong? 

By default, the control provides properties like BorderWidth property and BorderHeight property to specify the size of the borders inside the control's client area. Please make sure that BorderWidth property is not 0. If it is 0 it is possible that the link between the nodes and their parent to be hidden depending on the nodes content.

Is there any option to assign a new root with a new key?

By default, the control's Root has no key associated. Thought you can add a new node as child of the root object and to use the ExplorerFromNode property to assign a new displayed root. The following sample displays a new root for your control:
Private Sub Form_Load()
    With ChartView1
        .Nodes.Add "NewRoot", , "newRoot"
        
        .ExploreFromNode = "newRoot"
        
        .Nodes.Add "Child 1", "newRoot", "child_1"
        .Nodes.Add "Child 2", "newRoot", "child_2"
        
    End With
End Sub   

Also, you can use the Key property to change the node's key.

How can I align horizontally my child nodes?

The Node object provides a property ArrangeSiblingNodesAs that helps you to specify how the child nodes are arranged on the page. By default, the control arranges vertically the child nodes.

Is it possible to connect node to more then one parent?

The LinkTo property links a node with any other nodes. The LinkTo property indicates the list of nodes separated by comma character.

Is there any property to save the control's data?

The control provides the SaveXML method that saves the control's data to XML document. Use the LoadXML method to load XML documents saved using the SaveXML method. The SaveXML method may save data to a file , an XML document object, or a custom object that supports persistence like described here:
  • String - Specifies the file name. Note that this must be a file name, rather than a URL. The file is created if necessary and the contents are entirely replaced with the contents of the saved document. For example:

    G2antt1.SaveXML("sample.xml")

  • XML Document Object. For example:

    Dim xmldoc as Object
    Set xmldoc = CreateObject("MSXML.DOMDocument")
    G2antt1.SaveXML(xmldoc)

  • Custom object supporting persistence - Any other custom COM object that supports QueryInterface for IStream, IPersistStream, or IPersistStreamInit can also be provided here and the document will be saved accordingly. In the IStream case, the IStream::Write method will be called as it saves the document; in the IPersistStream case, IPersistStream::Load will be called with an IStream that supports the Read, Seek, and Stat methods

How can I insert a hyperlink?

Use the <a> anchor element in Caption property of the Node, or when inserting a node using the Add method. The control fires the AnchorClick event when the user clicks an anchor element. Use the ShowToolTip property to programmatically show a tooltip for specified anchor element.

Is there any option to display the child nodes as a tree, so they are indented relative to the parent nodes?

Use the ArrangeSiblingNodesAs property on exTree, and so the child nodes are arranged as a tree, each child nodes is indented relative to the parent node.

The exception "Failed to add a new node" is fired when trying to run your samples?

The exception may occurs if not using the RuntimeKey as explained in the redist.txt file that was provided to you at the time you received the registration e-mail. 

Here's the snippet of code you need to add to your code/sample:

VB.NET
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		exontrol.EXORGCHARTLib.exorgchart.RuntimeKey = "your runtime license key"
	End Sub

C#
        public Form1()
        {
            exontrol.EXORGCHARTLib.chartview.RuntimeKey = "your runtime license key";
            InitializeComponent();
        }

or

        private void Form1_Load(object sender, EventArgs e)
        {
            exontrol.EXORGCHARTLib.chartview.RuntimeKey = "your runtime license key";
        }

Where the "your runtime license key" can be found on your registration e-mail. This is related to the "stop working after" note.

I was wondering what event is fired and what value is returned when the user moves a node and drops it as a child to another node. I need to update the underlying table used to generate the chart.

You need to store the node from cursor using NodeFromPoint property during LayoutStartChanging event and update the node's new Parent property in LayoutEndChanging event as shown in the following VB sample:
Private sNode As EXORGCHARTLibCtl.Node

Private Sub ChartView1_LayoutStartChanging(ByVal Operation As EXORGCHARTLibCtl.LayoutChangingEnum)
    If (Operation = exMoveNode) Then
        Set sNode = ChartView1.NodeFromPoint(-1, -1)
    End If
End Sub

Private Sub ChartView1_LayoutEndChanging(ByVal Operation As EXORGCHARTLibCtl.LayoutChangingEnum)
    If (Operation = exMoveNode) Then
        If Not (sNode Is Nothing) Then
            Debug.Print "The current node moved to " & sNode.Parent.Caption
        End If
        Set sNode = Nothing
    End If
End Sub

The LayoutEndChanging(exMoveNode) event notifies your application once the user ends the moving operation/drop event.

Is there any Fit-To-Page option for print and print preview?

The Exontrol ExPrint component ( exprint.dll ) provides Print and Print Preview capabilities for the Exontrol ExOrgChart component.

The requirements for the FitToPage option:

  • Exontrol.ExPrint version 5.2 ( or greater )

  • Exontrol.ExOrgChart version 7.1 ( or greater )

The FitToPage option could be one of the following:

  • On, (Fit-To-Page) the control's content is printed to a single page ( version 6.1 )
  • p%, (Adjust-To) where p is a positive number that indicates the percent from normal size to adjust to. For instance, the "FitToPage = 50%" adjusts the control's content to 50% from normal size. ( version 8.1 )
  • w x, (Fit-To Wide) where w is a positive number that indicates that the control's content fits w pages wide by how many pages tall are required. For instance, "FitToPage = 3 x" fits the control's content to 3 pages wide by how many pages tall is are required. ( version 8.1 )
  • x t, (Fit-To Tall) where t is a positive number that specifies that the control's content fits t pages tall by how many pages wide are required. For instance, "FitToPage = x 2" fits the control's content to 2 pages tall by how many pages wide are required. ( version 8.1 )
  • w x t, (Fit-To) where w and t are positive numbers that specifies that the control's content fits w pages wide by t pages tall. For instance, "FitToPage = 3 x 2" fits the control's content to 3 pages wide by 2 pages tall. ( version 8.1 )

The following VB6 sample shows how to show the eXList/COM's content to one page when print or print preview the component:

Private Sub Command1_Click()
    With Print1
        .Options = "FitToPage = On"
        Set .PrintExt = ChartView1.Object
        .Preview
    End With
End Sub

The following VB/NET sample shows how to show the eXList/NET's content to one page when print or print preview the component:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    With Exprint1
        .Options = "FitToPage = On"
        .PrintExt = ExchartView1
        .Preview()
    End With
End Sub

Is there a way to calculate the hierarchical level of a node? root is level 1, all childs of root are at levels 2 etc?

The Parent property of the Node returns the node's parent if exists or nothing if the node is the root object or has no parent. The following sample uses the Parent property to calculate the node's level/
Private Function Level(ByVal n As EXORGCHARTLibCtl.Node) As Integer
    Dim nLevel As Integer
    While Not n Is Nothing
        nLevel = nLevel + 1
        Set n = n.Parent
    Wend
    Level = nLevel
End Function