EmEditor Home - EmEditor Help - EmEditor Macro Reference - Selection Object

Mode Property

Sets or retrieves a flag indicating the selection mode.


nMode = document.selection.Mode;

document.selection.Mode = nMode;


nMode = document.selection.Mode

document.selection.Mode = nMode



Specifies a combination of the following values: However, eeModeStream, eeModeLine, and eeModeBox cannot be combined. Only eeModeKeyboard can be combined with eeModeStream, eeModeLine, or eeModeBox.  When setting the property, eeModeSelected will be ignored.

eeModeStream Stream selection mode.
eeModeLine Line selection mode.
eeModeBox Vertical selection mode.
eeModeMask A mask to inspect the selection mode. Cannot use to set the property. To inspect the Mode Property, use an AND operator and compare the result with eeModeStream, eeModeLine, and eeModeBox.
eeModeKeyboard Specifies the keyboard selection mode. This value can be combined with another value.
eeModeSelected Selection is not empty. Valid only when retrieving the property.



nMode = document.selection.Mode;
switch( nMode & eeModeMask ) {
case eeModeStream:
    alert( "Stream selection mode.");
case eeModeLine:
    alert( "Line selection mode." );
case eeModeBox:
    alert( "Vertical selection mode.");
if( nMode & eeModeKeyboard )  alert( "And also the keyboard selection mode." );


nMode = document.selection.Mode
Select Case nMode And eeModeMask
Case eeModeStream
    alert "Stream selection mode."
Case eeModeLine
    alert "Line selection mode."
Case eeModeBox
    alert "Vertical selection mode."
End Select
If nMode And eeModeKeyboard Then
    alert "And also the keyboard selection mode."
End If


Supported on EmEditor Professional Version 4.00 or later. However, EmEditor Professional Version 5.00 or later supports eeModeSelected, and this property returns selection mode even when the selection is empty.

Copyright 2003-2015 by Emurasoft, Inc.