beetlebug▾
/

listbox nearest

Gives the index of the visible item nearest to the pixel row Y.

PATHNAME nearest Y

Description

Y is a distance in pixels from the top of the listbox. The result is the index of the visible item at that row, or of the nearest visible item. A listbox with no items gives -1.

Returns

An integer.

Examples

% listbox .ne
> .ne insert end a b c
> .ne nearest 0
0

Errors

% listbox .ne2; .ne2 nearest
wrong # args: should be ".ne2 nearest y"
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also