Tk Source Code

View Ticket
Login
Ticket UUID: 1871474
Title: <<Modified>> does not trigger
Type: Bug Version: obsolete: 8.5.0
Submitter: fvogel Created on: 2008-01-14 19:59:16
Subsystem: 18. [text] Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2014-02-19 21:42:22
Resolution: Fixed Closed By: dkf
    Closed on: 2009-10-25 13:53:59
Description:
The <<Modified>> event is sometimes not generated when the text widget changes state, despite what the man states.

It looks like the fix for bug 1799782 (and 687522) that made it into 8.5.0 at the last minute seems to have created this bug.

For instance:

1 % info patchlevel
8.5.0
2 % text .t
.t
3 % pack .t
4 % bind .t <<Modified>> {puts "EVENT"}
5 % .t edit modified
0
6 % .t insert end "Hello"
EVENT
7 % .t edit modified
1
8 % .t edit modified false
9 % .t edit modified
0
10 % 

The modified flag is correctly automatically set to true when text is inserted.

Then the modified flag is manually reset to false.

This latter action should generate a <<Modified>> event, which does not happen. The manual indeed says that "Whenever the flag changes state a <<Modified>> virtual event is generated."


Francois
User Comments: dkf added on 2009-10-25 20:53:59:

allow_comments - 1

fvogelnew1 added on 2009-10-24 17:26:19:
Well I have just checked on 8.5.7 HEAD: this bug seems to be fixed now.

fvogelnew1 added on 2009-10-24 17:12:02:
Item #1469210  is said to be fixed now.
A comment there from Koen Danckaert (2008-09-02) states that the patch also fixes the present bug.
Is it still true? If so, can this bug be closed as well?

[email protected] added on 2008-01-23 00:27:08:
Logged In: NO 

Indeed, this is caused by the fix for 1799782. But the current situation is far worse than before, since events are actually missed now!

In fact, I think 1799782 shouldn't have been fixed. It's perfectly acceptable that a <<Modified>> event is generated every time when "edit modified ..." is called.

For example, the text widget doc also states that "Whenever the sel tag range changes a virtual event <<Selection>> is generated". But also in this case there is no check that the selection really changes:

% pack [text .t]
% bind .t <<Selection>> {puts SelectionEvent}
% .t tag add sel 1.0 end
SelectionEvent
% .t tag add sel 1.0 end
SelectionEvent