Hi
I'm struggling with this. For some reason when I use a background
image I get spaces between the menu items that i dont seem to be able
to get rid of. f I dont have a background image on the menu item then
I don't get these spaces.
Any clues? The code is as below, I've broken it out into a very
simple app to illustrate the point. The menu separator image is just
a simple 1px * 20px image and the background image for the menu item
is 200 * 20.
Thanks
Andy
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.MenuItemSeparator;
import com.google.gwt.user.client.ui.RootPanel;
public class TestFile implements EntryPoint {
Command command = new Command()
{
public void execute()
{
Window.alert("Command Fired");
}
};
public void onModuleLoad() {
MenuBar mnu = new MenuBar();
MenuItem mnu1 = new MenuItem("Test", command);
MenuItem mnu2 = new MenuItem("Test1", command);
MenuItem mnu3 = new MenuItem("Test2", command);
MenuItem mnu4 = new MenuItem("Test3", command);
MenuItemSeparator sep = new MenuItemSeparator();
MenuItemSeparator sep1 = new MenuItemSeparator();
MenuItemSeparator sep2 = new MenuItemSeparator();
mnu1.setWidth("120");
mnu2.setWidth("120");
mnu3.setWidth("120");
mnu4.setWidth("120");
mnu.addItem(mnu1);
mnu.addSeparator(sep);
mnu.addItem(mnu2);
mnu.addSeparator(sep1);
mnu.addItem(mnu3);
mnu.addSeparator(sep2);
mnu.addItem(mnu4);
RootPanel.get().add(mnu);
}
}
.gwt-MenuBar {
background:none;
}
.gwt-MenuBar .gwt-MenuItem {
background: url("Images/tnav_getstarted_wide.gif") no-repeat;
width: 150px;
height: 20px;
text-align: center;
vertical-align: middle;
color: white;
cursor: pointer;
cursor: hand;
font-size: .8em;
}
.gwt-MenuBar .gwt-MenuItem-selected {
background: url("Images/tnav_getstarted_wide_on.gif") no-repeat;
width: 150px;
height: 20px;
text-align: center;
vertical-align: middle;
color: white;
cursor: pointer;
cursor: hand;
font-size: .8em;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator {
width: 1px;
background: url("Images/tnav_separator.gif") no-repeat;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator .menuSeparatorInner {
width: 1px;
background: url("Images/tnav_separator.gif") no-repeat;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---