Hi,
I built a tool bar with horizontal layout which has several buttons but I want menu bar styles to be added to it. I tried using css layout but css layout doesn’t solve my purpose completely as I right align 3 buttons and left align 5 buttons using set expand ratio in horizontal layout and css layout doesn’t have setexpandratio method.
So can anyone tell me way to make horizontal layout style similar to menubar/toolbar styles.
There is a couple of options.You could use css float to mimic expand ratios. You could also put most of the theming on the buttons themselves, not requiring you to theme the horizontal layout. You could also wrap the horizontallayout into a csslayout and theme that csslayout to add your menu styles.
This is assuming your on Vaadin 6. In Vaadin 7 you have the possibility to theme the horizontallayout directly.
Looks good! Only thing I have a little gripe about is the word ‘!important’. It might not be a actual case for you, but it makes it a lot harder to override in a later stage, just like you have overridden the default value from the Vaadin theme. It is better to make it more specific than that that you want to override, for example your code might not be the most accurate without the !important word, but it might be if you change it to .v-button.v-button-floatright { float:right; }
It is just a good practice to learn not to use !important. a more realistic case can be that you make a default font globally for your application and mark it with !important, then you want to change the font for buttons, and you’ll have a bit harder to make it as there isn’t something called !superimportant