PDA

View Full Version : How to set font-family style to each comboBox element



andypower
16 Feb 2012, 6:12 AM
Hi, I need to realize a comboBox displaying a list of safe browser font-family.
I would like to display every single element using the corrispondent font-family style.

Pseudo code:
ComboBox comboBox = new ComboBox();
ListStore store = new ListStore(SafeBrowserFontFamily.getElementList);
int i = 0;
for(El comboBoxElement : comboBox.getElementList()){
comboBoxElement.setStyle("font-family", store.getModel(i).getFontFamilyName);
i++;
}

Someone can suggest me the right way?

andypower
16 Feb 2012, 11:18 AM
Solved the problem! This is a scratch of my code. I hope that can be usefull to some one else.



this.fontFamilyComboBox.addListener(Events.OnClick, new Listener<BaseEvent>() {

@Override
public void handleEvent(BaseEvent be) {
ListView<GPFontFamilyValue> listView = fontFamilyComboBox.getView();
int i = 0;
for (Element element : listView.getElements()) {
element.getStyle().setProperty("fontFamily", (String)listStore.getAt(i).get(CssParameterName.FONT_FAMILY.getValue()));
element.getStyle().setFontSize((fontSizeField.getValue()).intValue(), Style.Unit.PX);
element.getStyle().setFontWeight((boldToggle.isPressed() ? Style.FontWeight.BOLD : Style.FontWeight.NORMAL));
element.getStyle().setFontStyle((italicToggle.isPressed() ? Style.FontStyle.ITALIC : Style.FontStyle.NORMAL));
i++;
}
}
});

standford
24 Feb 2012, 3:28 AM
Thanks......Thanks friend......i wa looking for this code from 2 to 3 months..........thanks.....
Kamagra online (http://www.bluepharmarx.com/cheap/kamagra-online.php/)|kamagra soft tab (http://www.bluepharmarx.com/cheap/kamagra-soft-tabs-online.php)|Buy suhagra (http://www.bluepharmarx.com/cheap/suhagra-online.php)

andypower
27 Feb 2012, 3:48 AM
Thanks......Thanks friend......i wa looking for this code from 2 to 3 months..........thanks.....

I am happy to know that my code was useful to someone else!

Enjoy it ;)

standford
27 Feb 2012, 4:20 AM
Thanks for giving reply........Please keep in touch with me...............