I have created a FlowPanel that contains 4 ListBoxes and a button. I
wanted to put some space between the items, so I added empty
HorizontalPanels (with padding: 3px;) as spacers in between each
item. FlowPanel responded by placing each item (including each of the
HorizontalPanels), on its own line (IOW, it's now acting like a
VerticalPanel).
If I remove some of the spacers, then the items that don't have
spacers between them share a line with each other, and the ones with
spacers each go on a separate line.
Is this a bug? Is this supposed to happen? How do I fix it?
While I'm asking, if you resize the panel that a FlowPanel is in, does
it automatically "reflow" its items?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
I think you have the right idea, but using a
com.google.gwt.user.client.ui.HTML widget won't work. That widget
renders its content inside of a div element, so it's already game over
before you've added the elements you want to keep together.
Again, from UiBinder, this is pretty easy:
<g:HTMLPanel>
<span style="white-space:nowrap">First name: <g:TextBox
ui:field="name"></span>
<span style="white-space:nowrap">Last name: <g:TextBox ui:field="name"></span>
</g:HTMLPanel>
This will tell the browser to do its best to not wrap between each
field and its label, even though there are spaces there.
From Java code, the idea is the same, but the implementation is a bit
different. I did this once before when I first started using GWT and I
don't know if this is the correct/best way to do this, but it did work
for me:
String nameId = HTMLPanel.createUniqueId();
HTMLPanel html = new HTMLPanel("<span
style=\"white-space:nowrap\">Name :<input id=\"" + nameId +
"\"></span>");
html.addAndReplaceElement(new TextBox(), nameId);
Obviously it gets more complicated the more elements and element
groups you have.
Finally, HTMLPanel itself is going to be within a div element.
However, there's another form of the HTMLPanel constructor that takes
a tag name as the first argument:
new HTMLPanel("span", "<span ...");
Personally, I might try to dig one level deeper to avoid the extra
span element that this would introduce, but it shouldn't do any harm.
-Brian
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.