event ItemOleEvent (Item as HITEM, Ev as OleEvent)
Fired when an ActiveX control hosted by an item has fired an event.

TypeDescription
Item as HITEM Specifies the handle of the item that contains the ActiveX control
Ev as OleEvent A OleEvent object that contains information about the event.
The Exontrol's ExGrid control supports ActiveX hosting. The InsertItemControl method inserts an item that hosts an ActiveX control. The ItemOleEvent event notifies your application that a hosted ActiveX control fires an event. The ItemObject property gets the ActiveX object hosted by an item that is inserted using the InsertControlItem method. The ItemObject property gets nothing if the item doesn't host an ActiveX control, or if inserting an ActiveX control failed ).

Syntax for ItemOleEvent event, /NET version, on:

private void ItemOleEvent(object sender,int Item,exontrol.EXGRIDLib.OleEvent Ev)
{
}

Private Sub ItemOleEvent(ByVal sender As System.Object,ByVal Item As Integer,ByVal Ev As exontrol.EXGRIDLib.OleEvent) Handles ItemOleEvent
End Sub

Syntax for ItemOleEvent event, /COM version, on:

private void ItemOleEvent(object sender, AxEXGRIDLib._IGridEvents_ItemOleEventEvent e)
{
}

void OnItemOleEvent(long Item,LPDISPATCH Ev)
{
}

void __fastcall ItemOleEvent(TObject *Sender,Exgridlib_tlb::HITEM Item,Exgridlib_tlb::IOleEvent *Ev)
{
}

procedure ItemOleEvent(ASender: TObject; Item : HITEM;Ev : IOleEvent);
begin
end;

procedure ItemOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ItemOleEventEvent);
begin
end;

begin event ItemOleEvent(long Item,oleobject Ev)
end event ItemOleEvent

Private Sub ItemOleEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_ItemOleEventEvent) Handles ItemOleEvent
End Sub

Private Sub ItemOleEvent(ByVal Item As EXGRIDLibCtl.HITEM,ByVal Ev As EXGRIDLibCtl.IOleEvent)
End Sub

Private Sub ItemOleEvent(ByVal Item As Long,ByVal Ev As Object)
End Sub

LPARAMETERS Item,Ev

PROCEDURE OnItemOleEvent(oGrid,Item,Ev)
RETURN

Syntax for ItemOleEvent event, /COM version (others), on:

<SCRIPT EVENT="ItemOleEvent(Item,Ev)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function ItemOleEvent(Item,Ev)
End Function
</SCRIPT>

Procedure OnComItemOleEvent HITEM llItem Variant llEv
	Forward Send OnComItemOleEvent llItem llEv
End_Procedure

METHOD OCX_ItemOleEvent(Item,Ev) CLASS MainDialog
RETURN NIL

void onEvent_ItemOleEvent(int _Item,COM _Ev)
{
}

function ItemOleEvent as v (Item as OLE::Exontrol.Grid.1::HITEM,Ev as OLE::Exontrol.Grid.1::IOleEvent)
end function

function nativeObject_ItemOleEvent(Item,Ev)
return

The following VB sample adds an item that hosts the Exontrol Calendar Control and prints each event fired by that ActiveX control:

Grid1.Items.ItemHeight(Grid1.Items.InsertControlItem(, "Exontrol.Calendar")) = 256
Private Sub Grid1_ItemOleEvent(ByVal Item As EXGRIDLibCtl.HITEM, ByVal Ev As EXGRIDLibCtl.IOleEvent)
    Debug.Print "Event name:" & Ev.Name
    If (Ev.CountParam = 0) Then
        Debug.Print "The event has no arguments."
    Else
        Debug.Print "The event has the following arguments:"
        Dim i As Long
        For i = 0 To Ev.CountParam - 1
            Debug.Print Ev(i).Name; " = " & Ev(i).Value
        Next
    End If
End Sub
The following VB6 sample shows you how to handle an event from a outer-inner-inner control. In other words, you have a master control (outer), which insert another control (inner), which insert another control (inner). 
Private Sub expandItem(ByVal grid As Object, ByVal item As Long, ByVal level As Long)
    Debug.Print "Expand item in " & level & " control"
End Sub

' BeforeExpandItem event - Fired before an item is about to be expanded (collapsed).
Private Sub Grid1_BeforeExpandItem(ByVal item As EXGRIDLibCtl.HITEM, Cancel As Variant)
    expandItem Grid1.Object, item, 0
End Sub

' ItemOleEvent event - Fired when an ActiveX control hosted by an item has fired an event.
Private Sub Grid1_ItemOleEvent(ByVal item As EXGRIDLibCtl.HITEM, ByVal Ev As EXGRIDLibCtl.IOleEvent)
    With Grid1
        'Debug.Print Ev.ToString()
        If (Ev.ID = 12) Then   ' BeforeExpandItem
            expandItem Grid1.Items.ItemObject(item), Ev.Param(0).Value, 1
        Else
            If (Ev.ID = 14) Then   ' ItemOLEEvent
                'Debug.Print Ev.Param(1).Value.ToString()
                If (Ev.Param(1).Value.ID = 12) Then    ' BeforeExpandItem
                    'Debug.Print "Expand item in inner-inner control"
                    expandItem Grid1.Items.ItemObject(item).Items.ItemObject(Ev.Param(0).Value), Ev.Param(1).Value.Param(0).Value, 2
                End If
            End If
        End If
    End With
End Sub

This technique can be applied to ANY other event of the control, so you have a single function to be used when different events are fired.

The following C++ sample displays the events that an ActiveX control is firing while it is hosted by an item:

 #import <exgrid.dll> rename( "GetItems", "exGetItems" )

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

void OnItemOleEventGrid1(long Item, LPDISPATCH Ev) 
{
	EXGRIDLib::IOleEventPtr spEvent( Ev );
	CString strOutput;
	strOutput.Format( "Event's name: %s\n", spEvent->Name.operator const char *() );
	OutputDebugString( strOutput ); 
	if ( spEvent->CountParam == 0 )
		OutputDebugString( "The event has no parameters." ); 
	else
	{
		for ( long i = 0; i < spEvent->CountParam; i++ )
		{
			EXGRIDLib::IOleEventParamPtr spParam = spEvent->GetParam( COleVariant( i ) );
			strOutput.Format( "Name: %s, Value: %s\n", spParam->Name.operator const char *(), V2S( &spParam->Value ) );
			OutputDebugString( strOutput ); 
		}
	}
	OutputDebugString( "" ); 
}

The #import clause is required to get the wrapper classes for IOleEvent and IOleEventParam objects, that are not defined by the MFC class wizard. The same #import statement defines the EXGRIDLib namespace that include all objects and types of the control's TypeLibrary. In case your exgrid.dll library is located to another place than the system folder or well known path, the path to the library should be provided, in order to let the VC finds the type library.  

The following VB.NET sample displays the events that an ActiveX control is firing while it is hosted by an item:

Private Sub AxGrid1_ItemOleEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_ItemOleEventEvent) Handles AxGrid1.ItemOleEvent
    Debug.WriteLine("Event's name: " & e.ev.Name)
    Dim i As Long
    For i = 0 To e.ev.CountParam - 1
        Dim eP As EXGRIDLib.OleEventParam
        eP = e.ev(i)
        Debug.WriteLine("Name: " & e.ev.Name & " Value: " & eP.Value)
    Next
End Sub

The following C# sample displays the events that an ActiveX control is firing while it is hosted by an item:

private void axGrid1_ItemOleEvent(object sender, AxEXGRIDLib._IGridEvents_ItemOleEventEvent e)
{
	System.Diagnostics.Debug.WriteLine( "Event's name: " + e.ev.Name.ToString() );
	for ( int i= 0; i < e.ev.CountParam ; i++ )
	{
		EXGRIDLib.IOleEventParam evP = e.ev[i];
		System.Diagnostics.Debug.WriteLine( "Name: " + evP.Name.ToString() + ", Value: " + evP.Value.ToString() );
	}
}

The following VFP sample displays the events that an ActiveX control fires when it is hosted by an item:

*** ActiveX Control Event ***
LPARAMETERS item, ev

local s
s = "Event's name: " + ev.Name
for i = 0 to ev.CountParam - 1
		s = s +  "Name: " + ev.Param(i).Name + " ,Value: " + Str(ev.Param(i).Value)
endfor
wait window nowait s