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

View: How Does This Work?

 [1/6] from: ddalley::idirect::com at: 18-Nov-2001 3:15


Re: the "How To Create Subpanels" tutorial If the default layout direction is BELOW, how does this tutorial's code actually work? There is no ACROSS in 'main's code, but there are two "areas" that are being used - one to the left of the narrow box (which I understand how it works) and one to the right of it (which loses me). I am trying to figure out just why the box and the "panel" area to the right of the box actually end up in their displayed locations. Can anyone help explain what is going on? Experimenting with this problem, I had difficulty using an X,Y point (using AT, OFFSET or ORIGIN, and BELOW & ACROSS) to put a layout where I want it. I have been able to change the X axis point, but the Y never seems to do what I expect of it, overlaying elements at the top of the window. How, then, does one code "put it here"? I also don't understand how 'panels is being used, in these lines of code. button "Panel 1" [panels/pane: panel1 show panels] button "Panel 2" [panels/pane: panel2 show panels] panels: box 220x140 Panels/pane: seems to be defined as a subface (either 'panel1 or 'panel2 - a good use for a toggle, no?), which then gets displayed; and then as a box. How can both definitions of 'panels work? Donald Dalley

 [2/6] from: brett:codeconscious at: 19-Nov-2001 10:17


Hi Donald,
> I am trying to figure out just why the box and the "panel" area to the
right
> of the box actually end up in their displayed locations. Can anyone help > explain what is going on?
The word RETURN is the important one in this case. Imagine an invisible cursor that Layout uses. As Layout places each element it moves the cursor. The BELOW keyword instructs Layout to move the cursor down vertically, the ACROSS keyword tells it to move the cursor horizontally. As each element is place the cursor is moved to the extremity of that element. So with this example: view layout [below box red box green RETURN box blue] the cursor is at the origin, is then moved to the bottom right of the red box. Then it is spaced and moved into horizontal alignment with the red box at which point the green box is placed and the cursor moves to the bottom right of the green box. A RETURN is encountered and the cursor is reset vertically (in this case) to the previous GUIDE (here none has been specified but effectively there is one at the start). Then the cursor is spaced and the blue box is placed, with the cursor set to the bottom right corner. This next example shows the interaction of GUIDE and RETURN: view layout [below box red box green RETURN box blue GUIDE box yellow box orange RETURN box purple RETURN box gold box teal ]
> Experimenting with this problem, I had difficulty using an X,Y point
(using
> AT, OFFSET or ORIGIN, and BELOW & ACROSS) to put a layout where I want it.
I
> have been able to change the X axis point, but the Y never seems to do
what
> I expect of it, overlaying elements at the top of the window. How, then, > does one code "put it here"?
This next bit of code demonstrates ORIGIN: view layout [ORIGIN 0x0 below box red box green RETURN box blue] Compare this example with the first example above. Here there is no margin around the coloured boxes in this example. Each box is 100x100 in size. Using AT we can set the cursor position at which the next element will be placed. Here the green box overlaps the Red box: view layout [ORIGIN 0x0 below box red AT 40x40 box green RETURN box blue] AT uses an absolute position. Compare the last example with this: view layout [below box red AT 40x40 box green RETURN box blue] The green box is at exactly the same location in both examples, even though in one example the origin is different. This next code positions each box absolutely: view layout [AT 10x10 box red AT 20x20 box green AT 30x30 box blue] And here we can see how the cursor runs after such absolute positioning: view layout [ ORIGIN 0x0 AT 10x10 box red AT 20x20 box green AT 30x30 box blue box yellow RETURN box orange ] As for OFFSET. I think there is an error in the user guide. Offset is a refinement to the VIEW function and it also exists an attribute of a face, but I do not think it is a keyword for use in the LAYOUT function. Here the offset refinement is used to position the whole window lower down the screen: view/offset layout [below box red box green RETURN box blue] 300x300
> I also don't understand how 'panels is being used, in these lines of code. > > button "Panel 1" [panels/pane: panel1 show panels] > button "Panel 2" [panels/pane: panel2 show panels] > panels: box 220x140 > > Panels/pane: seems to be defined as a subface (either 'panel1 or 'panel2 -
a
> good use for a toggle, no?), which then gets displayed; and then as a box. > How can both definitions of 'panels work?
Permit me a short diversion into some little published "theory". You may know it already, but I want to make a stab at making some concepts clearer. It is not very obvious but there are two levels of abstraction when building screens in View. The lower level is the face level. Here is a quote from some *old* documentation for View: "There is only one type of graphical display object in REBOL. It is called a face." So only faces can be displayed. The higher level of abstraction is VID. Again from that documentation: "The Visual Interface Dialect (VID) is designed to simplify the implementation of View scripts using styles. VID consists of a set of functions." And from the new documentation: "VID provides shortcut expressions that are automatically translated into View objects and functions" Those view objects are faces. So VID is a quick way to make faces. These faces are then displayed. You have probably seen talk of "Glass", Max's work in progress. Glass is another higher level abstraction. When it is finished you will be able to choose to use VID or to use Glass to build screens. The most important function in VID is LAYOUT. If you type HELP LAYOUT at the console you will see the following as part of the description: "Return a face with a pane built from style description dialect." So you give LAYOUT a special little script written in a special language (VID) and it gives you back a face. This face has a PANE, a collection of faces (or sometimes a single face), which has been created from the rules given to LAYOUT. This code uses the layout function to create four faces (one main face that has a PANE containing three faces of different colours): example-face: layout [box red box green box blue] print length? example-face/pane view example-face By the way, every face has a PANE attribute, but quite often this attribute is set to NONE. Ok back to the "how to". The document is demonstrating a technique for manipulating complex faces. The example constructs a View object structure that is dynamically manipulated and thereby implements the changing subpanels. It is more specifically a demonstration of one way to change the PANE of a face. The strategy of the example code is to use LAYOUT three times to construct three major faces. The first is the main face ("main"). The other two faces ("panel1" and "panel2") will be the subpanels. Inside the main face one face, that created from the box and referred to as "panels", is intended to be used as the subpanel container. On pressing a button the PANE attribute of this face is changed; thereby changing the composition of the whole graphical display. The document I referred to earlier can be found here http://www.rebolforces.com/archive/view099users.html (with thanks to Allen Kamp for maintaining an imporant resource). Let me know if this description is unclear or how it could be improved. I am considering keeping it on my website to help others down the track. Brett

 [3/6] from: media:quazart at: 19-Nov-2001 8:11


