property Editor.Option(Name as EditorOptionEnum) as Variant
Specifies an option for the editor.

   Name as EditorOptionEnum An EditorOptionEnum expression that indicates the editor's option being changed.  
   Variant A Variant expression that indicates the value for editor's option   
The Option property of Editor object provides the ability to add scroll bars to a memo editor using the exMemoHScrollBar and exMemoVScrollBar options. Use the DefaultEditorOption property to specify default option for the editors of a specified type.

For instance, the following VB sample adds both scroll bar to the editor of the first column:

With G2antt1.Columns(0).Editor
        .Option(exMemoAutoSize) = False     ' Disables auto resizing when user alters the text
        .Option(exMemoVScrollBar) = True    ' Adds the vertical scroll bar
        .Option(exMemoHScrollBar) = True    ' Adds the horizontal scroll bar
End With
The following VB sample adds a cell with a password editor:
With G2antt1.Items
    Dim h As HITEM
    h = .InsertItem(, , "password")
    With .CellEditor(h, 0)
        .EditType = EXG2ANTTLibCtl.EditType
        .Option(EXG2ANTTLibCtl.EditorOptionEnum.exEditPassword) = True
    End With
End With

The following VB sample indicates how to let user uses the left, right arrows, home and end keys to move the cursor inside an editor that displays a caret, instead changing the focused cell:

With G2antt1.Columns(ColIndex).Editor
        .Option(exLeftArrow) = exHandleEditor
        .Option(exRightArrow) = exHandleEditor
        .Option(exHomeKey) = exHandleEditor
        .Option(exEndKey) = exHandleEditor
End With

The following C++ sample adds a password editor:

#include "Items.h"
#include "Editor.h"
COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
CItems items = m_g2antt.GetItems();
CEditor editor = items.GetCellEditor( COleVariant( items.GetFirstVisibleItem() ), COleVariant( long(0) ) );
editor.SetEditType( 1 /*EditType*/ );
editor.SetOption( 18 /*exEditPassword*/, COleVariant( VARIANT_TRUE ) );

The following VB.NET sample adds a password editor:

With AxG2antt1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXG2ANTTLib.EditTypeEnum.EditType
        .Option(EXG2ANTTLib.EditorOptionEnum.exEditPassword) = True
    End With
End With

The following C# sample adds a password editor:

EXG2ANTTLib.Items items = axG2antt1.Items;
EXG2ANTTLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXG2ANTTLib.EditTypeEnum.EditType;
editor.set_Option(EXG2ANTTLib.EditorOptionEnum.exEditPassword, true );

The following VFP sample adds a password editor:

with thisform.G2antt1.Items
	With .CellEditor(.FirstVisibleItem, 0) 
		.EditType = 1 && EditType
		.Option(18) = .t. && exEditPassword


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