From: ichimunki Date: 2002-01-09T14:09:59+09:00 Subject: Tk Popup Menu in a TkText widget --EiDj_MZ=.)9?//J1 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I guess I got this to work. Still seeking improvements to any aspect of the following snippet. I will spare you most of the code, but here is the snippet I am using to create and bind a right-click to do a popup menu: ed_menu = MakeMenu.editor_bind_menu( ed ) ed.bind('ButtonPress-3', proc{ |x,y| g = $mw.geometry re = /\+(\d+?)\+(\d+?)/ adj = re.match( g ) ed_menu.popup( x+adj[0].to_i, y+adj[1].to_i ) }, "%x %y" ) Is there a better way than parsing the geometry string to adjust for the fact that |x,y| gives the pointer position relative to the upper-left corner of the window, rather than the screen? I looked for possible methods (Widget#methods) in my menu, its parent and the main window, but found nothing that looked useful except geometry. Note: this implementation of TkMenu#popup coincides with the Tk documentation, but not with the Perl/Tk implementation of the same method. Thanks! -- ______Michael_C_Libby__{_x_(at)_ichimunki_(dot)_com_}______ | "even monkeys fall from trees" : "saru mo ki kara ochiru" | | public key at http://www.ichimunki.com/public.key | |_Fingerprint: D946FE20 79EE2109 161BFAFB E02956F4 A330AA73_| --EiDj_MZ=.)9?//J1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8O9An4ClW9KMwqnMRApoJAKCBLBlpz70FzBLfvALw/TPBIeEr0ACfSEKs Xp6o+Lo8jmjLOQX3V+nV9S4= =tDvu -----END PGP SIGNATURE----- --EiDj_MZ=.)9?//J1--