Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Curious results

 [1/6] from: being_doug:yah:oo at: 29-Jul-2001 17:27


Here are 2 short scripts, almost identical, but with different results, and which raise questions of their own. Only the order of display changes. 1. Why does 'view lay' show 'Problem!' inside each box? ;example 1 REBOL [Title: "Problem!"] lay: layout [ across b: box red c: box green] view b view c view lay 2. What happens to red and green for b and c? ;example 2 REBOL [Title: "Problem!"] lay: layout [ across b: box red c: box green] view lay view b view c (I ran these on Win98) -- doug edmunds

 [2/6] from: brett:codeconscious at: 30-Jul-2001 14:35


Hi Doug,
> 1. Why does 'view lay' show 'Problem!' inside each > box?
I don't see that.
> 2. What happens to red and green for b and c? > ;example 2
<<quoted lines omitted: 3>>
> view b > view c
They are there - you just cannot see them because they are not visible to you. Try this: lay: layout [ across b: box red c: box green] view lay print ["b/offset:" b/offset "c/offset" c/offset] c/offset: 0x0 view c Now I just cheated, because if you set the offset of b like I did for c you'll still not see the red box. I believe that VIEW establishes a relationship between lay, b, and c through the field "parent-face" of b and c when you execute the line "view lay". I really don't know how it works but I do think it is intimately involved with why you don't see the red box when you "view b" at a later time. Brett.

 [3/6] from: being_doug:y:ahoo at: 29-Jul-2001 23:04


--- Brett Handley <[brett--codeconscious--com]> wrote:
> Hi Doug, > > 1. Why does 'view lay' show 'Problem!' inside each > > box? > > I don't see that. >
As to 1: If I open rebol/view, then the console, then paste the text into the console, I see first red, then green, then red-green, and no text in the red-green form. But if I create a file myscript.r and load it (either double-clicking it or running 'Rebol myscript.r' in a DOS window), then I definitely see the text of the title in each box in the red-green form. Any one else getting this result? -- doug edmunds

 [4/6] from: brett::codeconscious::com at: 30-Jul-2001 17:42


> But if I create a file myscript.r and load it > (either double-clicking it or running 'Rebol > myscript.r' in a DOS window), then > I definitely see the text of the title > in each box in the red-green form. > > Any one else getting this result?
Aha. Yes I see it. For scripts, the VIEW function automatically puts the text of the script title into the main face if there is no text already defined for the main face. This occurs at "view b" and "view c" - but you don't see the change. I cannot explain why. You see the change once "view lay" is executed. When you paste at the console there is no script title defined therefore there is no change. Compare your example with the following - which will not change the text I have given to the box.: REBOL [Title: "No Problem!"] lay: layout [ across b: box "box 1" red c: box "box 2" green] view b view c view lay If you want to see where the change occurs type the following at the console: source view Brett.

 [5/6] from: fsievert:uos at: 30-Jul-2001 9:37


> Here are 2 short scripts, almost identical, but > with different results, and which raise questions
<<quoted lines omitted: 7>>
> view c > view lay
View sets c/text to the title of the script. The "text"-facet is used for the title of a window. If you use b or c as a normal face after that, you will see the text in the face.
> 2. What happens to red and green for b and c? > ;example 2
<<quoted lines omitted: 3>>
> view b > view c
faces, which are used as a window should habe parent-face = none. After the first 'view - command, they are set to the lay-face.
>> win-offset? b
== 128x20 (This shows: rebol will render the green/red color not at 0x0, but at 128x20. Since the face is not great enough, you don't see it. This will fix it: b/parent-face: none c/parent-face: none
>> win-offset? b
== 0x0 Hope that helps, Frank

 [6/6] from: cyphre:volny:cz at: 30-Jul-2001 10:13


Hello Doug, /View puts automaticaly 'title variable from REBOL script header into the 'text variable of first face(most upper in the hierarchy) of layout(so the 'title is shown in the titlebar of the /view window) You are trying to show only rad and green 'box faces first so 'view command add to 'text variable of this boxes string "Problem!". Don't show single faces like that! The face passed to View function is always the Window face!You should always make first face for window(screen) use and the insert subfaces into it: REBOL [Title: "No problem!"] lay: layout [origin 0x0 b: box green] view make face [offset: 50x50 pane: b size: b/size] view lay For better understanding see how your script works in more detail: REBOL [Title: "Problem!"] lay: layout [ across b: box red c: box green] probe b/text ;'text of boxes is empty(none)... probe c/text view b ; 'view puts 'title into 'text of both boxes view c probe b/text ;'text of boxes contains "Problem!" probe c/text view lay Have fun! Cyphre

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted