wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

WindowShape loaded via Module seems to reset styles #97

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create simple app like attached which loads a module which includes a
WindowShape component.

2. When the Module with the WindowShape is loaded it looks like all the
styles are refreshed. In the attached example you only see a little
flickering but when you have a larger Module it looks pretty ugly like e.g.
all icons of buttons switch to no image and back to the icon, the
backgroundcolor is set to default and back to the set color etc.

3. If you comment in the dummy WindowShade in the Test.mxml the problem
(flickering) does not occur.

What is the expected output? What do you see instead?
When loading a Module with WindowShape the first time the layout looks like
it is refreshed/corrupted.

What version of the product are you using? On what operating system?
2.4

Please provide any additional information below.

Original issue reported on code.google.com by soenke.r...@gmail.com on 10 Mar 2008 at 1:41

Attachments:

GoogleCodeExporter commented 8 years ago
I'm inclined to think this is simply the way modules work rather than anything
specific to the WindowShade. In a normal app, the initialization of styles is
something that happens before the screen renders the first time, I suppose. 
When you
load a module with classes that aren't included in the main app, that all has to
happen on-the-fly for those classes.

Is there a reason you can't statically link the WindowShade in your main app, 
like
your commented code does?

Original comment by xslf...@gmail.com on 17 Mar 2008 at 3:13

GoogleCodeExporter commented 8 years ago
I am now linking to WindowShade statically in my main app but I think this is a 
workaround.
Generally there would be no need that my main app knows WindowShade or perhaps 
other UI components. The 
workaround is of course pretty simple but I doubt this should be the normal 
way. I am not sure but I did not link 
many other components not within my main app and I am not facing the problem 
described for the 
WindowShade.

Original comment by soenke.r...@gmail.com on 25 Mar 2008 at 10:07

GoogleCodeExporter commented 8 years ago
The "static constructor" in WindowShade gets called, in my code, when the first 
instance of a WindowShade object is created. Since this is only when that part 
of 
the UI is used it means I get a nasty flash in my entire UI when the user 
displays 
the WindowShade.

Also, using the StyleManager.setStyle method is resource intensive and means 
everything updates its style.

I wonder if you could achieve the same effect by overriding getStyle in 
WindowShade 
and either getting the style property value through the StyleManager, if the 
style 
exists, or getting the default value from WindowShade's static fields.  That 
way you 
would not need to update the styles through the StyleManager at all.

Something like:

override public function getStyle(styleProp:String):*
{
    var css:CSSStyleDeclaration = StyleManager.getStyleDeclaration("WindowShade");
    if (css != null && StyleManager.isValidStyleValue(css.getStyle(styleProp)))
    {
        return css.getStyle(styleProp)
    }
    else
    {
        return styleDefaults[styleProp];
    }
}

Original comment by Richa...@i2.co.uk on 4 Jun 2008 at 11:08

GoogleCodeExporter commented 8 years ago

Original comment by dmcc...@gmail.com on 8 Jan 2009 at 4:50