From: Josef Wolf Date: 2006-09-07T14:40:43+09:00 Subject: Re: How to properly bind context menus to canvas in Ruby/Tk? On Thu, Sep 07, 2006 at 10:31:00AM +0900, Morton Goldberg wrote: > On Sep 6, 2006, at 12:50 PM, Josef Wolf wrote: > >On Wed, Sep 06, 2006 at 04:00:45AM +0900, Morton Goldberg wrote: > >>Which menu don't you get, the canvas' or the rect's? > >I always get the canvas menu and never see the rectangle's menu. > I think the reason my code works differently from yours is because I > use separate variable names for the two contextual menus while you > use the same one for both. It really does make a difference. It _does_ make a difference, but in another way: - If I use the same variable, always the last allocated menu wins. Thus with the version I posted, always rectangle's menu wins. - If I use different variables (as in my original code because they are in different methods), always the canvas menu wins. I _never_ see two different menus unless I introduce the handled_by_root flag.