Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e4f32f878bcd2c8db77eb1b701a8eae1b1496f05ce33705621ff0e4ecb0d1855
Ticket: ce6b428620dd89bc46786654e3aa1d62d74d3fc8
<<Increment>> event is endlessly triggered once messagebox closes
User & Date: fvogel on 2022-02-18 21:20:20
Changes

  1. icomment:
    The problem is due to the following. When clicking the up arrow of the spinbox, an <<Increment>> virtual event is generated from ttk::spinbox::Press. This event is repeatedly generated:
    
    <code>ttk::Repeatedly event generate $w <<Increment>></code>
    
    ttk::Repeatedly runs its provided script (<code>event generate $w <<Increment>></code>) and after this script returns schedules a repeated run of this same script. The order of what is happening here is important.
    
    This re-scheduling repeats until the up arrow button is released (mouse button up), at which time ttk::spinbox::Release gets called, which calls ttk::CancelRepeat to, well... cancel the repeat!
    
    This implementation allows to increment repeatedly the spinbox value by pressing and maintaining the up arrow down. Incrementation starts when pushing down the mouse button on the up arrow, and it stops when releasing the mouse button.
    
    Now, with this implementation, when the script bound to <code>event generate $w <<Increment>></code> includes instructions that allow the event loop to run before the script returns, the ttk::CancelRepeat call from the mouse button release will run from inside the bound script instead of after this script has finished. Since the Repeat(timer) value that is used to identify what needs to be cancelled is only set AFTER the return of the bound script, the cancel call will have no effect.
    
    The fix therefore is to swap the order of script execution and repetition scheduling, see [fb9a363237].
    
  2. login: "fvogel"
  3. mimetype: "text/x-fossil-wiki"
  4. resolution changed to: "Fixed"