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, AxEXG2ANTTLib._IG2anttEvents_UserEditorOpenEvent e)
{
}

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

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

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

procedure UserEditorOpen(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_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 AxEXG2ANTTLib._IG2anttEvents_UserEditorOpenEvent) Handles UserEditorOpen
End Sub

Private Sub UserEditorOpen(ByVal Object As Object,ByVal Item As EXG2ANTTLibCtl.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(oG2antt,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.G2antt.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 G2antt1_UserEditorOpen(ByVal Object As Object, ByVal Item As EXG2ANTTLibCtl.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 = G2antt1.Items.CellValue(Item, ColIndex)
        If (G2antt1.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 G2antt1_UserEditorOpen(ByVal Object As Object, ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long)
    With G2antt1.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 OnUserEditorOpenG2antt1(LPDISPATCH Object, long Item, long ColIndex) 
{
	MaskEditLib::IMaskEditPtr spMaskEdit( Object );
	if ( spMaskEdit != NULL )
	{
		CString strValue = V2S( &m_g2antt.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 AxG2antt1_UserEditorOpen(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_UserEditorOpenEvent) Handles AxG2antt1.UserEditorOpen
    With AxG2antt1.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 axG2antt1_UserEditorOpen(object sender, AxEXG2ANTTLib._IG2anttEvents_UserEditorOpenEvent e)
{
	MaskEditLib.MaskEdit maskEdit = e.@object as MaskEditLib.MaskEdit;
	if (maskEdit != null)
	{
		object cellValue = axG2antt1.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.G2antt1.Items
	.DefaultItem = item
	object.Text = .CellValue( 0, colindex )
endwith