开发者

styleManager: problem using setStyleDeclaration

Hey folks..!!

I m using styleManager.setStyleDeclaration to set the CssStyleDeclaration object for more then one instance of the same component, that is being used in different canvases.

I want to set different properties of this component in various canvases, but it wont happen as setStyleDeclaration takes name of the component and set styles to it globally, i suppose.

following is the first cssstyledeclaration:

this.dataTickerOddStyle = new CSSStyleDeclaration();
        this.dataTickerOddStyle.setStyle("fillColors", StringUtilEx.ExtractColorPair(o.DataTicker.Item[0].Background_Fill_Colors));
        this.dataTickerOddStyle.setStyle("fillAlphas", StringUtilEx.ExtractNumberPair(o.DataTicker.Item[0].Background_Fill_Alphas));
        this.dataTickerOddStyle.setStyle("gradientRatio", StringUtilEx.ExtractNumberPair(o.DataTicker.Item[0].Background_Gradient_Ratios));
        this.dataTickerOddStyle.setStyle("cornerRadius", int(o.DataTicker.Item[0].Background_Corner_Radius));
        this.dataTickerOddStyle.setStyle("borderColor", StringUtilEx.ConvertToColor(o.DataTicker.Item[0].Background_Border_Color));
        this.dataTickerOddStyle.setStyle("borderThickness", Number(o.DataTicker.Item[0].Background_Border_Thickness));<br>

This is how i ve used it:

this.styleManager.setStyleDeclaration("com.GradientCanvas",WidgetStylesheet.instance.dataTickerOddStyle, true);

and another cssstyledeclaration is:

this.m_zoneBackgroundStyle = new CSSStyleDeclaration();
        this.m_zoneBackgroundStyle.setStyle("fillAlphas", StringUtilEx.ExtractNumberPair(o["Background_Fill_Alphas"]));
        this.m_zoneBackgroundStyle.setStyle("fillColors", StringUtilEx.ExtractColorPair(o["Background_Fill_Colors"]));
        this.m_zoneBackgroundStyle.setStyle("gradientRatio", StringUtilEx.ExtractNumberPair(o["Background_Gradient_Ratios"]));
        this.m_zoneBackgro开发者_高级运维undStyle.setStyle("borderColor", StringUtilEx.ConvertToColor(o["Background_Border_Color"]));
        this.m_zoneBackgroundStyle.setStyle("borderThickness", Number(o["Background_Border_Thickness"]));
        this.m_zoneBackgroundStyle.setStyle("cornerRadius", Number(o["Background_Corner_Radius"]));

and for this i use following:

this.fill.styleManager.setStyleDeclaration("com.GradientCanvas", AppStylesheet.instance.m_zoneBackgroundStyle, true);<br>

Notice that i m using same selector/component..Please help me out on this..thanx in advance


I resolved the problem. I was using Type Selector before, instead of Class Selector.


(not sure I fully understand what you're getting at.. but.. )

You can set the style on a single component instance without changing the global style.

component.setStyle( ... ) 

instead of

CSSStyleDeclaration.setStyle( ... )
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