FAQ (exg2host)
Exontrol.COM Software - Frequently Asked Questions - ExG2Host Component
1:
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.
2:
The following VB sample displays a message box, before pressing the Delete key, and cancel the operation if user selects No or Cancel:
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = exHostKeyDown) Then
        If (vbKeyDelete = CInt(G2Host1.HostEventParam(0))) Then
            If Not (MsgBox("Do you want to delete?", vbYesNoCancel) = vbYes) Then
                G2Host1.HostEventParam(0) = 0
            End If
        End If
    End If
End Sub
You can disable completely deletion by removing the exHostAllowDelete flag from the HostReadOnly property.
3:
The ExG2Host is an extension of the ExG2antt ( Exontrol's Grid-Gantt component ) with full database support ( ADO, DAO, XML). In other words, the ExG2Host loads and saves automatically the host's data (including the hierarchy) to one or more databases. You can map a data field from the data-source, to a property of one object in the host/gantt control, and the control automatically updates the field when it is required.

Shortly, the ExG2Host uses the ExG2antt which means that if you buy ExG2Host library you automatically get the ExG2antt control as well.

See also: What is the difference between EXG2ANTT and EXGANTT controls?
4:
By default, the control creates an instance of ExG2antt type, and the Host property returns a reference to the newly created host. Shortly, the Host property supports all methods and properties listed here. In order to get the bar from the cursor, you have to use the BarFromPoint property of the Chart object.

The following VB sample sample just displays the bar's key as soon as the user clicks the control:

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = exHostClick) Then  ' Click
        MsgBox G2Host1.Host.Chart.BarFromPoint(-1, -1)
    End If
End Sub

The following MS Access sample sample just displays the bar's key as soon as the user clicks the control:

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As Long)
    If (EventID = exHostClick) Then   ' Click
        MsgBox G2Host1.Host.Chart.BarFromPoint(-1, -1)
    End If
End Sub

5:
Yes, it is possible. Before you continue, please make sure you check the following article: Shortly, you need to change the OLEDropMode property of the Host object, and handle the OLEStartDrag through the HostEvent event as in any of the following samples

The following VB sample starts OLE drag and drop as soon as user clicks and drags the item (for MS Access replace EXG2HOSTLibCtl.HostEventEnum with Long):

Private Sub Form_Load()
	G2Host1.Host.OLEDropMode = 1
End Sub

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	If EventID = 1002 Then  ' event OLEStartDrag (Data as ExDataObject, AllowedEffects as Long)
			G2Host1.HostEventParam(0).SetData ("some data to be dragged")
	End If
End Sub

The following VB sample displays information about the OLE Drag and Drop events (for MS Access replace EXG2HOSTLibCtl.HostEventEnum with Long):

Private Sub Form_Load()
    G2Host1.Host.OLEDropMode = 1
End Sub

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    ' displays information about OLE Drag and Drop events such as: OLEDragOver(1000), OLEDragDrop(1001), OLEStartDrag(1002), OLECompleteDrag(1003), OLEGiveFeedback(1004) and OLESetData(1005)
    If (EventID >= 1000) And (EventID <= 1005) Then
        Debug.Print G2Host1.HostEventParam(-2)
    End If
    If EventID = 1002 Then  ' event OLEStartDrag (Data as ExDataObject, AllowedEffects as Long)
        G2Host1.HostEventParam(0).SetData ("some data to be dragged")
    End If
End Sub

And the output may show as:
OLEStartDrag/1002( [Object] , =0 )
OLEDragOver/1000( [Object] , =1 , 1 , 0 , 18 , 121 , 0 )
OLEGiveFeedback/1004( 1 , =true )
OLEDragOver/1000( [Object] , =1 , 1 , 0 , 18 , 121 , 2 )
OLEGiveFeedback/1004( 1 , =true )
OLEDragOver/1000( [Object] , =1 , 1 , 0 , 18 , 121 , 2 )
OLEGiveFeedback/1004( 1 , =true )
OLEDragDrop/1001( [Object] , =1 , 0 , 0 , 18 , 121 )
OLECompleteDrag/1003( 1 )
that contains the name/identifier(parameters) of the inner event. For instance, "OLEDragDrop/1001( [Object] , =1 , 0 , 0 , 18 , 121 )" indicates the OLEDragDrop event, which IDentifier is 1001, and it has 6 parameters as follows: During the HostEvent event, you can use the HostEventParam(Parameter) to access a parameter giving its index. For instance, HostEventParam(0) gets the first-parameter (Data of ExDataObject type), while HostEventParam(1) gets the second parameter (Effect of Long type), and so on.

