1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    4
    Vote Rating
    0
    marcinKozlowicz is on a distinguished road

      0  

    Default How to force TextField to be displayed...

    How to force TextField to be displayed...


    How to force TextField to be displayed on component which is too small?
    I would like to display a lot of fields in a window which too small to display all of them
    I think there should be any possibility to set horizontal Scroll but i can't do it:/
    Maybe there is any combination of panels/layouts which can make it but unfortunetly
    i couldn't find it.

    Thanks in advance.

    Code:
    package example.example.client;
    
    import com.extjs.gxt.ui.client.Style.Scroll;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    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.TextField;
    import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    /**
     * * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class App implements EntryPoint {
        /**
         * * This is the entry point method.
         */
        public void onModuleLoad() {
            final Button testButton = new Button("Test");
            testButton.addSelectionListener(new SelectionListener<ComponentEvent>(){
    
                @Override
                public void componentSelected(ComponentEvent ce) {
                    final Window modalWindow = new Window();
                    final ContentPanel panel = new ContentPanel();
                    panel.setLayout(new FlowLayout());
                    panel.setHeaderVisible(false);
                    panel.setScrollMode(Scroll.ALWAYS);
                    
                    final FormPanel fPanel = new FormPanel();
                    fPanel.setHeaderVisible(false);
                    TextField<String> text1 = new TextField<String>();
                    text1.setFieldLabel("Label1");
                    TextField<String> text2 = new TextField<String>();
                    text2.setFieldLabel("Label2");
                    fPanel.add(text1);
                    fPanel.add(text2);
                    panel.add(fPanel);
                    
                    modalWindow.setModal(true);
                    modalWindow.setHeight(150);
                    modalWindow.setWidth(300);
                    modalWindow.add(panel);
                    modalWindow.show();
                }
                
            });
            RootPanel.get().add(testButton);
        }
    
    
    }

  2. #2
    Ext User
    Join Date
    May 2008
    Location
    Phoenix, AZ
    Posts
    223
    Vote Rating
    0
    posta07 is on a distinguished road

      0  

    Default


    Try setting the field width (and/or label width) on the form Panel:

    Code:
                    final FormPanel fPanel = new FormPanel();
    >>>>>>>                fPanel.setFieldWidth(100);
                    
                    
                    fPanel.setHeaderVisible(false);
                    TextField<String> text1 = new TextField<String>();
                    text1.setFieldLabel("Label1");
                    TextField<String> text2 = new TextField<String>();
                    text2.setFieldLabel("Label2");
                    fPanel.add(text1);
                    fPanel.add(text2);
                    panel.add(fPanel);

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    4
    Vote Rating
    0
    marcinKozlowicz is on a distinguished road

      0  

    Default


    Hi, I know i can reduce field width by setFieldsWidth() method, but i want to
    find how to display fields when they don't fit into parent panel.

  4. #4
    Ext User
    Join Date
    May 2008
    Location
    Phoenix, AZ
    Posts
    223
    Vote Rating
    0
    posta07 is on a distinguished road

      0  

    Default


    Have you tried using a different Panel/layout instead of FormPanel?

    Like, VerticalPanel? or TableLayout?

Thread Participants: 1