# How do I find the (dis|en)enabled status of a control?

**URL:** <https://racket.discourse.group/t/how-do-i-find-the-dis-en-enabled-status-of-a-control/1242>\
**Category:** Questions & Answers\
**Tags:** gui\
**Created:** [August 19, 2022, 9:13pm UTC](https://racket.discourse.group/t/how-do-i-find-the-dis-en-enabled-status-of-a-control/1242 "2022-08-19T21:13:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [August 19, 2022, 9:13pm UTC](https://racket.discourse.group/t/how-do-i-find-the-dis-en-enabled-status-of-a-control/1242/1 "2022-08-19T21:13:06Z")

</div>

The Reference specifies how [to set](https://docs.racket-lang.org/gui/window___.html#(meth._(((lib._mred%2Fmain..rkt)._window~3c~25~3e)._enable))) the enabled/disabled status of a window/control/etc, and there is also [on-superwindow-enable](https://docs.racket-lang.org/gui/window___.html#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._window~3c~25~3e%29._on-superwindow-enable%29%29), which provides a hook for handling state changes to a window's enabled/disabled status, but I can't find anything that specifies how to query the current status.

More detail: I'm creating a dialog with the 'Ok' button initially disabled. It will be enabled by the validator for the dialog's text field. I want the text field's callback to handle `'text-field-enter` (i.e. the user hitting 'Enter' while the text field has focus) by closing the window if the Ok button is currently enabled.

I suppose a possible alternate solution would be to have the text field's callback send a 'click' event to the Ok button, which would presumably ignore it if the button was in the disabled state. I'd need to do more digging to figure out how to do that, and I'd still like to know how to check the enabled/disabled status on a control or window.

---

<div class="post-metadata">

**Author:** ![alexh](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/alexh/32/315_2.png) [@alexh](https://racket.discourse.group/u/alexh)\
**Post date:** [August 19, 2022, 10:29pm UTC](https://racket.discourse.group/t/how-do-i-find-the-dis-en-enabled-status-of-a-control/1242/2 "2022-08-19T22:29:50Z")

</div>

> [@dstorrs](#):
>
> but I can't find anything that specifies how to query the current status.

You can use the `is-enabled?` method to check if a control is enabled or not.

Alex.

---

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [August 20, 2022, 1:34am UTC](https://racket.discourse.group/t/how-do-i-find-the-dis-en-enabled-status-of-a-control/1242/3 "2022-08-20T01:34:29Z")

</div>

Ah. Drat, how did I miss that? Thanks, Alex.
