Another solution, is to set a flag in the widget when the enabled state is set directly
myWidget.setEnabled(true); myWidget.myFlag = true; This is an easy and safe way to solve my issue, thanks to the ability to add any property to an object. T.J. Crowder wrote: > > Hi, > > (Warning: Qooxdoo noob here.) > >> I have a widget that can be disabled directly because some other widget, >> from which it depends, isn't available. >> It can also be disabled if the parent widget is disabled (inside a >> CheckGroupBox). > > Just asking: Why does your widget need to know the difference? As long > as > you set "enabled" to "inherit" (not true) when you want your widget > enabled > provided its parent is, why does it need to know why it's disabled? > > When it's enabled, it's easy for it to tell whether it's enabled because > it's relying on its parent or because someone forced it to be enabled: > widget.getEnabled() will return "inherit" when it's inheriting, or true > when > it has been forced and doesn't care about its parent's state. But as you > point out, when the widget is DISabled, you get back false in both > situations because you get the computed value. Which is, I think, the > problem you're asking about. > > Experts: Is there any accessor for the raw value of a property? Both > widget.getEnabled() and widget.get("enabled") return the same value (which > is reassuring). Perhaps -- if dperez has a good use case -- there's a > justification for a "getRaw" method or similar? > -- > T.J. Crowder > tj at crowder software dot com > > ----- Original Message ----- > From: "dperez" <[EMAIL PROTECTED]> > To: <qooxdoo-devel@lists.sourceforge.net> > Sent: Tuesday, October 02, 2007 12:18 PM > Subject: Re: [qooxdoo-devel] Value of inherited property > > >> >> I know the path I've taken isn't public API, and have its risks. >> >> I have a widget that can be disabled directly because some other widget, >> from which it depends, isn't available. >> It can also be disabled if the parent widget is disabled (inside a >> CheckGroupBox). >> >> >> Sebastian Werner wrote: >>> >>> Not to mention that this code is generated and that the values are >>> private. You shouldn't access these directly. You are warned ;) >>> >>> There is currently no way to detect if the value comes from the >>> inheritance or from a local value. In all cases I know this also >>> makes not really sense. What is the exact szenario you need this for? >>> Would be interesting. Maybe there is another way to solve the whole >>> issue. >>> >>> Sebastian >>> >>> >>> Am 01.10.2007 um 16:08 schrieb dperez: >>> >>>> >>>> Here is the code for the getEnabled function: >>>> >>>> function getEnabled(value) { >>>> if (this.__inherit$enabled !== undefined) { >>>> return this.__inherit$enabled; >>>> } else if (this.__user$enabled !== undefined) { >>>> return this.__user$enabled; >>>> } else { >>>> return this.__init$enabled; >>>> } >>>> } >>>> >>>> As a temporary solution, I can use this.__user$enabled >>>> >>>> >>>> dperez wrote: >>>>> >>>>> Thanks Crowder for your info, but still don't know how to tell the >>>>> difference. >>>>> >>>>> >>>>> T.J. Crowder wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> Total Qooxdoo noob here, but >>>>>> http://qooxdoo.org/documentation/0.7/properties >>>>>> has this info which may or may not help: >>>>>> >>>>>> "The apply method may optionally be defined for each property you >>>>>> add to >>>>>> your class. As soon as you define a key "apply" in your property >>>>>> declaration >>>>>> map the method gets automatically called on each property >>>>>> modification >>>>>> (but >>>>>> not during initial initialization). If you do not define an apply >>>>>> method, >>>>>> the property just handles the fundamental storage of your data >>>>>> and its >>>>>> disposal." >>>>>> >>>>>> Apologies if this is completely off-base, but since it's not called >>>>>> during >>>>>> initial initialization, maybe an apply method would help. >>>>>> -- >>>>>> T.J. Crowder >>>>>> tj at crowder software dot com >>>>>> >>>>>> ----- Original Message ----- >>>>>> From: "dperez" <[EMAIL PROTECTED]> >>>>>> To: <qooxdoo-devel@lists.sourceforge.net> >>>>>> Sent: Monday, October 01, 2007 12:17 PM >>>>>> Subject: [qooxdoo-devel] Value of inherited property >>>>>> >>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> How can I know if for a given widget, it has been called >>>>>>> widget.setEnabled(false) or is inheriting this value from its >>>>>>> parent >>>>>>> container widget.getParent().setEnabled(false) ? >>>>>>> >>>>>>> I have registered a changeEnabled event to my widget, and I must >>>>>>> tell >>>>>>> the >>>>>>> difference between these 2 situations. >>>>>>> >>>>>>> Thanks for any possible answer. >>>>>>> >>>>>>> Regards, >>>>>>> David >>>>>>> -- >>>>>>> View this message in context: >>>>>>> http://www.nabble.com/Value-of-inherited-property- >>>>>>> tf4547683.html#a12977264 >>>>>>> Sent from the qooxdoo-devel mailing list archive at Nabble.com. >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------- >>>>>>> ------ >>>>>>> This SF.net email is sponsored by: Microsoft >>>>>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>>>>> _______________________________________________ >>>>>>> qooxdoo-devel mailing list >>>>>>> qooxdoo-devel@lists.sourceforge.net >>>>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>>>>> >>>>>> >>>>>> -------------------------------------------------------------------- >>>>>> ----- >>>>>> This SF.net email is sponsored by: Microsoft >>>>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>>>> _______________________________________________ >>>>>> qooxdoo-devel mailing list >>>>>> qooxdoo-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: http://www.nabble.com/Value-of- >>>> inherited-property-tf4547683.html#a12979875 >>>> Sent from the qooxdoo-devel mailing list archive at Nabble.com. >>>> >>>> >>>> ---------------------------------------------------------------------- >>>> --- >>>> This SF.net email is sponsored by: Microsoft >>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>> _______________________________________________ >>>> qooxdoo-devel mailing list >>>> qooxdoo-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> qooxdoo-devel mailing list >>> qooxdoo-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Value-of-inherited-property-tf4547683.html#a12996875 >> Sent from the qooxdoo-devel mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> qooxdoo-devel mailing list >> qooxdoo-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > -- View this message in context: http://www.nabble.com/Value-of-inherited-property-tf4547683.html#a13013969 Sent from the qooxdoo-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel