From: Hidetoshi NAGAI Date: 2004-08-18T13:41:07+09:00 Subject: Re: Tk event_generate broken? Hi, From: "Phlip" Subject: Tk event_generate broken? Date: Wed, 18 Aug 2004 01:55:57 +0900 Message-ID: <8LqUc.2657$ZC7.26@newssvr19.news.prodigy.com> > poly1 = TkcPolygon.new(canvas, shape) { > fill 'green' > } > > poly1.bind ('Button-1') { > puts 'yo' > poly1.configure('fill' => 'red') > Tk.event_generate(poly1, 'Button-1') # <-- yo > } > Tk.update > Tk.event_generate(poly1, 'Button-1') Unfortunately, if you want to generate events for canvas items, you must give the coordinate information of the event. (e.g. Tk.event_generate(poly1, 'Button-1', :x=>36, :y=>36) ) When the target of Tk.event_generate method is a canvas item, the generated event is sent to the canvas widget which includes the target item, because Tcl/Tk's event command can't send events to canvas items directly. It depends on the coordinate of the event whether the canvas calls the callback procedure of the target item or not. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)