In conclusion, the following VB sample decodes the OLE Drag and Drop events, including their parameters (for MS Access replace EXG2HOSTLibCtl.HostEventEnum with Long):

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		With G2Host1
				Dim o As EXG2ANTTLibCtl.ExDataObject
				Select Case EventID
						Case 1000   ' event OLEDragOver (Data as ExDataObject, Effect as Long, Button as Integer, Shift as Integer, X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS, State as Integer)
								Debug.Print "OLEDragOver"
								Set o = .HostEventParam(0)
								Debug.Print "    Data: ", o.GetData(1)
								Debug.Print "    Effect: ", .HostEventParam(1)
								Debug.Print "    Button: ", .HostEventParam(2)
								Debug.Print "    Shift: ", .HostEventParam(3)
								Debug.Print "    X: ", .HostEventParam(4)
								Debug.Print "    Y: ", .HostEventParam(5)
								Debug.Print "    State: ", .HostEventParam(6)
						Case 1001   ' event OLEDragDrop (Data as ExDataObject, Effect as Long, Button as Integer, Shift as Integer, X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS)
								Debug.Print "OLEDragDrop"
								Set o = .HostEventParam(0)
								Debug.Print "    Data: ", o.GetData(1)
								Debug.Print "    Effect: ", .HostEventParam(1)
								Debug.Print "    Button: ", .HostEventParam(2)
								Debug.Print "    Shift: ", .HostEventParam(3)
								Debug.Print "    X: ", .HostEventParam(4)
								Debug.Print "    Y: ", .HostEventParam(5)
						Case 1002   ' event OLEStartDrag (Data as ExDataObject, AllowedEffects as Long)
								Debug.Print "OLEStartDrag"
								Set o = .HostEventParam(0)
								Debug.Print "    Data: ", o.Files.Count
								Debug.Print "    AllowedEffects: ", .HostEventParam(1)
								o.SetData ("some data to be dragged")
						Case 1003   ' event OLECompleteDrag (Effect as Long)
								Debug.Print "OLECompleteDrag"
								Debug.Print "    Effect: ", .HostEventParam(0)
						Case 1004   ' event OLEGiveFeedback (Effect as Long, DefaultCursors as Boolean)
								Debug.Print "OLEGiveFeedback"
								Debug.Print "    Effect: ", .HostEventParam(0)
								Debug.Print "    DefaultCursors: ", .HostEventParam(1)
						Case 1005   ' event OLESetData (Data as ExDataObject, Format as Integer)
								Debug.Print "OLESetData"
								Set o = .HostEventParam(0)
								Debug.Print "    Data: ", o.Files.Count
								Debug.Print "    Format: ", .HostEventParam(1)
				End Select
		End With
End Sub

6:

The solution is to handle the HostEvent and monitor the exHostOffsetChanged and exHostDateChange events for the host. Once any of these occur you should update the ScrollPos and Chart.FirstVisibleDate properties.

The following sample uses the Layout property to update these properties at once (see bellow for MS Access):

Dim iLayout As Long

Private Function getLayout(ByVal G As EXG2HOSTLibCtl.G2Host)
		With G.Host
				getLayout = "HScroll=" & .ScrollPos(False) & vbCrLf
				getLayout = getLayout & "VScroll=" & .ScrollPos(True) & vbCrLf
				getLayout = getLayout & "Chart.FirstVisibleDate=#" & .Chart.FirstVisibleDate & "#" & vbCrLf
		End With
