Type | Description | |||
Object | An ActiveX object being used as an user editor. |
Use the UserEditorOpen property to access to the ActiveX user editor. Use the UserEditor property to initialize the ActiveX user editor. The UserEditorObject property retrieves the ActiveX control created when UserEditor method was invoked. The type of object returned by the UserEditorObject depends on the ControlID parameter of the UserEditor method. For instance, the type of the created object when UserEditor("Exontrol.ComboBox") is used, is EXCOMBOBOXLibCtl.ComboBox. The UserEditorObject property gets nothing if the UserEditor method fails. The control fires the UserEditorOpen event when an user editor is about to be shown. The control fires the UserEditorClose event when the control closes an user editor. The control fires the UserEditorOleEvent event each time when an user editor fires an event.
The following VB sample initializes an user editor of EXCOMBOBOXLibCtl.ComboBox:
With Grid1 .BeginUpdate .DefaultItemHeight = 21 .TreeColumnIndex = -1 .ColumnAutoResize = True .MarkSearchColumn = False .FullRowSelect = False .DrawGridLines = exVLines 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 ' Loads the ExComboBox object .BeginUpdate .LinesAtRoot = exGroupLinesAtRoot .ColumnAutoResize = True .IntegralHeight = True .HeaderVisible = False .AllowSizeGrip = True .MinHeightList = 100 .AutoDropDown = True .HasButtons = exArrow .Indent = 18 .MarkSearchColumn = False .BackColor = Grid1.BackColor With .Columns With .Add("Column 0") End With With .Add("Column 1") .Position = 0 .Width = 16 End With End With With .Items Dim h1 As HITEM, h2 As HITEM, h12 As HITEM, i As Long For i = 1 To 3 h1 = .AddItem("Group " & i) .CellCaption(h1, 1) = i * 4 - 3 h12 = .InsertItem(h1, , "Item 1") .CellCaption(h12, 1) = i * 4 - 2 h12 = .InsertItem(h1, , "Item 2") .CellCaption(h12, 1) = i * 4 - 1 h12 = .InsertItem(h1, , "Item 3") .CellCaption(h12, 1) = i * 4 .ExpandItem(h1) = True Next End With .EndUpdate End With Else MsgBox "YOU NEED TO HAVE INSTALLED THE EXCOMBOBOX CONTROL, else you will not be able to see the UserEditor column" End If End With With .Add("Column 1") With .Editor .EditType = EditTypeEnum.DateType .AddItem 10, "Ten" .AddItem 20, "Twenty" End With End With End With For i = 1 To 11 With .Items Dim h As HITEM h = .AddItem(i) End With Next .EndUpdate End With
The following VB sample adds the Exontrol's eXMaskEdit Component to mask floating point numbers with digit grouping:
With Grid1.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_grid.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 AxGrid1.Items Dim h As Integer = .AddItem(1000) With .CellEditor(h, 0) .EditType = EXGRIDLib.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:
EXGRIDLib.Items items = axGrid1.Items; int hItem = items.AddItem(100); EXGRIDLib.Editor editor = items.get_CellEditor(hItem, 0); editor.EditType = EXGRIDLib.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.Grid1.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