When you create a window with any text style (text, title, h1, ecc.), Rebol standard behavior is to automatically wrap the text and removing exceeding spaces, but most important of it, it changes the text removing the breaking lines!!! (fortunately there a lot of options to change this behavior)
Let's see this example:
>> a: {Hello,
my name is Max.
What is your name?
Julia?
Oh, it's a nice name. Where are you from?}
== {Hello,
my name is Max.
What is your name?
Julia?
Oh, it's a nice name. Where are you from?}
>> view layout [text a]
>> a
== {Hello, my name is Max. What is your name? Julia? Oh, it's a nice name. Where are you from?}
You noticed it? Now a variable doesn't contains break lines and exceeding spaces anymore!!!
If you don't want to change a use:
view layout [text copy a]
Standard wrap leave a 10% from both sides of the screen free, this means on 1280 pixel wide screen a 1043 pixel max window.
You can also specify the size of the text with a number or a pair, but your break lines will be removed:
view layout [ text 100 a]
or
view layout [ text 100x30 a]
Fortunately there is the as-is command to maintain break lines and spaces in the window.
Before continuing I admit that the standard behavior make sense, usually when you create a window, you have serious difficulties to realize if a text is well formatted or will enter in the space where you want to put it; Rebol make the job for you, wrapping text, resizing the area and removing wrong exceeding spaces.
However there is the magic word as-is:
>> a: {Hello,
my name is Max.
What is your name?
Julia?
Oh, it's a nice name. Where are you from?}
== {Hello,
my name is Max.
What is your name?
Julia?
Oh, it's a nice name. Where are you from?}
>> view layout [text as-is a]
>>a
== {Hello,
my name is Max.
What is your name?
Julia?
Oh, it's a nice name. Where are you from?}
You can alter the standard style of text and imposing the wrap only when you want:
view layout [
style textw text ;text wrapped
style text text as-is
text green a
textw red a
]
The area text has the contrary behavior, it usually doesn't wrap, so you have to impose it with wrap:
view layout [area 160x60 "This is a long line that will not wrap."]
view layout [area 160x60 wrap "This is a longer line that will wrap."]
No comments:
Post a Comment