beetlebug▾
/

grid location

Gives the column and the row of the cell at a point of a container.

grid location CONTAINER X Y

Description

X and Y are distances from the top left corner of CONTAINER. A point left of the grid gives the column -1, and a point above the grid gives the row -1.

Returns

A list of two integers: the column and the row.

Examples

% frame .lo
> foreach n {a b c d} { frame .lo.$n -width 20 -height 10 }
> grid .lo.a .lo.b
> grid .lo.c .lo.d
> pack .lo
> update
> list [grid location .lo 25 15] [grid location .lo -5 -5]
{1 1} {-1 -1}

Errors

% grid location .lo x 1
bad screen distance "x"
-errorcode NONE

% grid location .lo 1
wrong # args: should be "grid location master x y"
-errorcode NONE

Facts

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

See also