End Function

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then G2Host2.Host.Layout = getLayout(G2Host1)
				iLayout = iLayout - 1
		End If
End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then G2Host1.Host.Layout = getLayout(G2Host2)
				iLayout = iLayout - 1
		End If
End Sub

Private Sub Form_Load()
		iLayout = 0
End Sub
The iLayout variable ensures that no recursively call occurs. The sample uses the Layout property, which saves or restores the control's UI layout. The same could be done if you call the ScrollPos or Chart.FirstVisibleDate separately as follows:
Dim iLayout As Long

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then
								With G2Host2.Host
										.ScrollPos(True) = G2Host1.Host.ScrollPos(True)
										.ScrollPos(False) = G2Host1.Host.ScrollPos(False)
										.Chart.FirstVisibleDate = G2Host1.Host.Chart.FirstVisibleDate
								End With
						End If
				iLayout = iLayout - 1
		End If
End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then
								With G2Host1.Host
										.ScrollPos(True) = G2Host2.Host.ScrollPos(True)
										.ScrollPos(False) = G2Host2.Host.ScrollPos(False)
										.Chart.FirstVisibleDate = G2Host2.Host.Chart.FirstVisibleDate
								End With
						End If
				iLayout = iLayout - 1
		End If
End Sub
The sample can be changed to syncronize the UI layout of both controls, as follows:
Dim iLayout As Long

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange Or EventID = exHostChartEndChanging) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then G2Host2.Host.Layout = G2Host1.Host.Layout
				iLayout = iLayout - 1
		End If
End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
		'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
		If (EventID = exHostOffsetChanged Or EventID = exHostDateChange Or EventID = exHostChartEndChanging) Then
				iLayout = iLayout + 1
						If (iLayout = 1) Then G2Host1.Host.Layout = G2Host2.Host.Layout
				iLayout = iLayout - 1
		End If
End Sub

Private Sub Form_Load()
		iLayout = 0
End Sub

The following sample uses the Layout property to update these properties at once (MS Access):

Dim iLayout As Long

Private Function getLayout(ByVal G As Object)
	With G.Host
		getLayout = "HScroll=" & .ScrollPos(False) & vbCrLf
		getLayout = getLayout & "VScroll=" & .ScrollPos(True) & vbCrLf
		getLayout = getLayout & "Chart.FirstVisibleDate=#" & .Chart.FirstVisibleDate & "#" & vbCrLf
	End With
End Function

Private Sub G2Host1_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then
			With G2Host2.Host
				.Layout = getLayout(G2Host1.Object)
			End With
		End If
		iLayout = iLayout - 1
	End If
End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then
			With G2Host1.Host
				.Layout = getLayout(G2Host2.Object)
			End With
		End If
		iLayout = iLayout - 1
	End If
End Sub

Private Sub Form_Load()
	iLayout = 0
End Sub
The iLayout variable ensures that no recursively call occurs. The sample uses the Layout property, which saves or restores the control's UI layout. The same could be done if you call the ScrollPos or Chart.FirstVisibleDate separately as follows:
Dim iLayout As Long

Private Sub G2Host1_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then
			With G2Host2.Host
				.ScrollPos(True) = G2Host1.Host.ScrollPos(True)
				.ScrollPos(False) = G2Host1.Host.ScrollPos(False)
				.Chart.FirstVisibleDate = G2Host1.Host.Chart.FirstVisibleDate
			End With
		End If
		iLayout = iLayout - 1
	End If
End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then
			With G2Host1.Host
				.ScrollPos(True) = G2Host2.Host.ScrollPos(True)
				.ScrollPos(False) = G2Host2.Host.ScrollPos(False)
				.Chart.FirstVisibleDate = G2Host2.Host.Chart.FirstVisibleDate
			End With
		End If
		iLayout = iLayout - 1
	End If
End Sub
The sample can be changed to syncronize the UI layout of both controls, as follows:
Dim iLayout As Long

