PDA

View Full Version : [CLOSED] Building dynamic menus broken in 2.0rc2



maries
4 Jul 2009, 3:08 AM
Popup Menus are not displayed correctly after the menu contents is rebuilt.
Only the first menu item is shown when button is pressed the first time.
It works fine with gxt 1.2.3

Tested with FF3.5, IE7 & hosted mode, WinXP
GXT 2.0rc2
GWT 1.6.4

Thanks



public class Test implements EntryPoint {
Menu menu;

public void onModuleLoad() {

final Timer t = new Timer() {
public void run() {
menu.removeAll();
for (int i = 0; i < 5; i++ ) {
menu.add(new MenuItem("menu item "+i));
}
}
};

Button btn = new Button();
btn.setText("Press Me");
menu = new Menu() {
protected void onShow() {
super.onShow();
t.schedule(500);
}
};
menu.add(new MenuItem("..."));
btn.setMenu(menu);
RootPanel.get().add(btn);
}
}

sven
4 Jul 2009, 3:25 AM
You should not modify menus while they are active. Too much logic is going on before showing a menu to contrain it correctly. You have to run that again. I am closing this issue.

sven
4 Jul 2009, 3:56 AM
You could also disable menuscrolling