Line Breaks in Labels Problems

2009-06-30 Thread il1019

I'm having some issues with line breaks. They work in the Hosted
Browser as well as IE8, however the don't work in Firefox or Opera.
For example, if the user enters code in a text area that has line
breaks (they pressed enter at some point), these line breaks will only
be displayed in IE. I'm wondering if I should just convert the text to
HTML and replace the \n with br, however that wouldn't be as clean.
Is this a GWT problem, or am I doing something wrong?

Here is some sample code that shows my problem. If you try anything
with a carriage return, it will work in IE but not in FF or Opera.

VerticalPanel mainPanel = new VerticalPanel();
final Label label = new Label();
final TextArea box = new TextArea();
mainPanel.add(label);
mainPanel.add(box);
Button switchView = new Button(Update Label);
switchView.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
label.setText(box.getText());
}});
mainPanel.add(switchView);
RootPanel.get().add(mainPanel);

For example, if you use the text:

asdf

asdf

asdf

in IE it will render correctly, however anywhere else will simply
show:

asdf asdf asdf

Thanks for your help!

--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Line Breaks in Labels Problems

2009-06-30 Thread Thomas Broyer



On 30 juin, 22:22, il1019 dean.mar...@gmail.com wrote:
 I'm having some issues with line breaks. They work in the Hosted
 Browser as well as IE8, however the don't work in Firefox or Opera.
 For example, if the user enters code in a text area that has line
 breaks (they pressed enter at some point), these line breaks will only
 be displayed in IE. I'm wondering if I should just convert the text to
 HTML and replace the \n with br, however that wouldn't be as clean.
 Is this a GWT problem, or am I doing something wrong?

See issues 314 and 960 (and there might be others)
http://code.google.com/p/google-web-toolkit/issues/detail?id=314
http://code.google.com/p/google-web-toolkit/issues/detail?id=960


--~--~-~--~~~---~--~~
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-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---