PDA

View Full Version : when user restore ToolBar exceded IconButton not moving to AutoHide Menu(>>)



Laxmikanth
16 May 2012, 8:37 AM
Hi ,
when user restore the ToolBar (make browser height and width small) , Lets assume my Tool Bar is having total 10 Buttons(2 are Button & 8 are IconButton instances),after restoring user can able to see only 5 icons, remaining 5 icons should automaticaly move to Toolbar autohides Menu(>>),
But In my case only 2 Button instances are adding to ToolBar AutoHide Menu(>>),IconButtons are not adding to AutoHide Menu(>>)

Is this bug or any special reason to avoid IconButtons to AutoHide Menu ?

Please find below method from ToolBarLayout.java which applys above logic

protected void addComponentToMenu(Menu menu, Component c) {
if (c instanceof SeparatorToolItem) {
menu.add(new SeparatorMenuItem());
} else if (c instanceof SplitButton) {
final SplitButton sb = (SplitButton) c;
MenuItem item = new MenuItem(sb.getText(), sb.getIcon());

item.addSelectionListener(new SelectionListener<MenuEvent>() {
-
-

});
menu.add(item);
} else if (c instanceof Button) {
final Button b = (Button) c;
MenuItem item = new MenuItem(b.getText(), b.getIcon());
item.addSelectionListener(new SelectionListener<MenuEvent>() {
-
-
-

});
menu.add(item);
} else if (c instanceof ButtonGroup) {
ButtonGroup g = (ButtonGroup) c;
g.setItemId(c.getItemId());
menu.add(new SeparatorMenuItem());

}
---
}
}
}

I dont not see conditon if (c instanceof IconButton){
-------
menu.add(item);
-----
}

Can any one please help on this ?

Thanks

smiletolead
16 May 2012, 9:33 PM
Please provide a working prototype. It will be helpful for people to see the actual problem.