Struggling with setting GridLayout in Dialog Window!

Hi,

I’m struggling with postioning Buttons in my Dialog window:

The code for the Dialog WIndow looks like
[code]
public EntryDialog() {
super(“Entry Dialog”); // Set window caption
center();

 // Some basic content for the window
    pp = new ContentsPanel();

    VerticalLayout content = new VerticalLayout();
    setWidth(null);
    content.setWidth(null);
    content.addComponent(pp);
   
    setResizable(false);
    
    // Disable the close button
    setClosable(false);
   
    GridLayout buttonbar = new GridLayout(3,1);
    buttonbar.setWidth("100%");
    buttonbar.setSpacing(true);
    
    buttonbar.setStyleName("buttonbar");
    
// Trivial logic for closing the sub-window
    Button ok = new Button("OK");
    ok.setSizeUndefined();
    ok.addStyleName("ok");
    ok.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            close(); // Close the sub-window
            System.out.println("Clicked OK in Entry Dialog!");
        }
    });
    buttonbar.addComponent(ok,2,0);
    
    Button cancel = new Button("Cancel");
    cancel.setSizeUndefined();
    cancel.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            close(); // Close the sub-window
        }
    });
    buttonbar.addComponent(cancel,1,0);
    
    Button clear = new Button("Clear");
    clear.setSizeUndefined();
    clear.addStyleName("clear");
    clear.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            System.out.println("Clicked Clear in Entry Dialog!");
            clearMe();
        }
    });
    buttonbar.addComponent(clear,0,0);
    buttonbar.setColumnExpandRatio(0, 5.0f);
    buttonbar.setColumnExpandRatio(1, 1.0f);
    buttonbar.setColumnExpandRatio(2, 2.0f);
    
    content.addComponent(buttonbar);
    
    setContent(content);
}

[/code]
When the dialog pops up the window adapts itself to the size of the user-defined ContentsPanel, and that’s okay.

However, I’m unable to make the buttonbar (GridLayout, one row 3 columns) adapt to the window size too, and set the ExpandRatio of each column?

What am I doing wrong here?

Regards,
Gerard