Is there an easy way to disable a GUI element?

26 views
Skip to first unread message

Ryan Kramer

unread,
Sep 2, 2021, 5:39:36 PMSep 2
to Racket Users
I see that button% has an `enabled` field, but I'm not seeing anything for slider%, text-field%, and choice%. If I want to disable these elements, do I have to roll my own enable/disable logic? Also, is there a way to change a button's `enabled` status after it is created? Thanks.

George Neuner

unread,
Sep 3, 2021, 2:00:37 AMSep 3
to racket...@googlegroups.com


On 9/2/2021 5:39 PM, Ryan Kramer wrote:
I see that button% has an `enabled` field, but I'm not seeing anything for slider%, text-field%, and choice%. If I want to disable these elements, do I have to roll my own enable/disable logic? Also, is there a way to change a button's `enabled` status after it is created? Thanks.

All the controls respond to window<%> messages: e.g., (send mybutton  enable #t)
    https://docs.racket-lang.org/gui/window___.html

Whenever possible, you should try to use object messaging / method calls rather than directly messing with fields in the objects (even if the fields are public).
    https://docs.racket-lang.org/reference/ivaraccess.html



Ryan Kramer

unread,
Sep 3, 2021, 11:01:04 AMSep 3
to Racket Users
Perfect, thanks. I thought I explored all the relevant interfaces but I must have overlooked window<%>.
Reply all
Reply to author
Forward
0 new messages