Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

tk event bug in windows
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



Report this thread to moderator Post Follow-up to this message
Old Post
lio
04-18-05 08:59 PM


Re: tk event bug in windows
"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

Report this thread to moderator Post Follow-up to this message
Old Post
Donald Arseneau
04-20-05 09:00 PM


Re: tk event bug in windows
> > 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.



Report this thread to moderator Post Follow-up to this message
Old Post
lio
04-21-05 09:00 AM


Re: tk event bug in windows
"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

Report this thread to moderator Post Follow-up to this message
Old Post
Donald Arseneau
04-21-05 01:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Tcl archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:17 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.