method Editor.UserEditor (ControlID as String, License as String)
Specifies the control's identifier and the control's runtime license key when EditType is UserEditor.

 TypeDescription 
   ControlID as String A string expression that indicates the control's program identifier. For instance, if you want to use a multiple column combobox as an user editor, the control's identifier could be: "Exontrol.ComboBox".   
   License as String Optional. A string expression that indicates the runtime license key in case is it required. It depends on what control are you using.  

The UserEditor property creates a new type of editor based on the ControlID parameter. The EditType property has effect only if it is UserEditorType. Use the UserEditorObject property to access the newly created object. The UserEditorObject property is nothing if the control wasn't able to create the user editor based on the ControlID. Also, if the user control requires a runtime license key, and the License parameter is empty or doesn't match, the UserEditorObject property is nothing. 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. The control fires the UserEditorOleEvent event each time when an user editor fires an event. The setup installs the VB\UserEditor, VC\User.Edit sample that uses the Exontrol ExComboBox Component as a new editor. 

The following VB sample adds a new column to an editor of of Exontrol.ComboBox type ( exComboBox component ):

With G2antt1
    .BeginUpdate
    With .Columns
        With .Add("Column 0").Editor
            .EditType = EditTypeEnum.UserEditorType
            ' Creates an ExComboBox control, and gets the object created
            .UserEditor "Exontrol.ComboBox", ""
             If Not .UserEditorObject Is Nothing Then
                With .UserEditorObject ' Points to an ExComboBox control
                    ' The ExComboBox object
                    .BeginUpdate
                    .EndUpdate
                End With
            End If
        End With
    End With
    .EndUpdate
End With

The following VB sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:

With G2antt1.Items
    Dim h As HITEM
    h = .AddItem(100)
    With .CellEditor(h, 0)
        .EditType = UserEditorType
        .UserEditor "Exontrol.MaskEdit", ""
        With .UserEditorObject()
            .BackColor = vbWhite
            .MaskFloat = True
            .Mask = "-###.###.###,##"
        End With
    End With
End With

The following C++ sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:

CItems items = m_g2antt.GetItems();
long hItem = items.AddItem( COleVariant( (double)100 ) );
CEditor editor = items.GetCellEditor( COleVariant( hItem ), COleVariant( long(0) ) );
editor.SetEditType( 16 /*UserEditorType*/ );
editor.UserEditor( "Exontrol.MaskEdit", "" );
MaskEditLib::IMaskEditPtr spMaskEdit( editor.GetUserEditorObject() );
if ( spMaskEdit != NULL )
{
	spMaskEdit->put_MaskFloat( TRUE );
	spMaskEdit->put_Mask( L"-###.###.###,##" );
	spMaskEdit->put_BackColor( RGB(255,255,255) );
}

The sample requires calling the #import <maskedit.dll> to include the type library for the eXMaskEdit component. The #import <maskedit.dll> defines the MaskEditLib namespace used in the sample.

The following VB.NET sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:

With AxG2antt1.Items
    Dim h As Integer = .AddItem(1000)
    With .CellEditor(h, 0)
        .EditType = EXG2ANTTLib.EditTypeEnum.UserEditorType
        .UserEditor("Exontrol.MaskEdit", "")
        With .UserEditorObject()
            .BackColor = ToUInt32(Color.White)
            .MaskFloat = True
            .Mask = "-###.###.###,##"
        End With
    End With
End With

where the ToUInt32 function converts a Color expression to an unsigned long expression and may look like follows:

Shared Function ToUInt32(ByVal c As Color) As UInt32
    Dim i As Long
    i = c.R
    i = i + 256 * c.G
    i = i + 256 * 256 * c.B
    ToUInt32 = Convert.ToUInt32(i)
End Function

The following C# sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:

EXG2ANTTLib.Items items = axG2antt1.Items;
int hItem = items.AddItem(100);
EXG2ANTTLib.Editor editor = items.get_CellEditor(hItem, 0);
editor.EditType = EXG2ANTTLib.EditTypeEnum.UserEditorType;
editor.UserEditor("Exontrol.MaskEdit", "");
MaskEditLib.MaskEdit maskEdit = editor.UserEditorObject as MaskEditLib.MaskEdit;
if (maskEdit != null)
{
	maskEdit.BackColor = ToUInt32(Color.White);
	maskEdit.MaskFloat = true;
	maskEdit.Mask = "-###.###.###,##";
}

where the MaskEditLib class is defined by adding a new reference to the ExMaskEdit component to your project. The ToUInt32 function converts a Color expression to an OLE_COLOR expression ( unsigned long expression ), and may look like follows:

private UInt32 ToUInt32(Color c)
{
	long i;
	i = c.R;
	i = i + 256 * c.G;
	i = i + 256 * 256 * c.B;
	return Convert.ToUInt32(i);
}

The following VFP sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:

With thisform.G2antt1.Items
    local h
    h = .AddItem(100)
    With .CellEditor(h, 0)
        .EditType = 16 && UserEditorType
        .UserEditor("Exontrol.MaskEdit", "")
        With .UserEditorObject()
            .BackColor = RGB(255,255,255)
            .MaskFloat = .t.
            .Mask = "-###.###.###,##"
        EndWith
    EndWith
EndWith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.