sorry if this isn't a real response, but you where wondering what exactly was glass... the other day... Well its simply an answer to all of this nonsense! Everything in glass is ordered in rows and columns. so there are no surprises... check out where its going: www.rebolforces.com/~glass Its going into closed beta sometime this week and public beta next week! (probably at the end of next week). sorry to rub it in.... ;-) -MAx

 [4/6] from: ddalley:idirect at: 19-Nov-2001 19:03


Hello, MAx: ----- Original Message ----- From: "Media" <[media--quazart--com]> To: <[rebol-list--rebol--com]> Sent: Monday, November 19, 2001 8:11 AM Subject: [REBOL] Re: View: How Does This Work?
> but you where wondering what exactly was glass > Everything in glass is ordered in rows and columns. > so there are no surprises...
Ok, that would solve one of my problems.
> check out where its going: > www.rebolforces.com/~glass
I liked the "brushed metal" look. Can it be implemented now, without glass; is it just a pattern image being tiled?
> Its going into closed beta sometime this week and public beta next week! > (probably at the end of next week).
Good luck with it. Will Glass get distributed in REBOL's own distributions?
> sorry to rub it in.... ;-)
It's not rubbing it in when I am just about to start something; if I was finished, then THAT would be rubbing it in! ;^) Donald Dalley

 [5/6] from: media:quazart at: 20-Nov-2001 11:18


Hi Donald,
> > check out where its going: > > www.rebolforces.com/~glass > > I liked the "brushed metal" look. > Can it be implemented now, without glass; > is it just a pattern image being tiled?
that's basically it... use the following effect for buttons: [tile gradcol 0x1 140.140.140 80.80.80] the polished image is pretty easy to find. When cheking out most of RT's example, you'll notice they use the image pretty much everywhere
> > Its going into closed beta sometime this week and public beta next week! > > (probably at the end of next week). > > Good luck with it.
I'll keep the list posted on glass developments. As usual, few, brief and quick mails.
> Will Glass get distributed in REBOL's own distributions?
Tricky question... If I say anything else than no, it looks like if I'm hidding something. If I say "no" it seems that I don't want it to be, or that RT isn't interested... the only thing I could say is: "I guess, nothing's impossible". The same goes for all of the other tools like rugby, anamonitor, or even many of Ladislav's advanced functions... This is a nice time to be a reboler... in a sense, everything is up for grabs.
> > sorry to rub it in.... ;-) > > It's not rubbing it in when I am just about to start something; > if I was finished, then THAT would be rubbing it in! ;^)
LOL :-) ciao! -MAx

 [6/6] from: ddalley:idirect at: 21-Nov-2001 2:09


Hi, Brett: ----- Original Message ----- From: "Brett Handley" <[brett--codeconscious--com]>
> The word RETURN is the important one in this case.
So I see.
> Imagine an invisible cursor that Layout uses. As Layout places each
element
> it moves the cursor. The BELOW keyword instructs Layout to move the cursor > down vertically, the ACROSS keyword tells it to move the cursor > horizontally. As each element is place the cursor is moved to the
extremity
> of that element. So with this example:
I assembled all of your examples in one script, to run them. They clearly demonstrated what I needed to know.
> Let me know if this description is unclear or how it could be improved. I
am
> considering keeping it on my website to help others down the track.
The tutorial is fine - the examples do their job. I can't make recommendations to improve it, just yet, but if you are going to allow running it from your site, have the code and the example visible at the same time. I now need to get some View code under my belt. Thank you, Donald