Private Sub G2Host1_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host1.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange Or EventID = exHostChartEndChanging) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then G2Host2.Host.Layout = G2Host1.Host.Layout
		iLayout = iLayout - 1
	End If
End Sub

Private Sub G2Host1_Updated(Code As Integer)

End Sub

Private Sub G2Host2_HostEvent(ByVal EventID As Long)
	'Debug.Print G2Host2.HostEventParam(-2) ' displays information about the event
	If (EventID = exHostOffsetChanged Or EventID = exHostDateChange Or EventID = exHostChartEndChanging) Then
		iLayout = iLayout + 1
		If (iLayout = 1) Then G2Host1.Host.Layout = G2Host2.Host.Layout
		iLayout = iLayout - 1
	End If
End Sub

Private Sub Form_Load()
	iLayout = 0
End Sub
The Layout property saves or loads the control's UI layout, such as positions of the columns, scroll position, filtering values.
7:
Please check EXCustomPack that allows you to select up to five components.
8:
The HostEvent(exHostCreateBar) event is fired once the user creates a new task. The HostEventParam(0) defines the item that hosts the newly created bar. The HostDef(exNewTaskID) property gets the identifier of the key being newly created. For instance, the following sample changes properties of the newly created bar such as exBarColor:
Private Sub G2Host1_HostEvent(ByVal EventID As Long)
	If (EventID = exHostCreateBar) Then
			'MsgBox G2Host1.HostEventParam(-2)  ' displays information about the event
			With G2Host1
					Dim item As Long, key As Variant
					item = .HostEventParam(0)
					key = .HostDef(exNewTaskID)
					.HostDef(exTaskName) = "Progress"
					.Host.Items.AddBar item, .HostDef(exTaskName), .HostEventParam(1), .HostEventParam(2), key
					.Host.Items.ItemBar(item, key, 33) = RGB(0, 255, 0) ' exBarColor(33)
			End With
	End If
End Sub

The sample changes the bar's color (green) and type(progress) once the user creates the bar by drag and drop. The bar's color and type is saved into the database only if the exTasksColor and exTasksName options of DataField property are set as in the next sample. By default, the control automatically creates the new bar (while Host.AllowCreateBar property is exCreateBarAuto) right after the HostEvent(exHostCreateBar) event. You can change this behavior by setting the Host.AllowCreateBar property to exCreateBarManual, and so you have to add the bar during the HostEvent(exHostCreateBar) event.

With G2Host1
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksName) = "Name"
End With

where Color and Name are fields into Tasks table.

9:
The HostEvent(EventID) event occurs once the host-control (exg2antt) fires an event and before the control itself to handle the event. The HostEvent(-EventID) event (negative event) occurs once the host-control (exg2antt) fires an event and after the control itself handles the event (starting from version 19.0). Each event has different number of parameters, which is indicated by the HostEventParam(-1) property. Each parameter of the event can be accessed through the HostEventParam property. The HostEventParam(-2) gives a general information of the event. For instance, the HostEvent(-exHostCreateBar) event occurs once the user created the new-task by drag and drop. During the HostEvent(-exHostCreateBar) event you can access the newly created bar using the HostEventParam(0) that returns the handle of the item that hosts the item-bar, and HostDef(exNewTaskID) gets the key of the newly created bar.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = -exHostCreateBar) Then
        G2Host1.Host.Items.ItemBar(G2Host1.HostEventParam(0), G2Host1.HostDef(exNewTaskID), 33) = RGB(255, 0, 0)
    End If
End Sub
The sample changes the color for the newly created bar.
10:
The AutoSave property specifies the time in ms to perform saving, once the user changes the host. The Save method saves the control's data, while the HostDirty property is True. If no change occurs since last save, nothing will be saved.
Private Sub G2Host1_HostEvent(ByVal EventID As Long)
	If (EventID = -exHostCreateBar) Then
			With G2Host1
					.Object.Save
					MsgBox .Host.Items.ItemBar(0, "<*>", 256) & " " & .DataSource("Tasks").RecordCount
			End With
	End If
