Type | Description | |||
Item as Variant | A long expression that indicates the item's handle | |||
ColIndex as Variant | A long expression that indicates the column's index or the cell's handle, a string expression that indicates the column's caption or key. | |||
Editor | An Editor object being created or accessed |
The CellEditor property gets you the custom cell editor if it exists, else it creates it. The CellEditor property creates an empty editor if it wasn't created before, so please pay attention when creating custom cell editors on the fly. You can use the HasCellEditor property to check whether a cell has associated a custom editor ( created using the CellEditor property ). You can have different type of editors in the same column using the CellEditor property. The CellEditor property builds a new editor for a specific cell. By default, the cell's editor is the default column's editor. Use the EditType property to specify an editor for the column. Use the DeleteCellEditor method to clear a particular cell editor created using the CellEditor property. Use the CellEditorVisible property to hide the cell's editor. You can use the BeginUpdate, EndUpdate method to refresh the control.
The following VB sample assigns a date type editor to the first cell:
With G2antt1.Items Dim h As EXG2ANTTLibCtl.HITEM h = .ItemByIndex(0) If Not .HasCellEditor(h, 0) Then With .CellEditor(h, 0) .EditType = DateType End With End If End With
The following VB sample assigns a spin type editor with min and max values:
With G2antt1.Items With .CellEditor(.FirstVisibleItem, 0) .EditType = SliderType .Option(exSliderWidth) = 0 .Option(exSliderMin) = 5 .Option(exSliderMax) = 10 End With End With
The following C++ sample assigns a date type editor to the first cell:
#include "Items.h" #include "Editor.h" void OnButton1() { CItems items = m_g2antt.GetItems(); COleVariant vtItem( items.GetItemByIndex( 0 ) ), vtColumn( (long)0 ); if ( !items.GetHasCellEditor( vtItem, vtColumn ) ) { CEditor editor = items.GetCellEditor( vtItem, vtColumn ); editor.SetEditType( 7 /*DateType*/ ); } }
The following C++ sample assigns a spin type editor with min and max values:
#include "Items.h" #include "Editor.h" CItems items = m_g2antt.GetItems(); CEditor editor = items.GetCellEditor( COleVariant( items.GetFirstVisibleItem() ), COleVariant( long(0) ) ); editor.SetEditType( 20 /*SliderType*/ ); editor.SetOption( 41 /*exSliderWidth */, COleVariant( long(0) ) ); editor.SetOption( 43 /*exSliderMin*/, COleVariant( long(5) ) ); editor.SetOption( 44 /*exSliderMax*/, COleVariant( long(10) ) );
The following VB.NET sample assigns a date type editor to the first cell:
With AxG2antt1.Items Dim h As Integer = .ItemByIndex(0) If Not .HasCellEditor(h, 0) Then With .CellEditor(h, 0) .EditType = EXG2ANTTLib.EditTypeEnum.DateType End With End If End With
The following VB.NET sample assigns a spin type editor with min and max values:
With AxG2antt1.Items With .CellEditor(.FirstVisibleItem, 0) .EditType = EXG2ANTTLib.EditTypeEnum.SliderType .Option(EXG2ANTTLib.EditorOptionEnum.exSliderWidth) = 0 .Option(EXG2ANTTLib.EditorOptionEnum.exSliderMin) = 5 .Option(EXG2ANTTLib.EditorOptionEnum.exSliderMax) = 10 End With End With
The following C# sample assigns a date type editor to the first cell:
int h = axG2antt1.Items[0]; if ( !axG2antt1.Items.get_HasCellEditor( h, 0 ) ) { EXG2ANTTLib.Editor editor = axG2antt1.Items.get_CellEditor( h, 0 ); if ( editor != null ) editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType; }
The following C# sample assigns a spin type editor with min and max values:
EXG2ANTTLib.Editor editor = axG2antt1.Items.get_CellEditor(axG2antt1.Items.FirstVisibleItem, 0); editor.EditType = EXG2ANTTLib.EditTypeEnum.SliderType; editor.set_Option(EXG2ANTTLib.EditorOptionEnum.exSliderWidth, 0); editor.set_Option(EXG2ANTTLib.EditorOptionEnum.exSliderMin, 5); editor.set_Option(EXG2ANTTLib.EditorOptionEnum.exSliderMax, 10);
The following VFP sample assigns a date type editor to the first cell:
with thisform.G2antt1.Items thisform.G2antt1.BeginUpdate() .DefaultItem = .ItemByIndex( 0 ) if ( !.HasCellEditor( 0, 0 ) ) .CellEditor( 0, 0 ).EditType = 7 endif thisform.G2antt1.EndUpdate() endwith
The following VFP sample assigns a spin type editor with min and max values:
with thisform.G2antt1.Items with .CellEditor(.FirstVisibleItem, 0) .EditType = 20 && SliderType .Option(41) = 0 && exSliderWidth .Option(43) = 5 && exSliderMin .Option(44) = 10 && exSliderMax endwith endwith