I have several Label widgets, some of which have long (long) text.
Text which are long (say beyond 4-5 words) is getting broken into
multiple lines.
Given a Label widget, how can I find out if its contents (text
associated with the Label widget) spans multiple lines?
Thanks.
Joster
The fact the words are broken over one or more lines doesnt matter.
The lot is inside the div span that is the Label widget.
Thanks. I am able to get the text inside a label.
For my specific case, I do need to find out if the words inside a
label are broken over one more more line - as i need to align labels
horizontally in a vertical panel.
Joster
See picture about the mis-alignment issue here:
http://groups.google.com/group/Google-Web-Toolkit/attach/21188d34aaa85f51/dualtree.png?part=4&view=1
1. Browsers don't exactly show a paragon of cooperation on this one.
Whether the sizes you get include borders and all that jazz is
certainly something you'll need to test.
2. A newly created DOM element doesn't really have any properties set
right. You'll need to add it to something which is added (to something
which is added to * infinity) which is added to the RootPanel somehow,
AND you need to 'wait a while' for this DOM element to really really
'become'. Usually a DeferredCommand will do the trick. This does mean
you'll need to do all your layouting, then in a deferredcommand check
the sizes, and if they aren't what you expected, do it all over again.
Tricky.
3. This works properly only on block-layouted elements. If you don't
know what it means, you better read up, but oversimplifying: spans, a
href, and other text-like tags are 'inline' displayed, whereas divs,
p, table, and other somewhat 'bigger' stuff is block layouted. Every
raw GWT widget is block layout, even label (which is a <div> under the
hood, and divs are default block layouted). You can change the
layouting using the CSS display: block;. This one is relevant mostly
if you're using a lot of HTML or HTMLPanel widgets.
On Sep 27, 12:00 am, joster <joster.j...@gmail.com> wrote:
> I guess, I am ready to take the pain - can you outline the steps for
> how I might go about doing this?
>
> See picture about the mis-alignment issue here:http://groups.google.com/group/Google-Web-Toolkit/attach/21188d34aaa8...
Great!
Joster