line breaks in SpanLabel?

40 views
Skip to first unread message

Clement Levallois

unread,
Oct 5, 2015, 4:35:04 PM10/5/15
to CodenameOne Discussions
Hi, is it possible to add line breaks (\n) in SpanLabels? If not, what are the alternatives to achieve the desired effect?

Thanks!


If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Shai Almog

unread,
Oct 5, 2015, 11:57:21 PM10/5/15
to CodenameOne Discussions
Hi,
yes. Its possible.
The GUI builder doesn't quite support it though. It only works via the localization UI when you edit the bundle directly.

Clement Levallois

unread,
Oct 6, 2015, 10:35:40 AM10/6/15
to CodenameOne Discussions

Hi,

I created a localized bundle called "MesTraductions" and I add a column for English ("en"). In this bundle, I retrieve the text from the SpanLabel with Synch UI and I add an "en" localized version for it: text\nSpanLabel (see first screenshot)



Then in StateMachine I add:

    @Override
   
protected void initVars(Resources res) {
       
this.res = res;
       
UIManager.getInstance().setBundle(res.getL10N("MesTraductions", "en"));


   
}

Then I run the Simulator from NetBeans but I don't get a line break, see second screenshot:



 What should I do?

Shai Almog

unread,
Oct 6, 2015, 11:25:40 PM10/6/15
to CodenameOne Discussions
\n won't work.
In the L10N view you need to click the "Edit Text" button and there you can just type in the text with line breaks (regular enter).

Clement Levallois

unread,
Oct 7, 2015, 1:10:05 AM10/7/15
to CodenameOne Discussions
oh!! Got it.
Reply all
Reply to author
Forward
0 new messages