End Sub
The sample calls the Save method to update the changes into the associated recordset. Also, the sample displays the count of item-bars within the host and the records within the table that hosts the item-bars.
11:
By default, the user can automatically create new bars by dragging and dropping in the chart section of the control.

In order to create bar manually, you need to:

as in the following VB sample:

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = exHostCreateBar) Then
        With G2Host1
            .Host.Items.AddBar .HostEventParam(0), "Task", .HostEventParam(1), .HostEventParam(2)
        End With
    End If
End Sub

Private Sub Form_Load()
    With G2Host1
        .HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowDelete Or HostReadOnlyEnum.exHostAllowAddNewLink Or HostReadOnlyEnum.exHostAllowAddNewItem
        With .Host
            .BeginUpdate
            .Chart.PaneWidth(False) = 128
            .Chart.AllowCreateBar = -1
            With .Items
                .AddItem "Item 1"
                .AddItem "Item 2"
                .AddItem "Item 3"
            End With
            .EndUpdate
        End With
    End With
End Sub

Next, we'll modify the code (HostEvent) to enable adding new task bars exclusively for leaf items:

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = exHostCreateBar) Then
        With G2Host1
            Dim h As Long
            h = .HostEventParam(0)
            If (.Host.Items.ChildCount(h) = 0) Then
                .Host.Items.AddBar h, "Task", .HostEventParam(1), .HostEventParam(2)
            End If
        End With
    End If
End Sub

The sample checks the item if contains any child items using the Items.ChildCount property

12:
By default, a new task bar is created when the user clicks on the chart section of the control.

In order to prevent that, you need to:

as in the following VB sample:

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = exHostCreateBar) Then
        With G2Host1
            Dim h As Long, s As Date, e As Date
            h = .HostEventParam(0)
            s = .HostEventParam(1)
            e = .HostEventParam(2)
            If Not (s = e) Then
                .Host.Items.AddBar h, "Task", s, e
            End If
        End With
    End If
End Sub

Private Sub Form_Load()
    With G2Host1
        .HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowDelete Or HostReadOnlyEnum.exHostAllowAddNewLink Or HostReadOnlyEnum.exHostAllowAddNewItem
        With .Host
            .BeginUpdate
            .Chart.PaneWidth(False) = 128
            .Chart.AllowCreateBar = -1
            With .Items
                .AddItem "Item 1"
                .AddItem "Item 2"
                .AddItem "Item 3"
            End With
            .EndUpdate
        End With
    End With
End Sub

See also:

13:
By default, a column that displays the end margin of the task-bars uses the exBarEnd property of the item-bar, instead of exBarEndInclusive property.

In order to display the exBarEndInclusive property, you need:

as in the following VB sample:

Host.Columns(ID).Def(18) = 543

where

  • ID, is the index of the column (numeric), or a string value that specifies the caption or the key of the column to access
  • 18, is the identifier of the exCellValueToItemBarProperty option
  • 543, is the identifier of the exBarEndInclusive option (retrieves or sets a value that indicates the inclusive ending point of the bar. Generally, the inclusive ending point of the bar is exBarEnd - 1)
14:
By default, a new task bar is created when the user clicks on the chart section of the control. The following sample, show how you can prevent that while bars are automatically created (by default).

In order to prevent that, you need to:

  • remove the last created bar if the DateStart and DateEnd parameters are the same

as in the following VB sample:

Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
    If (EventID = -exHostCreateBar) Then
        With G2Host1
            If (.HostEventParam(2) - .HostEventParam(1) = 0) Then
                .Host.Items.RemoveBar .HostEventParam(0), .HostDef(exNewTaskID)
            End If
        End With
    End If
End Sub

Private Sub Form_Load()
    With G2Host1
        With .Host
            .BeginUpdate
            .Chart.PaneWidth(False) = 128
            With .Items
                .AddItem "Item 1"
                .AddItem "Item 2"
                .AddItem "Item 3"
            End With
            .EndUpdate
        End With
    End With
End Sub

See also:

