Menu

#2389 <<Modified>> does not trigger

obsolete: 8.5.0
closed-fixed
5
2009-10-25
2008-01-14
No

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

Discussion

  • Nobody/Anonymous

    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

     
  • Francois VOGEL

    Francois VOGEL - 2009-10-24

    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?

     
  • Francois VOGEL

    Francois VOGEL - 2009-10-24

    Well I have just checked on 8.5.7 HEAD: this bug seems to be fixed now.

     
  • Donal K. Fellows

    • assigned_to: hobbs --> dkf
    • status: open --> closed-fixed