Code Comments
Programming Forum and web based access to our favorite programming groups.I found what I believe is a bug in tk. It doesn't happen on every platform. I am currently running Windows 2000 with Tcl/Tk 8.4.4.0 (from activestate). I was wondering if anyone else has ever noticed this bug, if it has been fixed at all, and on which systems people do or don't have this bug. Now for the bug: An <Enter> event as well as another event (eg left click) causing a tk_popup is bound to text in a text widget. Then move the mouse over the text -> Enter event triggered Then click the mouse -> popup comes up Then click an item in the popup, or deselect the popup by clicking somewhere else on the screen -> Enter event triggered again. This second enter event should not be triggered!!!! A simple application which can show this in action is the 1 below, I have 2 text boxes, the first has some text with the bindings, the second is for output when the events are triggered. I have 3 events, <Enter> <Leave> and "left click". Try moving the mouse over the text, left click it, then click somewhere entirely off the application (or in the bottom text window, etc). The <Enter> event is triggered when it shouldn't have been, and the <Leave> event does not get called until the mouse is moved over the top text box again. Thankyou in advance. Lio. Code: text .input -width 20 -height 5 pack .input text .input2 -width 20 -height 10 pack .input2 set x 0 .input tag bind bound <Enter> { incr x .input2 insert end "enter $x\n" .input2 yview end } set l 0 .input tag bind bound <Leave> { incr l .input2 insert end "leave $l\n" .input2 yview end } menu .amenu .input tag bind bound <Button1-ButtonRelease> { tk_popup .amenu %X %Y } .input insert end "some text" bound
Post Follow-up to this message"lio" <lio@home> writes: > output when the events are triggered. I have 3 events, <Enter> <Leave> and > "left click". Try moving the mouse over the text, left click it, then clic k > somewhere entirely off the application (or in the bottom text window, etc) . > The <Enter> event is triggered when it shouldn't have been, and the <Leave > > event does not get called until the mouse is moved over the top text box > again. I haven't seen anything wrong. Moreover, your description doesn't necessarily mean anything was wrong for you. What I get, and what is correct, is that clicking on the text brings up the popup menu. The menu grabs focus so a "Leave" message is printed. While the menu is up there are no messages, even if I pass the mouse cursor over the text. When the menu is dismissed, the focus is restored to the text that you clicked on, and it registers "Enter". And immediately, if the pointer is outside the text, it invokes "Leave". If Tk didn't balance all Enter and Leave, it would be very difficult to make use of such events. -- Donald Arseneau asnd@triumf.ca
Post Follow-up to this message> > output when the events are triggered. I have 3 events, <Enter> <Leave> and click etc). <Leave> > > I haven't seen anything wrong. Moreover, your description > doesn't necessarily mean anything was wrong for you. What > I get, and what is correct, is that clicking on the text > brings up the popup menu. The menu grabs focus so a "Leave" > message is printed. While the menu is up there are no messages, > even if I pass the mouse cursor over the text. When the menu > is dismissed, the focus is restored to the text that you clicked > on, and it registers "Enter". And immediately, if the pointer > is outside the text, it invokes "Leave". > > If Tk didn't balance all Enter and Leave, it would be very > difficult to make use of such events. What operating system are you running? If what you say should happen happens then I would be happy, however on my system after the window is dismissed it register the "Enter" event as you say. However never registers the "Leave" event until the mouse re-enters the text box that was clicked (ie if the mouse is over a different text box, the "Leave" never occurs). Lio.
Post Follow-up to this message"lio" <lio@home> writes: > What operating system are you running? I tried it on Win XP (ActiveTcl) and Linux. But not with the same Tcl version as you. -- Donald Arseneau asnd@triumf.ca
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.