Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

No callback when re-selecting in choice%

Aperta
#217 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Ambito
desktop

Direzione di ricerca

Inizia dall’implementazione di choice% e dalla documentazione choice% collegata, utilizzando l’esempio #lang racket/gui fornito per riprodurre il comportamento del callback su Linux. Confronta i criteri del callback documentati con il comportamento osservato e verifica il risultato nei casi di piattaforma pertinenti; il lavoro è completato quando il comportamento o la documentazione sono resi coerenti e testati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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).

Lingua principale
Racket
Stelle
68
Fork
83
Merge medio
21h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di racket/gui

Tutte le issue di racket/gui

Issue simili

Altre issue su Desktop Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.