Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

No callback when re-selecting in choice%

Đang mở
#217 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu với phần triển khai choice% và tài liệu choice% được liên kết, sử dụng ví dụ #lang racket/gui được cung cấp để tái hiện hành vi callback trên Linux. So sánh các tiêu chí callback được ghi trong tài liệu với hành vi quan sát được và xác minh kết quả trên các trường hợp nền tảng liên quan; được xem là hoàn tất khi hành vi hoặc tài liệu được làm cho nhất quán và đã được kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Racket
Star
68
Fork
83
Merge trung bình
21 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của racket/gui

Tất cả issue của racket/gui

Issue tương tự

Thêm issue về Desktop Dev

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.