I have just tried experimenting with numCols and colWidths, using, for example, the following code:
form.setWidth(400);
form.setNumCols(3);
form.setColWidths("20%", "20%", "60%");
I have tried both percentages (as in the above example) and absolute values, eg:
form.setColWidths(80, 80, 200);
It appears that, in both Firefox 3 and IE7, setColWidths has no effect. I have tried using setNumCols(2), guessing that this might make the hint disappear, but that doesn’t happen. I have searched the documentation and the Showcase for details / examples of how colWidths works with hints, but have found nothing. Have I missed something?
My previous post stating that the hint would stretch in Firefox 3 was based on a much more complex example. I haven’t been able to recreate that in a cut down example. Also, I have not been able to successfully compile and launch the Showcase, so when testing the above, I have been using an extension of the HelloWorld sample, replacing the SC.say line with:
PopupForm popupForm = new PopupForm();
popupForm.show();
and where PopupForm is defined as:
package com.mycompany.client;
import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.PopupPanel;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.VLayout;
/**
* Class that provides a popup form, with methods to show and hide it
*/
public class PopupForm extends PopupPanel implements IsSerializable {
private VLayout container = null;
private Layout formPanel = null;
private HLayout buttonPanel = null;
private IButton okButton = null;
private IButton cancelButton = null;
boolean editable;
ComboBoxItem priorityField;
/**
* Constructor
*/
public PopupForm() {
super(false, true);
container = new VLayout();
formPanel = new Layout();
container.addMember(formPanel);
final DynamicForm form = new DynamicForm();
final TextItem date = new TextItem();
date.setTitle("Date");
date
.setHint("MM/YYYY The month and year in which you moved to your present address");
date.setHintStyle("hintStyle");
form.setFields(date);
form.setWidth(400);
form.setNumCols(3);
form.setColWidths("20%", "20%", "60%");
formPanel.addMember(form);
buttonPanel = new HLayout();
cancelButton = new IButton("Cancel");
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent sender) {
hide();
}
});
buttonPanel.addMember(cancelButton);
okButton = new IButton("OK");
okButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent sender) {
hide();
}
});
buttonPanel.addMember(okButton);
container.addMember(buttonPanel);
this.setWidth("600px");
setWidget(container);
this.center();
container.setStylePrimaryName("popup");
}
}
I have also added the following to the bottom of HelloWorld.css:
.popup {
position: absolute;
top: 50%;
left: 50%;
background-color: white;
border: 3px solid black;
padding: 10px;
}
Does anyone know of any examples of successfully changing the widths of hints?
Regards,
Andrew