Hi guys,
I try to show the menu content above the menu button but I have found some unknown error :
This is the first time I click the button, everything seem fine.
This is the second time I click the button, the menu content is showing below the button and it reach the end of the page. It seems that the value of "ShowMenuBelow" is true.
This is my code
I first have a class "BasePage" extending com.smartgwt.client.widgets.Window, then I have a class "DetailPage" that is extending BasePage, at DetailPage I will check the user right for deciding to hide some of the buttons, then I will put those buttons into a HLayout and finally I will call the following method in BasePage.
public HLayout combineButton(HLayout buttonLayout) {
if (buttonLayout.getMembersLength()>5) {
int lastIndex = buttonLayout.getMembersLength()-1;
Menu menu = new Menu();
for(int i = 4; lastIndex > i; lastIndex--) {
HStack editButtons = new HStack(1);
editButtons.setMembers(buttonLayout.getMember(lastIndex));
editButtons.setWidth(100);
editButtons.setAutoHeight();
MenuItem editMenuItem = new MenuItem("");
editMenuItem.setShowRollOver(false);
editMenuItem.setEmbeddedComponent(editButtons);
menu.addItem(editMenuItem);
buttonLayout.removeMember(buttonLayout.getMember(lastIndex));
}
menu.setWidth(100);
menu.setAutoHeight();
menu.setCellHeight(30);
IMenuButton btnMenu = new IMenuButton("More Buttons", menu);
btnMenu.setShowMenuBelow(false);
btnMenu.setWidth(110);
buttonLayout.addMember(btnMenu);
}
else {
return buttonLayout;
}
return buttonLayout;
}
The IMenuButton is generate at BasePage class so I can't set an onclicklistener to it , something like
IMenuButton btnMenu = new IMenuButton("More Buttons", menu);
btnMenu.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
btnMenu.setShowMenuBelow(false);
}
});
Can anyone help with this problem? Thanksssssss
I try to show the menu content above the menu button but I have found some unknown error :
This is the first time I click the button, everything seem fine.
This is the second time I click the button, the menu content is showing below the button and it reach the end of the page. It seems that the value of "ShowMenuBelow" is true.
This is my code
I first have a class "BasePage" extending com.smartgwt.client.widgets.Window, then I have a class "DetailPage" that is extending BasePage, at DetailPage I will check the user right for deciding to hide some of the buttons, then I will put those buttons into a HLayout and finally I will call the following method in BasePage.
public HLayout combineButton(HLayout buttonLayout) {
if (buttonLayout.getMembersLength()>5) {
int lastIndex = buttonLayout.getMembersLength()-1;
Menu menu = new Menu();
for(int i = 4; lastIndex > i; lastIndex--) {
HStack editButtons = new HStack(1);
editButtons.setMembers(buttonLayout.getMember(lastIndex));
editButtons.setWidth(100);
editButtons.setAutoHeight();
MenuItem editMenuItem = new MenuItem("");
editMenuItem.setShowRollOver(false);
editMenuItem.setEmbeddedComponent(editButtons);
menu.addItem(editMenuItem);
buttonLayout.removeMember(buttonLayout.getMember(lastIndex));
}
menu.setWidth(100);
menu.setAutoHeight();
menu.setCellHeight(30);
IMenuButton btnMenu = new IMenuButton("More Buttons", menu);
btnMenu.setShowMenuBelow(false);
btnMenu.setWidth(110);
buttonLayout.addMember(btnMenu);
}
else {
return buttonLayout;
}
return buttonLayout;
}
The IMenuButton is generate at BasePage class so I can't set an onclicklistener to it , something like
IMenuButton btnMenu = new IMenuButton("More Buttons", menu);
btnMenu.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
btnMenu.setShowMenuBelow(false);
}
});
Can anyone help with this problem? Thanksssssss