pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill van Melle <bill.van.me...@gmail.com>
Subject Intelligent stripping of whitespace in bxml?
Date Thu, 03 Mar 2011 01:51:07 GMT
Is there any mechanism for distinguishing significant and insignificant
whitespace inside a bxml element?  I'm thinking in particular of the case
where I want to put a whole paragraph of text (or even more) inside a Label.
 BXML lets you do this:

<Label ...>
   <text>whatever</text>
</Label>

but if it's a whole lot more text than that...

<Label ...>
   <text>
      ...It would be nice if one could put multiple lines of
      text into a single text element for the sake of readability,
      but still have it interpreted as a single line of text for
      the Label control to wrap at whatever the width of the
      Label component turns out to be.
   </text>
</Label>

If I do (the equivalent of) this in WPF, the parser helpfully turns all
those runs of whitespace into single spaces, and trims the front and back.
 To have the whitespace interpreted literally, there's some crud you can add
to the parent element.  There's also an inline element <LineBreak/> for
explicit newlines.

Is there anything of the sort in the BXML parser?  Without thinking about
it, I wrote some bxml like the above, and it almost fooled me.  If I look at
the label text in the debugger, I can see that it consumed the file
literally, so there are stretches of whitespace including newlines, but the
Label component doesn't handle it literally.  Unfortunately, it also doesn't
handle it quite the way I want, and how it does handle it seems to be
platform-dependent.  On XP, the leading whitespace goes away, and the
stretches of newline + spaces turn into zero(!) spaces.  On the mac, it
looks like the newlines are discarded and all the spaces are kept, resulting
in some big white gaps in the resulting text.

Or am I forced to put all my text into a single line?  In which case I might
as well have written it as

<Label ... text="...long string of text..." />

Mime
View raw message