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

The Reference specifies how to set the enabled/disabled status of a window/control/etc, and there is also on-superwindow-enable, 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.

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

Alex.

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

1 Like