I want a TextItem to take all the space available to the form.
Calling textItem.setWidth ("*") works.
However, when I also call textItem.setShowTitle (false), then the item width shrinks down to 96 (I think).
Any ideas?
FF 6.0.2
SmartGWT 3.1p-2012-11-23
SmartClient Version: v8.3p_2012-11-23/LGPL Development Only (built 2012-11-23)
Calling textItem.setWidth ("*") works.
However, when I also call textItem.setShowTitle (false), then the item width shrinks down to 96 (I think).
Any ideas?
FF 6.0.2
SmartGWT 3.1p-2012-11-23
SmartClient Version: v8.3p_2012-11-23/LGPL Development Only (built 2012-11-23)
Code:
import com.smartgwt.client.util.SC;
import com.smartgwt.client.Version;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.IButton;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
public class WideTextItem implements EntryPoint {
/**
* The EntryPoint interface
*/
public void onModuleLoad () {
// test
SC.showConsole ();
GWT.log ("GWT version: " + GWT.getVersion ());
GWT.log ("SmartGWT version: " + Version.getVersion ());
GWT.log ("SmartGWT buildDate: " + Version.getBuildDate ());
GWT.log ("SmartGWT major-minor-patch: " + Version.getMajor () + "-" + Version.getMinor () + "-" + Version.getPatch ());
GWT.log ("SmartGWT SC: " + Version.getSCVersionNumber ());
// TextItem does take "*" as expected
final DynamicForm form1;
{
// text item
final TextItem textItem = new TextItem ();
// textItem.setTitle ("");
textItem.setRequired (true);
textItem.setWidth ("*");
textItem.setShowTitle (true);
// form
final DynamicForm form = new DynamicForm ();
form.setBackgroundColor ("red");
form.setIsGroup (true);
form.setGroupTitle ("setShowTitle (true)");
form.setItems (textItem);
form1 = form;
}
// setShowTitle (false), and TextItem no longer takes "*"
final DynamicForm form2;
{
// text item
final TextItem textItem = new TextItem ();
// textItem.setTitle ("");
textItem.setRequired (true);
textItem.setWidth ("*");
textItem.setShowTitle (false);
// form
final DynamicForm form = new DynamicForm ();
form.setBackgroundColor ("yellow");
form.setIsGroup (true);
form.setGroupTitle ("setShowTitle (false)");
form.setItems (textItem);
form2 = form;
}
// same as 2 plus hacks
final DynamicForm form3;
{
// text item
final TextItem textItem = new TextItem ();
// textItem.setTitle ("");
textItem.setRequired (true);
textItem.setWidth ("*");
textItem.setShowTitle (false);
textItem.setTitleStyle ("visibility:hidden;");
final TextItem textItem2 = new TextItem ();
textItem2.setTitle ("Placeholder");
// form
final DynamicForm form = new DynamicForm ();
form.setBackgroundColor ("green");
form.setIsGroup (true);
form.setGroupTitle ("setShowTitle (false) + placeholder item");
form.setItems (textItem, textItem2);
form3 = form;
}
// layout
final VLayout layout = new VLayout ();
layout.setBackgroundColor ("brown");
layout.setWidth (600);
layout.addMember (form1);
layout.addMember (form2);
layout.addMember (form3);
layout.addMember (new IButton ("Hi"));
layout.draw ();
}
}
Comment