pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Innocent <einnoc...@gmail.com>
Subject How to express a newline in a Label within BXML?
Date Wed, 21 Aug 2013 23:07:37 GMT
Thanks everyone for your help so far! I've yet another question.

How do I place a newline in a Label's text in BXML? I see that in 2.0.3,
Pivot began supporting text labels with hard newlines with the "\n"
character (
http://mail-archives.apache.org/mod_mbox/pivot-commits/201301.mbox/%3C20130122010418.3EC4223889F7@eris.apache.org%3E),
but this seems only to work programmatically.

As a workaround, I've tried the following things, which all fail:

   - Placing "\n" as the value of the text attribute in the label in BXML.
   This shows up as "\n" in the application, and "\\n" when viewing the
   label.getText() result
   - Using "\\n" as the value instead, in hopes that the double backslash
   might escape. It does not, and the label text appears as "\\n" in the app.
   - Doing label.setText(label.getText()) with 'text="\n" in BXML'. Doesn't
   work because the "\n" is already escaped to "\\n". I suppose I could do a
   replace of "\\" with "\" before setText(), but it seems inelegant to have
   to initialize all labels like this.

Other than setting the label programmatically, any tips? Note that setting
the value programmatically does work for me. I've got "wrapText:true" set
in my tests.

Thanks!
--E

Mime
View raw message