Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

ISelection Interface

This interface is implemented by the selection object. Each document view has a read-only selection object, which you can query using the IDocumentView.selection property.

Use the properties and methods of this interface to control the editor window's multiple selection.

Use the special wholeFile global variable to specify the “whole file” selection. This virtual selection object may be used with any document.

Declaration

interface ISelection {
    // Properties
    readonly ${startOffset}: number;
    readonly ${endOffset}: number;
    readonly ${singleRange}: boolean;
    readonly ${rangeCount}: number;
    readonly ${size}: number;
    readonly ${empty}: boolean;

    // Methods
    ${selectRange}(startOffset: number, size: number, mode = ${SelectRangeMode}.Add): void;
    ${invert}(size: number): void;
    ${clear}(): void;
}
// This interface is not available in managed environment
// This interface is not available in native environment

ISelection Properties

startOffset

readonly startOffset: number;
// This property is not available in managed environment
// This property is not available in native environment

The first offset in a selection. Throws an exception if selection is empty.

endOffset

readonly endOffset: number;
// This property is not available in managed environment
// This property is not available in native environment

The last offset in a selection. Throws an exception if selection is empty.

singleRange

readonly singleRange: boolean;
// This property is not available in managed environment
// This property is not available in native environment

true if selection has single range, false otherwise.

rangeCount

readonly rangeCount: number;
// This property is not available in managed environment
// This property is not available in native environment

Returns the number of ranges in a selection.

size

readonly size: number;
// This property is not available in managed environment
// This property is not available in native environment

Total size of a selection (the sum of sizes of all ranges).

empty

readonly empty: boolean;
// This property is not available in managed environment
// This property is not available in native environment

true if selection is empty, false otherwise.

ISelection Methods

selectRange

selectRange(startOffset: number, size: number, mode = ${SelectRangeMode}.Add): void;
// This method is not available in managed environment
// This method is not available in native environment
startOffset
Starting offset.
size
Number of bytes to select.
mode
Optional selection mode.

Performs a selection operation. The result of the operation depends on the value of a mode parameter:

ValueResult
ReplaceReplace a current selection with a given range.
AddAdds the new range to a current selection.
SubtractSubtract the range from a current selection.
OverlapOverlap a given range with a current selection.

invert

invert(size: number): void;
// This method is not available in managed environment
// This method is not available in native environment
size
The total size of a selection to use for the inversion operation.

Invert the current selection. A required size parameter is used to perform this operation.

clear

clear(): void;
// This method is not available in managed environment
// This method is not available in native environment

Clear the current selection.