No callback when re-selecting in choice%
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 68
- Forks
- 82
- PR merge metrics
- No merged PRs in 30d
Description
When using Racket 8.0 under Kubuntu 20.04 (Qt version 5.12.8, KDE Frameworks version 5.68.0), the callback function in choice% is not called when clicking on the already selected item, but only when clicking on a different item. I was not able to test on a different system, but as explained in this reddit post @sorawee tried the code on both Linux and Mac OS and was only able to reproduce the bug on the former.
This example reproduces the behavior:
#lang racket/gui
(define main-window (new frame% [label "Callback test"] [width 400] [height 400] [border 10]))
(new choice%
[label "Choice"]
[parent main-window]
[choices (list "Option A" "Option B" "Option C")]
[callback
(lambda (c e) (new message% [parent callback-log]
[label (string-append (symbol->string (send e get-event-type))
" event @"
(number->string (send e get-time-stamp)))]))])
(define callback-log
(new group-box-panel% [parent main-window]
[label "List of callback events:"]
[min-height 200]))
(send main-window show #t)
It might be interesting to consider rewording the documentation for choice%, since two slightly different criteria are given for when the callback is invoked. It first says (emphasis mine):
Whenever the selection of a choice item is changed by the user, the choice item’s callback procedure is invoked.
which implies that the newly selected item needs to be different from the previously selected one, yet a bit later it says:
The callback procedure is called (with the event type 'choice) when the user selects a choice item (or re-selects the currently selected item).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the choice% implementation and the linked choice% documentation, using the provided #lang racket/gui example to reproduce the callback behavior on Linux. Compare the documented callback criteria with the observed behavior and verify the result across the relevant platform cases; done means the behavior or documentation is made consistent and tested.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100