Thank you for your answer Alex. But what if the backgroundcolor is unknown until the widget is instantiated?

The solution would be to have access to the widget instance properties within the state function/method of the appearance.

How can this be solved? Sebastian? Any Idea?


Alex D. schrieb:
Hi Dietrich,

i'm not sure this is this the correct way to do this, but you can try 
smth. like this:
for( var i=0; i<listitems.length; i++)
{
    listitems[i].addState("color"+[i]);
}
so all listitems have different States(color1, color2, color3...)
and then:
theme.registerAppearance("colored-list-item", {
setup : function() {
{
    this.color1 = new qx.renderer.color.ColorObject("#FFFFF1");
    this.color2 = new qx.renderer.color.ColorObject("FFFFF2");
    .
    .
},
and:

state : function(vTheme, vStates)
{
    return {
    backgroundColor : vStates.color1 ? this.color1 : (vStates.color2 ? : 
this.color2..........
};
}

this is nothing i have tested - just an idea. I'm sure there should be a 
better way to do this.

Cheers,
alex.d

  
Hello List,

I'd like to create an appearance where I'm able to set the state 
appearance depending on a widgets property. In the example above I've 
defined a property backgroundColorUnselected which is set for each 
instance individually.

So if the state changes to unselected the value of this property should 
be passed back by the state part of the appearance. Before the last 
changes to the appearance theme there was a parameter vWidget which 
contained the instance of the widget the appearance was associated with. 
How can this be done?

Here is an appearance skeleton which should help to understand my needs:

  theme.registerAppearance("colored-list-item", {
    setup : function() {
    {
      this.bgcolor_selected = new 
qx.renderer.color.ColorObject("highlight");
      this.color_selected = new 
qx.renderer.color.ColorObject("highlighttext");
    },

    initial : function(vTheme)
    {
       /* initial code here */
    },

    state : function(vTheme, vStates)
    {
        return {
          backgroundColor : vStates.selected ? this.bgcolor_selected : 
widgetInstance.getBackgroundColorUnselected(),
          color : vStates.selected ? this.color_selected : null
        };
    }
  });

Thank you for your help.

Best regards...

  
    

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
  

-- 
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to