event UserEditorOleEvent (Object as Object, Ev as OleEvent, ByRef CloseEditor as Boolean, Item as HITEM, ColIndex as Long)
Occurs when an user editor fires an event.

TypeDescription
Object as Object An object created by the UserEditor property.
Ev as OleEvent An OleEvent object that holds information about the event 
CloseEditor as Boolean (By Reference) A boolean expression that indicates whether the control should close the user editor.
Item as HITEM A long expression that determines the item's handle. If the Item parameter is 0, and the ColIndex property is different than zero, the ColIndex indicates the handle of the cell where the state is changed.
ColIndex as Long A long expression that indicates the column's index, if the Item parameter is not zero, a long expression that indicates the handle of the cell if the Item parameter is 0.

The UserEditorOleEvent is fired every time when an user editor object fires an event. The information about fired event is stored in the Ev parameter. The CloseEditor parameter is useful to inform the control when the editor should be hidden, on certain events. The control fires the UserEditorOpen event when a ActiveX editor is about to be shown. The control fires the UserEditorClose event when the user editor is hidden.

Syntax for UserEditorOleEvent event, /NET version, on:

private void UserEditorOleEvent(object sender,object Obj,exontrol.EXGRIDLib.OleEvent Ev,ref bool CloseEditor,int Item,int ColIndex)
{
}

Private Sub UserEditorOleEvent(ByVal sender As System.Object,ByVal Obj As Object,ByVal Ev As exontrol.EXGRIDLib.OleEvent,ByRef CloseEditor As Boolean,ByVal Item As Integer,ByVal ColIndex As Integer) Handles UserEditorOleEvent
End Sub

Syntax for UserEditorOleEvent event, /COM version, on:

private void UserEditorOleEvent(object sender, AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent e)
{
}

void OnUserEditorOleEvent(LPDISPATCH Object,LPDISPATCH Ev,BOOL FAR* CloseEditor,long Item,long ColIndex)
{
}

void __fastcall UserEditorOleEvent(TObject *Sender,IDispatch *Object,Exgridlib_tlb::IOleEvent *Ev,VARIANT_BOOL * CloseEditor,Exgridlib_tlb::HITEM Item,long ColIndex)
{
}

procedure UserEditorOleEvent(ASender: TObject; Object : IDispatch;Ev : IOleEvent;var CloseEditor : WordBool;Item : HITEM;ColIndex : Integer);
begin
end;

procedure UserEditorOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent);
begin
end;

begin event UserEditorOleEvent(oleobject Object,oleobject Ev,boolean CloseEditor,long Item,long ColIndex)
end event UserEditorOleEvent

Private Sub UserEditorOleEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent) Handles UserEditorOleEvent
End Sub

Private Sub UserEditorOleEvent(ByVal Object As Object,ByVal Ev As EXGRIDLibCtl.IOleEvent,CloseEditor As Boolean,ByVal Item As EXGRIDLibCtl.HITEM,ByVal ColIndex As Long)
End Sub

Private Sub UserEditorOleEvent(ByVal Object As Object,ByVal Ev As Object,CloseEditor As Boolean,ByVal Item As Long,ByVal ColIndex As Long)
End Sub

LPARAMETERS Object,Ev,CloseEditor,Item,ColIndex

PROCEDURE OnUserEditorOleEvent(oGrid,Object,Ev,CloseEditor,Item,ColIndex)
RETURN

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

<SCRIPT EVENT="UserEditorOleEvent(Object,Ev,CloseEditor,Item,ColIndex)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function UserEditorOleEvent(Object,Ev,CloseEditor,Item,ColIndex)
End Function
</SCRIPT>

Procedure OnComUserEditorOleEvent Variant llObject Variant llEv Boolean llCloseEditor HITEM llItem Integer llColIndex
	Forward Send OnComUserEditorOleEvent llObject llEv llCloseEditor llItem llColIndex
End_Procedure

METHOD OCX_UserEditorOleEvent(Object,Ev,CloseEditor,Item,ColIndex) CLASS MainDialog
RETURN NIL

void onEvent_UserEditorOleEvent(COM _Object,COM _Ev,COMVariant /*bool*/ _CloseEditor,int _Item,int _ColIndex)
{
}

function UserEditorOleEvent as v (Object as P,Ev as OLE::Exontrol.Grid.1::IOleEvent,CloseEditor as L,Item as OLE::Exontrol.Grid.1::HITEM,ColIndex as N)
end function

function nativeObject_UserEditorOleEvent(Object,Ev,CloseEditor,Item,ColIndex)
return

The following VB sample closes the editor and focus a new column when the user presses the TAB key:

Private Sub Grid1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXGRIDLibCtl.IOleEvent, CloseEditor As Boolean, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
    If (Ev.Name = "KeyDown") Then
        Dim iKey As Long
        iKey = Ev(0).Value
        If iKey = vbKeyTab Then
            With Grid1
                CloseEditor = True
                .FocusColumnIndex = .FocusColumnIndex + 1
                .SearchColumnIndex = .FocusColumnIndex
            End With
        End If
    End If
End Sub 

The following VB sample closes the Exontrol.ComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the cell in the control:

Private Sub Grid1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXGRIDLibCtl.IOleEvent, CloseEditor As Boolean, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
    ' Closes the Exontrol.ComboBox when user changes the value in the control
    If nEvents = 0 Then
        If (Ev.Name = "Change") Then
            With Grid1
                .BeginUpdate
                With .Items
                    .CellValue(Item, ColIndex) = Object.Select(1)
                    .CellValueFormat(Item, ColIndex) = exHTML
                    .CellValue(Item, ColIndex) = .CellValue(Item, ColIndex) + " <fgcolor=FF0000>[<b>changed</b>]</fgcolor>"
                End With
                .EndUpdate
            End With
            CloseEditor = True
        End If

        If (Ev.Name = "KeyPress") Then
            Dim l As Long
            l = Ev(0).Value
            If l = vbKeyEscape Then
                CloseEditor = True
            End If
        End If
    End If
End Sub

The following VB sample displays the event and its parameters when an user editor object fires an event:

Private Sub Grid1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXGRIDLibCtl.IOleEvent, CloseEditor As Boolean, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
    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 C++ sample displays the event and its parameters when an user editor object fires an event:

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

void OnUserEditorOleEventGrid1(LPDISPATCH Object, LPDISPATCH Ev, BOOL FAR* CloseEditor, long Item, long ColIndex) 
{
	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( "" ); 
}

where the #import<grid.dll> defines the EXGRIDLib namespace that exports definitions for the OleEvent and OleEventParam objects. The V2S function converts a VARIANT value to a string value and may look like follows:

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;
}

The following VB.NET sample displays the event and its parameters when an user editor object fires an event:

Private Sub AxGrid1_UserEditorOleEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent) Handles AxGrid1.UserEditorOleEvent
    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 event and its parameters when an user editor object fires an event:

private void axGrid1_UserEditorOleEvent(object sender, AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent 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 event and its parameters when an user editor object fires an event:

*** ActiveX Control Event ***
LPARAMETERS object, ev, closeeditor, item, colindex

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