event UserEditorOpen (Object as Object, Item as HITEM, ColIndex as Long)
Occurs when an user editor is about to be opened.

TypeDescription
Object as Object An object created by UserEditor property
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 control supports custom ActiveX editors support. The control fires the UserEditorOpen event when an user editor is shown. Use the UserEditorOpen event to initialize the user editor when it is shown. For instance, if you have a custom maskedit control you can initialize the mask and the value based on the cell's value property. Use the CellValue property to access the cell's value. The control fires the UserEditorOleEvent event each time when an user editor fires an event.  The control fires the UserEditorClose event when an user editor is  hidden.

Syntax for UserEditorOpen event, /NET version, on:

private void UserEditorOpen(object sender,object Obj,int Item,int ColIndex)
{
}

Private Sub UserEditorOpen(ByVal sender As System.Object,ByVal Obj As Object,ByVal Item As Integer,ByVal ColIndex As Integer) Handles UserEditorOpen
End Sub

Syntax for UserEditorOpen event, /COM version, on:

private void UserEditorOpen(object sender, AxEXGRIDLib._IGridEvents_UserEditorOpenEvent e)
{
}

void OnUserEditorOpen(LPDISPATCH Object,long Item,long ColIndex)
{
}

void __fastcall UserEditorOpen(TObject *Sender,IDispatch *Object,Exgridlib_tlb::HITEM Item,long ColIndex)
{
}

procedure UserEditorOpen(ASender: TObject; Object : IDispatch;Item : HITEM;ColIndex : Integer);
begin
end;

procedure UserEditorOpen(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOpenEvent);
begin
end;

begin event UserEditorOpen(oleobject Object,long Item,long ColIndex)
end event UserEditorOpen

Private Sub UserEditorOpen(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOpenEvent) Handles UserEditorOpen
End Sub

Private Sub UserEditorOpen(ByVal Object As Object,ByVal Item As EXGRIDLibCtl.HITEM,ByVal ColIndex As Long)
End Sub

Private Sub UserEditorOpen(ByVal Object As Object,ByVal Item As Long,ByVal ColIndex As Long)
End Sub

LPARAMETERS Object,Item,ColIndex

PROCEDURE OnUserEditorOpen(oGrid,Object,Item,ColIndex)
RETURN

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

<SCRIPT EVENT="UserEditorOpen(Object,Item,ColIndex)" LANGUAGE="JScript">
</SCRIPT>

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

Procedure OnComUserEditorOpen Variant llObject HITEM llItem Integer llColIndex
	Forward Send OnComUserEditorOpen llObject llItem llColIndex
End_Procedure

METHOD OCX_UserEditorOpen(Object,Item,ColIndex) CLASS MainDialog
RETURN NIL

void onEvent_UserEditorOpen(COM _Object,int _Item,int _ColIndex)
{
}

function UserEditorOpen as v (Object as P,Item as OLE::Exontrol.Grid.1::HITEM,ColIndex as N)
end function

function nativeObject_UserEditorOpen(Object,Item,ColIndex)
return

The following VB sample selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox type ( the sample uses the Exontrol's ExComboBox Component ):

Private Sub Grid1_UserEditorOpen(ByVal Object As Object, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
   On Error Resume Next
    nEvents = nEvents + 1
    'Selects the value in the combo box
    With Object            ' Points to an EXCOMBOBOXLibCtl.ComboBox object 
        Dim sID As String
        sID = Grid1.Items.CellValue(Item, ColIndex)
        If (Grid1.Items.CellValueFormat(Item, ColIndex) = exHTML) Then
            sID = Mid(sID, 1, InStr(1, sID, " ", vbTextCompare) - 1)
        End If
        .Select(1) = sID
        If .Items.SelectCount > 0 Then
            .Items.EnsureVisibleItem .Items.SelectedItem(0)
        End If
    End With
    nEvents = nEvents - 1
End Sub

The following samples use the Exontrol's ExMaskEdit Component to mask floating point numbers using digit grouping.

The following VB sample initializes the mask's value when user editor is shown ( the sample calls the Text property of the exMaskEdit component ):

Private Sub Grid1_UserEditorOpen(ByVal Object As Object, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
    With Grid1.Items
        Object.Text = .CellValue(Item, ColIndex)
    End With
End Sub

The following C++ sample initializes the mask's value when user editor is shown:

#import <maskedit.dll>

#include "Items.h"

void OnUserEditorOpenGrid1(LPDISPATCH Object, long Item, long ColIndex) 
{
	MaskEditLib::IMaskEditPtr spMaskEdit( Object );
	if ( spMaskEdit != NULL )
	{
		CString strValue = V2S( &m_grid.GetItems().GetCellValue( COleVariant( Item ), COleVariant( ColIndex ) ) );
		spMaskEdit->PutText( strValue.AllocSysString() );
	}
}

where the #import <maskedit.dll> defines the type library of the exMaskEdit component, in the MaskEditLib namespace.  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 initializes the mask's value when user editor is shown:

Private Sub AxGrid1_UserEditorOpen(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOpenEvent) Handles AxGrid1.UserEditorOpen
    With AxGrid1.Items
        e.object.Text = .CellValue(e.item, e.colIndex)
    End With
End Sub

The following C# sample initializes the mask's value when user editor is shown:

private void axGrid1_UserEditorOpen(object sender, AxEXGRIDLib._IGridEvents_UserEditorOpenEvent e)
{
	MaskEditLib.MaskEdit maskEdit = e.@object as MaskEditLib.MaskEdit;
	if (maskEdit != null)
	{
		object cellValue = axGrid1.Items.get_CellValue(e.item, e.colIndex);
		maskEdit.Text = (cellValue != null ? cellValue.ToString() : "");
	}
}

where the MaskEditLib class is defined by adding a new reference to the ExMaskEdit component to your project.

The following VFP sample initializes the mask's value when user editor is shown:

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

with thisform.Grid1.Items
	.DefaultItem = item
	object.Text = .CellValue( 0, colindex )
endwith