1. #1
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default Set width TextArea

    Set width TextArea


    Code:
    		FormPanel simple = new FormPanel();
    		simple.setHeading("Simple Form");
    		simple.setFrame(true);
    		simple.setWidth(350);
    
    		TextField<String> firstName = new TextField<String>();
    		firstName.setFieldLabel("Name");
    		firstName.setAllowBlank(false);
    		simple.add(firstName);
    
    		TextField<String> email = new TextField<String>();
    		email.setFieldLabel("Email");
    		simple.add(email);
    
    		List<Stock> stocks = TestData.getStocks();
    		Collections.sort(stocks, new Comparator<Stock>() {
    			public int compare(Stock arg0, Stock arg1) {
    				return arg0.getName().compareTo(arg1.getName());
    			}
    		});
    
    		ListStore<Stock> store = new ListStore<Stock>();
    		store.add(stocks);
    
    		ComboBox<Stock> combo = new ComboBox<Stock>();
    		combo.setFieldLabel("Company");
    		combo.setDisplayField("name");
    		combo.setStore(store);
    		simple.add(combo);
    
    		DateField date = new DateField();
    		date.setFieldLabel("Birthday");
    		simple.add(date);
    
    		TimeField time = new TimeField();
    		time.setFieldLabel("Time");
    		simple.add(time);
    
    		CheckBox check1 = new CheckBox();
    		check1.setBoxLabel("Classical");
    
    		CheckBox check2 = new CheckBox();
    		check2.setBoxLabel("Rock");
    		check2.setValue(true);
    
    		CheckBox check3 = new CheckBox();
    		check3.setBoxLabel("Blue");
    
    		CheckBoxGroup checkGroup = new CheckBoxGroup();
    		checkGroup.setFieldLabel("Music");
    		checkGroup.add(check1);
    		checkGroup.add(check2);
    		checkGroup.add(check3);
    		simple.add(checkGroup);
    
    		Radio radio = new Radio();
    		radio.setName("radio");
    		radio.setBoxLabel("Red");
    		radio.setValue(true);
    
    		Radio radio2 = new Radio();
    		radio2.setName("radio");
    		radio2.setBoxLabel("Blue");
    
    		RadioGroup radioGroup = new RadioGroup("test");
    		radioGroup.setFieldLabel("Favorite Color");
    		radioGroup.add(radio);
    		radioGroup.add(radio2);
    		simple.add(radioGroup);
    
    		TextArea description = new TextArea();
    		description.setPreventScrollbars(true);
    		description.setFieldLabel("Description");
    		simple.add(description);
    I need to set to description width = 500, but I dont have successs

  2. #2
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    any ideia?

  3. #3
    Ext User
    Join Date
    Oct 2008
    Location
    Atlanta ,GA
    Posts
    239
    Vote Rating
    0
    kolli is on a distinguished road

      0  

    Default


    1 point is that the formPanel is set to 350, so you have to increase that size to see the size of description to 500.. and then u have to mention explicitly
    description.setWidth(500);

  4. #4
    Ext User
    Join Date
    Jan 2009
    Posts
    9
    Vote Rating
    0
    guyr is on a distinguished road

      0  

    Default GXT TextArea.setWidth not working

    GXT TextArea.setWidth not working


    I'm piggybacking on this thread because I'm having the same issue in a different context. I'm new to GXT and trying to create a TextArea with a set width. I've tried all the alternatives I can think of for TextArea.setWidth(): "100%", "600px", 600. None of them seem to do anything. Finally, I discovered that by changing the FormLayout's default width, I could get the TextArea width to expand. That actually works for me in this case because I only have a TextArea to display. But I'd like to understand the proper solution to this problem.

    Here is a cut-down code sample. This comes out of the constructor of a LayoutContainer.

    Code:
       
       private FormPanel panel          = new FormPanel();
       private TextArea taNotes = new TextArea();
    
       setLayout(new FlowLayout(6));
    
       // The following doesn't seem to accomplish anything.
       taNotes.setWidth("720px");
    
       taNotes.setValue("xxxx");
    
       FormLayout fl = new FormLayout();
       // However, the following will cause the TextArea to widen.
       // fl.setDefaultWidth(720);
       panel.setLayout(fl);
       panel.setExpanded(true);
    
       panel.add(taNotes);
       add(panel);
    Thanks for all help.
    Guy Rouillier

  5. #5
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    if you are using a FormPanel or the FormLayout on a panel, you need to set this with FormData. Like so...

    Code:
    panel.add(txtfld, new FormData("200")); // sets the width to 200px
    you need to do this via FormData as the layout is managing the size/position - setWidth is being overriden by the layout manager in this case and is why it doesn't work

  6. #6
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    thanks for help

  7. #7
    Ext User
    Join Date
    Jan 2009
    Posts
    9
    Vote Rating
    0
    guyr is on a distinguished road

      0  

    Default


    gslender, thanks for providing not only the solution but an explanation as well. I'm new to this, so I'm probably doing something wrong, but neither of the following worked for me:
    panel.add(taNotes, new FormData("720"));
    panel.add(taNotes, new FormData("720px"));

    However, the following did work:

    panel.add(taNotes, new FormData(720, 400));

    So, I'm good to go.
    Guy Rouillier

  8. #8
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    I'd need to see a full example to be sure/understand why... your code snippet above is too short. Include the entire onModuleLoad etc and keep in contained to just the problem if possible (ie no need having other forms/rpc etc)

  9. #9
    Ext User
    Join Date
    Jan 2009
    Posts
    9
    Vote Rating
    0
    guyr is on a distinguished road

      0  

    Default


    Sorry for the long delay in response, I've been working long hours on a project. Through MyEclipse, I created an empty GWT application, then added in just enough to demonstrate the problem. The entire project zipped up is 40 MB, so hopefully the source will be sufficient.

    In NotesPanel.java, using

    panel.add(taNotes, new FormData("700px"));

    does not set the width of the TextArea, while

    panel.add(taNotes, new FormData(700, 300));

    does.

    Please let me know if you'd like any other parts of this sample. Thanks.
    Attached Files
    Guy Rouillier

  10. #10
    Ext User
    Join Date
    Oct 2008
    Location
    Atlanta ,GA
    Posts
    239
    Vote Rating
    0
    kolli is on a distinguished road

      0  

    Default


    Well i think that the single argument that you are passing into the formdata is supposed to be a string but it should be something related to the anchor layout

    http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/layout/FormData.html#FormData(java.lang.String)

    So i dont think setting a size to formdata as a string works.
    The formdata(width, height) is the correct constructor that should be called to set the width and the height of formdata.

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar