[wx-dev] what should IsEnabled() really return?

Armel Asselin asselin.armel at wanadoo.fr
Fri Mar 16 10:32:13 PDT 2007


> we've discussed this before (see
> http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/70961/) but 
> without
> any real conclusion, so I'd like to ask this question again: what should
> IsEnabled() return for a window which wasn't disabled itself explicitly 
> but
> whose parent is currently disabled, so effectively disabling (as in
> "preventing it from getting input") this window too?
>
> Currently the return value in this case is true, but I think it would make
> more sense to return false. If not, we should at least add some
> IsEffectivelyEnabled() which would return true if and only if the window 
> is
> really enabled. But it would be IMO even better to just make IsEnabled()
> behave like this.
wxWindow::IsEnabled should return <value> when Enable(<value>) was used, 
mainly for logical purpose
the other solution which is IsEnabled() returning the logical AND of an item 
and its parents enabled state is still OK as long as it is well documented 
and that a IsLocallyEnabled (or IsEnabledItself or whatever) is also 
available.

a 'local' variant of the function is rather important from a testing point 
of view for new widgets (i.e. so that tests such as 'did Enable( ) set the 
flag correctly?' is still possible).

Regards
Armel






More information about the wx-dev mailing list