TIP 286: Add 'xposition' Command to Menu Widgets

Login
Author:		Schelte Bron <[email protected]>
State:		Final
Type:		Project
Tcl-Version:	8.5
Vote:		Done
Created:	18-Oct-2006
Post-History:	
Keywords:	Tk
Tk-Ticket:	1152376

Abstract

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.

Rationale

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. http://sf.net/tracker/?func=detail&aid=1152376&group_id=12997&atid=312997

Copyright

This document has been placed in the public domain.