I am new in Flex. Was just wondering what is the difference between skin and CSS??
Why it is better to use skin over CSS in Flex. Could anybody please clear my doubt.
Thanks!!!
CSS usually sets the styles (colors, etc) on the out-of-the-box skin. Skins allow you to completely replace the visual appearance of a component with anything you want (images, vectors, whatever).
Here is a great example on creating custom skins. In my experience, I had to create an Up-state background color on a LinkButton, which when using the default skin cannot be set. By creating a custom skin, I was able to create functionality to respond to the color values I wanted.
So in short you can do a lot more with skins.
Related
We would like to work with the datagrid but we have an issue with the buttons in all our site.
Once Clarity is installed it is not possible anymore to make small square buttons.
In a kind of way the minimum width of every buttons seems to be overidden by something in your system.
Is there a way to seperate distinct components of the Clarity Design System ? Or maybe exclude some of them ?
Are you aware of this issue with button minimum width ? Do you know a way to prevent this behavior ?
Many thanks.
The styles for Clarity are bundled as a single unit, so you would have to build the styles yourself and only build the pieces needed for the Datagrid. Some details can be found near the bottom of the themes documentation about custom themes https://vmware.github.io/clarity/documentation/v0.11/themes. You'd have to go further by trying to remove everything else. Then you could just import the ClrDatagridModule from #clr/angular into your Angular application.
However, I cannot guarantee that you'll be able to avoid the button issue because the datagrid has buttons and we don't recommend building just isolated pieces of Clarity (we don't know how well it will work in practice).
You can always overwrite any CSS with your own to reset something like the buttons min-width property. We set some values like that to ensure that things are properly accessible for users, so I'm not sure exactly what your limitation is but probably the best thing to do is just override the Clarity styles when necessary.
Thanks for your help.
I managed to neutralize the button behavior by adding the following code to my css file.
.btn {
min-width: unset;
min-height: unset;
}
I want to change the background color of my Vaadin app on the valueChange event of a OptionGroup component.
As there are a fairly big number of layouts on my page, what would be the best is to change every HorizontalLayout and VerticalLayout background-color, but every new component that could be added should have this color too.
How can I achieve that? Thanks.
Two approaches come to mind.
The simplest, conceptually, as well as in terms of implementation, would be to have a single component to serve as the background, and give your HorizontalLayout and VerticalLayout components a transparent background. If you're layout is too complex for this, you can have a number of base 'background' components, again, with your layout components on top being transparent. The idea is to reduce the components whose color you need to change to something manageable.
If that approach doesn't translate to your use case, you can always use JavaScript to select the layout components on the fly and redefine their background. This could be made more manageable by giving all the layout components a common CSS class (eg: 'dynamic-background').
JavaScript.getCurrent().execute("$('.dynamic-background').css('background-color', 'purple')");
Note that this JavaScript depends on JQuery, have a look around for more details on integrating JQuery with Vaadin:
Add javascript/Jquery & client side code in Vaadin 7
Integrating HTML and JavaScript in Vaadin 7
I am using Flex 4.9. I thought that with the newest SDK, they finally made Flex and CSS components tags to work. But they did not.
I tried to set horisontalAlign and verticalAlign of spark HGroup vie CSS style, so I could manage it smoothly and save some code typing. HGroups didnt respond to CSS style I applied, ok, I thought that at least I will set their width. It also did not work! Nor pixel width or percent value.
Does Flex CSS styling is really so limited or am I missing something?
horizontalAlign, verticalAlign, width and height are all properties of the HGroup class, not styles. Hence you cannot set these properties through stylesheets.
What you seem to be missing is that Flex is not HTML and that the same semantics do not apply. In Flex 4 we separate the content from the way it is presented mainly through a process called skinning: we declare components and their logic in one class (usually in ActionScript) and we define its visual representation in another (usually written in MXML).
With this separation already in place there is hardly any need for stylesheets. In fact, if you would put a CSS on top of that, you would kind of artificially try to separate the layout into two separate entities which doesn't make much sense. Not to mention it would make the code much harder to read.
There is a case where CSS comes in handy though, that is when you want to apply a certain visual style throughout your application. A Button could have five different skins, but through CSS you could set the font color of all five to a specific color without repeating that in each skin.
I find Bootstrap insufficiently flexible. For example there's not a straightforward way to change font or line-height properties. I want a one-line method to change these properties.
What else can I use similar to Bootstrap (that I'm sure will not be as rich)? I just need some style collections that are flexible for those kinds of changes.
You can change all of the typography values (and pretty much everything else) on the Customize Page. The links are in the toolbar at the top of most pages of the Bootstrap site.
How can I modify standart style of progress bar controll?
If you want full control over the style, you can create your own programmatic skins and replace the default skins. Look at ProgressBarSkin, ProgressBarIndeterminateSkin, ProgressBarMaskSkin and ProgressBarTrackSkin in the SDK to see how they are drawn by default. You can then create your own versions of those skin files and draw them however you like. Then you just set those skin files to your ProgressBar. You can do that directly in MXML, or set it in CSS to change all of the ProgressBars in your app. Hope that helps.