Onselect (NotesUIView - LotusScript®)

Occurs when the row highlight moves to a new row within a view, or rows are selected/deselected. The CaretCategory and CaretNoteID properties can be used to identify which row is newly highlighted. The Documents property can be used to detect which documents are selected.

Note: This event is new with Release 8.

Defined in

NotesUIView

Syntax

Onselect(Source As NotesUIView)

Parameters

Source

NotesUIView. Read-only. The current view.

Usage

This event occurs when a view is opened, since a row is highlighted at that time. This event also occurs when a document is selected or deselected using the checkmark "selection margin" or when the user clicks the already-selected row.

The user changes the current highlight (or caret location) by a mouse click or pressing the up and down arrows. Exactly one document or category is highlighted in a view.

Use CaretNoteID to get the Note ID of the document currently highlighted. If there are no documents in the view, this property has a value of "0". If a category row is highlighted, CaretNoteID returns a note ID with the high-order bit set. You can determine whether the current row contains a category or a document either by using GetDocumentByID to try to retrieve the document (which will return Nothing for a category entry), or by testing the high-order bit (e.g. Source.CaretNoteID Like "NT[89A-F]*").

Since Onselect executes both when a document is highlighted, and when documents are selected/deselected, you may want to code the event to determine which of these things just happened. Test CaretNoteID first, as it is more efficient than the Documents property. You may want to use Static variables to remember what values were encountered on the last execution, to see whether anything you care about has changed since then.

Note: Documents.Count will usually be different if the selection changed, but you cannot rely on this. For instance, if the user does a search in the view, and documents are selected by the search (because the user chose view order in the full-text options), there could easily be the same number of documents selected before and after even though they are not the same documents.

When you create a script that responds to this event, Notes® creates the syntax of the event for you (including the parameters). You do not need to type it in.

Example