TIP #286: Add 'xposition' Command to Menu Widgets

Title:Add 'xposition' Command to Menu Widgets
Version:$Revision: 1.4 $
Author:Schelte Bron <sbron at wanadoo dot nl>
Created:Wednesday, 18 October 2006


There has been a yposition subcommand for menu widgets for years, but its counterpart in the x-direction does not currently exist. This TIP intends to rectify that situation.


There is currently no way to obtain the x-position of a menu entry while a menu subcommand for obtaining the y-position does exist. Even though on a normal menu the x-position will always be 1, there are a few circumstances where the x-position may have some more interesting values. In particular, this is the case for menubars and for menus with column-breaks.

Proposed New Command

This TIP proposes a new subcommand for menu widgets, xposition, with the following syntax:

pathName xposition index

This returns an integer giving the x-coordinate within (i.e., relative to) the menu window specified by pathName of the leftmost pixel in the entry specified by index. The index may take any of the normal forms for identifying a menu entry.

Reference Implementation

Submitted to SourceForge as Patch #1152376. [1]


This document has been placed in the public domain.

Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows