@@ -205,26 +205,38 @@ number of coroutines.
205
205
### 4.1.1 The suppress constructor argument
206
206
207
207
When the button is pressed ` press_func ` runs immediately. This minimal latency
208
- is ideal for applications such as games, but does imply that in the event of a
209
- long press, both ` press_func ` and ` long_func ` run: ` press_func ` immediately and
210
- ` long_func ` if the button is still pressed when the timer has elapsed. Similar
211
- reasoning applies to the double click function .
208
+ is ideal for applications such as games. Consider a long press: ` press_func `
209
+ runs initially, then ` long_func ` , and finally ` release_func ` . In the case of a
210
+ double-click ` press_func ` and ` release_func ` will run twice; ` double_func ` runs
211
+ once .
212
212
213
213
There can be a need for a ` callable ` which runs if a button is pressed but
214
- only if a doubleclick or long press function does not run. The soonest that the
215
- absence of a long press can be detected is on button release. The absence of a
216
- double click can only be detected when the double click timer times out without
217
- a second press occurring.
214
+ only if a doubleclick or long press function does not run. The ` suppress ` arg
215
+ changes the behaviour of ` release_func ` to fill that role. This has timing
216
+ implications.
218
217
219
- This ` callable ` is the ` release_func ` . If the ` suppress ` constructor arg is
220
- set, ` release_func ` will be launched as follows:
218
+ The soonest that the absence of a long press can be detected is on button
219
+ release. Absence of a double click can only be detected when the double click
220
+ timer times out without a second press occurring.
221
+
222
+ Note ` suppress ` affects the behaviour of ` release_func ` only. Other callbacks
223
+ including ` press_func ` behave normally.
224
+
225
+ If the ` suppress ` constructor arg is set, ` release_func ` will be launched as
226
+ follows:
221
227
1 . If ` double_func ` does not exist on rapid button release.
222
228
2 . If ` double_func ` exists, after the expiration of the doubleclick timer.
223
229
3 . If ` long_func ` exists and the press duration causes ` long_func ` to be
224
230
launched, ` release_func ` will not be launched.
225
231
4 . If ` double_func ` exists and a double click occurs, ` release_func ` will not
226
232
be launched.
227
233
234
+ In the typical case where ` long_func ` and ` double_func ` are both defined, this
235
+ ensures that only one of ` long_func ` , ` double_func ` and ` release_func ` run. In
236
+ the case of a single short press, ` release_func ` will be delayed until the
237
+ expiry of the double-click timer (because until that time a second click might
238
+ occur).
239
+
228
240
### 4.1.2 The sense constructor argument
229
241
230
242
In most applications it can be assumed that, at power-up, pushbuttons are not
0 commit comments