PDA

View Full Version : [CLOSED] [1.2.3] Panel displays garbage



rlaferla
3 Mar 2009, 4:31 PM
- Detailed description of the problem

Window displays garbage.

- GXT version

1.2.3

- Host mode / web mode / both

both

- Browser and version

Firefox 3.0.6

- Operating System

Windows XP Pro

- Sample code



import com.google.gwt.core.client.EntryPoint;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.form.TextArea;


public class Test implements EntryPoint {
private Window window;
private TextArea myTextArea;

public void loadModule() {

window = new Window();
window.setPlain(true);
window.setSize(600, 560);
window.setHeading("This displays garbage.");
window.setClosable(false);
window.setResizable(true);
window.setLayout(new FitLayout());

FormPanel panel = new FormPanel();
panel.setBorders(false);
panel.setBodyBorder(false);
panel.setLabelWidth(55);
panel.setPadding(5);
panel.setHeaderVisible(false);

myTextArea = new TextArea();
panel.add(myTextArea, new FormData("100% -53"));

Button buttonOne = new Button();
buttonOne.setText("One");

Button buttonTwo = new Button();
buttonTwo.setText("Two");

window.add(buttonOne);
window.add(buttonTwo);
window.add(panel);

window.show();

}
}

sven
3 Mar 2009, 4:40 PM
Your window uses FitLayout but you are adding three items to it. Please use the help forum. I close this.

rlaferla
3 Mar 2009, 4:51 PM
Okay but....

The Explorer "AnchorLayout" demo that this is based on also adds three items to a Window with a FitLayout:


/*
* Ext GWT - Ext for GWT
* Copyright(c) 2007, 2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
package com.extjs.gxt.samples.client.examples.layouts;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;

public class AnchorLayoutExample extends LayoutContainer {

public AnchorLayoutExample() {
setLayout(new FlowLayout(10));

final Window w = new Window();
w.setPlain(true);
w.setSize(500, 300);
w.setHeading("Resize Me");
w.setLayout(new FitLayout());

FormPanel panel = new FormPanel();
panel.setBorders(false);
panel.setBodyBorder(false);
panel.setLabelWidth(55);
panel.setPadding(5);
panel.setHeaderVisible(false);

TextField<String> field = new TextField<String>();
field.setFieldLabel("Sent To");
panel.add(field, new FormData("100%"));

field = new TextField<String>();
field.setFieldLabel("Subject");
panel.add(field, new FormData("100%"));

TextArea area = new TextArea();
area.setHideLabel(true);
panel.add(area, new FormData("100% -53"));

w.addButton(new Button("Send"));
w.addButton(new Button("Cancel"));
w.add(panel);

Button b = new Button("Open", new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {
w.show();
}

});
add(b);
}

}

sven
3 Mar 2009, 4:55 PM
You might see the difference there.

addButton is not equal to add what you are using.

rlaferla
3 Mar 2009, 4:56 PM
Thank you sven! You are both quick and sharp!