Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Any better way to show tooltips on menu items?

$
0
0
I've seen some years ago there was a guy complaining for the lack of a way to show a tooltip/prompt for menu items.
I made tooltips available on my menu items exploiting the ListGrid nature of menus. Here you are a raw example

Code:

final Menu menu = new Menu();
menu.setCanHover(true);

final ListGridField[] fields = menu.getFields();
for (final ListGridField listGridField : fields) {
    listGridField.setShowHover(true);
    listGridField.setHoverCustomizer(new HoverCustomizer() {
        @Override
        public String hoverHTML(final Object value, final ListGridRecord record, final int rowNum,
                        final int colNum) {
            //return prompt text following proper logic i.e. accessing an array of menu items
            return myItems[rowNum].getPrompt();
        }
    });
}
//add items to menu

I left here this example in the interest of other folks that need the same.
Just wondering if there's a better way to achieve the same :-)

It works on Smartgwt 3.0

Viewing all articles
Browse latest Browse all 4756

Trending Articles