property Items.HasCellEditor ([Item as Variant], [ColIndex as Variant]) as Boolean
Specifies whether a cell has a built-in editor.

 TypeDescription 
   Item as Variant A long expression that indicates the item's handle.  
   ColIndex as Variant A long expression that indicates the cell's handle or the column's index, a string expression that indicates the column's caption or the column's key.  
   Boolean A boolean expression that indicates whether the cell has a built-in editor created using the CellEditor method.  
Use the HasCellEditor property to check whether the cell has an individual editor being added using the CellEditor method before. Use the HasCellEditor property to find if a cell has a particular editor. The HasCellEditor property gets true only if the cell has its own editor assigned, it never gets true, if the cell's column has an editor. Use the CellEditor method to assign different editors in the same column. Use the Editor property to assign the same editor for all cells in the column.

The following VB sample shows the drop down portion of the control when a cell is focused:

Private Sub G2antt1_FocusChanged()
    With G2antt1
        Dim i As Long
        i = .FocusColumnIndex
        With G2antt1.Items
            If (.CellEditorVisible(.FocusItem, i)) Then
                Dim e As EXG2ANTTLibCtl.Editor
                Set e = G2antt1.Columns(i).Editor
                If .HasCellEditor(.FocusItem, i) Then
                    Set e = .CellEditor(.FocusItem, i)
                End If
                If Not e Is Nothing Then
                    e.DropDown
                End If
            End If
        End With
    End With
End Sub

The following VB sample assigns a date type editor to the focused cell ( the sample checks first if the cell doesn't have already an editor ):

With G2antt1.Items
    Dim h As EXG2ANTTLibCtl.HITEM
    h = .FocusItem
    If Not .HasCellEditor(h, G2antt1.FocusColumnIndex) Then
        With .CellEditor(h, G2antt1.FocusColumnIndex)
            .EditType = DateType
        End With
    End If
End With

The following C++ sample assigns a date type editor to the focused cell ( the sample checks first if the cell doesn't have already an editor ):

#include "Items.h"
#include "Editor.h"
CItems items = m_g2antt.GetItems();
COleVariant vtItem( items.GetFocusItem() ), vtColumn( long(m_g2antt.GetFocusColumnIndex() ) );
if ( !items.GetHasCellEditor( vtItem, vtColumn ) )
{
	CEditor editor = items.GetCellEditor( vtItem, vtColumn );
	editor.SetEditType( 7 /*DateType*/ );
}

The following VB.NET sample assigns a date type editor to the focused cell ( the sample checks first if the cell doesn't have already an editor ):

With AxG2antt1.Items
    Dim hItem As Integer = .FocusItem
    If Not .HasCellEditor(hItem, AxG2antt1.FocusColumnIndex) Then
        With .CellEditor(hItem, AxG2antt1.FocusColumnIndex)
            .EditType = EXG2ANTTLib.EditTypeEnum.DateType
        End With
    End If
End With

The following C# sample assigns a date type editor to the focused cell ( the sample checks first if the cell doesn't have already an editor ):

EXG2ANTTLib.Items items = axG2antt1.Items;
int hItem = items.FocusItem;
if (hItem != null)
	if (!items.get_HasCellEditor(hItem, axG2antt1.FocusColumnIndex))
	{
		EXG2ANTTLib.Editor editor = items.get_CellEditor(hItem, axG2antt1.FocusColumnIndex);
		editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType;
	}

The following VFP sample assigns a date type editor to the focused cell ( the sample checks first if the cell doesn't have already an editor ):

with thisform.G2antt1.Items
	.DefaultItem = .FocusItem
	if ( !.HasCellEditor(0, thisform.G2antt1.FocusColumnIndex ) )
		with .CellEditor( 0, thisform.G2antt1.FocusColumnIndex )
			.EditType = 7 && DateType
		endwith
	endif
endwith

 


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