Hi Alex! I think, that is not correct. The states-object in the style function of a sub-widgets holds only the states set in the sub-widget, not in the parent widget.
I wrote a little test: If a Atom has the state "test", the backgroundColor of the label-object shoud be "red". Here he code of the Application: // Create tree Atoms // the first sets the state "test" in atom var atom1 = new qx.ui.basic.Atom("Atom 1 (state in atom)", "qxtest/test.png"); atom1.setAppearance("myatom"); atom1.addState("test"); // the second sets the state "test" in label var atom2 = new qx.ui.basic.Atom("Atom 2 (state in atom.label)", "qxtest/test.png"); atom2.setAppearance("myatom"); atom2._getChildControl("label").addState("test"); // the third without state var atom3 = new qx.ui.basic.Atom("Atom 3 (state in atom.label)", "qxtest/test.png"); atom3.setAppearance("myatom"); // Document is the application root var doc = this.getRoot(); // Add button to document at fixed coordinates doc.add(atom1, {left: 100, top: 50}); doc.add(atom2, {left: 100, top: 100}); doc.add(atom3, {left: 100, top: 150}); Here my Appearance-Theme: qx.Theme.define("qxtest.Appearance", { extend : qx.theme.modern.Appearance, title: "konrad appearance theme", appearances : { "myatom" : {}, "myatom/label" : { style : function(states) { return { textColor : states.disabled ? "text-disabled" : undefined, backgroundColor : states.test ? "red" : undefined }; } }, "myatom/icon" : {} } }); The result is, that when I add the state "test" to te Atom, the background is NOT "red". Only when I add the state directly to the lable-object, the background turns to "red". So I think, the states-object of a sub-widget represents only the states of the sub-widget, not the parent widget. Any idea how to access the state of the parent widget in the appearance of a sub-widget. (In my application, I set states to widets and I don't know which widget it is, so I can't set states to specific sub-widgets). Thanks, Erich Alexander Back schrieb: > Hi Erich, > > Erich Konicek wrote: > >> Hi! >> >> Is it possible in qx 0.8 Appearance definition to get the states of the >> partent widget >> inside the appearance definition of a sub widget? >> > Yes, every sub-widget has access to all states set by the parent widget. > > >> E.g. >> I want to change the background color or the icon in a checkbox widget >> depending on the states of the checkbox. >> Something like this: >> >> appearances : >> ... >> "checkbox/icon" : { >> style : function(states) >> { >> return { >> backgroundcolor : STATES_OF_CHECKBOX.disabled ? "disabled" : >> undefined; >> }; >> } >> }, >> ... >> >> What's the way to do this? >> > You have to use the "states" object given as parameter to the "style" > method instead of using the "STATES_OF_CHECKBOX" variable. > > --snip-- > "checkbox/icon" : { > style : function(states) > { > return { > backgroundcolor : states.disabled ? "disabled" : undefined; > }; > } > }, > --snip-- > > cheers, > Alex > > P.S. I opened the bug #1470 ( > http://bugzilla.qooxdoo.org/show_bug.cgi?id=1470 ) to ensure that the > states of each widget are shown (again) in the API Viewer. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel