Roger, thanks for the quick trick and commit :-) ...

Bye


2013/8/22 Roger L. Whitcomb <[email protected]>:
> Great!
>
>
>
> I’ve just now updated the “label_test.bxml” file in “trunk” so it has a
> couple of these hard-coded newlines just as an example for others.  To use
> it, navigate to the “tests/src/org/apache/pivot/tests” directory and do:
> “java org.apache.pivot.wtk.ScriptApplication --src=.\label_test.bxml”
>
>
>
> ~Roger
>
>
>
> From: Erik Innocent [mailto:[email protected]]
> Sent: Thursday, August 22, 2013 9:35 AM
> To: user
> Subject: Re: How to express a newline in a Label within BXML?
>
>
>
> It works for me! The answer seems kind of obvious, in retrospect =)
>
>
>
> Thanks!
>
> --E
>
>
>
>
>
> On Thu, Aug 22, 2013 at 11:10 AM, Roger Whitcomb
> <[email protected]> wrote:
>
> So to set a newline in a bxml file you have to use the XML escape
> mechanism(s). That's all. For example: &#10; or &#x0A;
>
> ~Roger Whitcomb
>
> Sent from my iPhone
>
>
> On Aug 22, 2013, at 3:00 AM, Sandro Martini <[email protected]>
> wrote:
>
>> Hi Erik,
>> you have reason, currently I find multiline label samples only in
>> LabelTest.java class, I have to add a bxml version of it ...
>> Searching in our sources, I find other examples for multiline strings
>> (in bxml files), but for other components (TableView, and related
>> renderers), like: table_pane_test2.bxml, table_pane_test4.bxml ... but
>> these could be a starting point. Could you do some tests starting from
>> here ?
>>
>> Anyway this could be a BXMLSerializer issue (LabelSkin does the line
>> splitting if it finds the \n snside the label text , but as a single
>> char), so we have to verify it.
>>
>> Roger, what do you think ?
>>
>> Let's update.
>>
>> Bye
>>
>> 2013/8/22 Erik Innocent <[email protected]>:
>>> 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/%[email protected]%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
>>
>
>

Reply via email to