15:
The HostReadOnly property allows you to retrieve or set a value of the HostReadOnlyEnum type, which includes bitwise flags to indicate the read-only status of the host. These flags define whether the host is in read-only mode, enabling flexible management of the host's read-only state based on specific configurations.

To exclude an option or flag, you cannot use the minus sign (-) as a flag operator. Instead, think of using bitwise logical operators:

AND (&): Use this when you want to combine conditions where both must be true. For example, if you want to find items that are both 1 and 4, you would use:

Example: 1 & 4 --- Only includes items where both bits are 1 (result is 0, since 0001 & 0100 = 0000).

OR (|): Use this to include options where at least one condition must be true. For instance, if you want items that are either 1 or 4, you would use:

Example: 1 | 4 --- Includes items that meet either criterion (result is 5, since 0001 | 0100 = 0101)

XOR (^): Use this to include options where you want either condition to be true but not both. If you want items that are either 1 or 4, but not both, you would use:

Example: 1 ^ 4 --- Includes items that meet one criterion but excludes those that meet both (result is 5, since 0001 ^ 0100 = 0101).

NOT (~): Use this to exclude a specific option, similar to flipping a bit to 0. If you want to include items that are 1 but not 4, you would use:

Example: 1 & ~4 --- Includes items that meet 1 and excludes any that are also 4 (result is 1, since 0001 & 1011 = 0001).

In summary, logical operators work like bitwise operators to effectively include or exclude options based on your requirements

In different programming languages, bitwise operators are used to manipulate individual bits within binary representations of numbers, but they can have different names or syntax. For example, in C/C++, Java, Python, Ruby, C#, Visual Basic 6 (VB6), and PowerBuilder, the bitwise operators for AND, OR, XOR, NOT, left shift, and right shift are represented by the symbols &, |, ^, ~, <<, and >>, respectively. In VB6, the symbols are And, Or, Xor, and Not, while it does not natively support left and right shift operations. In PowerBuilder, the operators are represented as & for AND, | for OR, and ^ for XOR. However, PowerBuilder does not support bitwise NOT, left shift, or right shift operations. While the symbols are generally consistent, it’s essential to refer to each language's documentation for specifics regarding their behavior, especially concerning signed and unsigned integers.

If you're still having difficulty working with flags, please open the ExHelper too, select "G2Host - Host Grid-Gantt ; exg2host.jsp", locate the HostReadOnly property in the control's browser, and review the options you need to include in the HostReadOnly property

16:

By default, the control uses the AllowCellValueToItemBar feature that connects cells in a data grid (like a table) to bars in a chart or visual representation. When this feature is enabled, it allows the following:

  1. Display of Information: Cells can show specific information, such as the start and end dates of a bar. For example, if a bar represents a project timeline, the cells might display the project's start and end dates.
  2. Automatic Updates: When the size or position of the bar changes—like if you resize it or move it—the information in the connected cells updates automatically to reflect those changes. This ensures that the data remains consistent.
  3. Interactive Changes: If you change the value in a cell (for instance, updating a date), the associated bar will also adjust itself. This means the bar will either resize or reposition itself based on the new value in the cell, maintaining the relationship between the two.

The Start and End columns display the margins of each single bar within an item host. These margins are specified by the Def(exCellValueToItemBarProperty) property of the column, which can include options such as exBarStart, exBarEnd, exBarName, exBarColor, and exBarCaption. For the dates to appear in the Start and End columns, the key of the bar must be empty; otherwise, no dates (or any item-bar property associated) will be shown

17:

Yes, you can add IntelliSense for the Host property by casting it to the IG2antt interface of ExG2antt control, as demonstrated in the following VB sample. To do this, you first need to ensure that you have added a reference to the 'ExG2antt 1.0 Control Library.' You can do this by navigating to Project > References in your development environment (VB).

Dim h As EXG2ANTTLib.IG2antt
Set h = G2Host1.Host

and you can use 'h' instead of 'Host', which this time includes all the definitions of the ExG2antt control, as shown in the following picture:

Previously, you must add a reference to "ExG2antt 1.0 Control Library", using Project\References.

How-To Questions
General Questions