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

[REBOL] Re: Little questions, big answers...

From: arolls:bigpond:au at: 6-Sep-2001 2:03

Layout is just a function that returns a face. Its argument is a block. Layout looks in the block and interprets it in its own way. (ie. The layout dialect). Field (and others, like button) only have a meaning in the context of a block passed to layout (by default, anyway). Layout sees "field" and adds a new subface to the face it is preparing to return to you. A face can be a container of many subfaces. The subfaces are called "panes" in rebol terminology. The panes are stored in an attribute of the face; pane (makes sense, in the real world, panes are smaller parts of a window in a house). Actually, a face is really just a rebol object with a whole lot of attributes set up. Attributes are just words inside the object. This is how to refer to an attribute of a face produced by layout: lay: layout [field] Here, lay is set to the face that layout returns. Let us look in the face: probe first lay == [self type offset size span pane text color image effect data edge font para feel saved-area rate show? options parent-face old-offset old-size line-list changes face-flags action state style alt-action facets related words colors texts file var keycode reset styles init multi blinker pane-size dirty? help user-data flags parent] (The first item in an object is the list of words defined in it.) We get a big list of words. Interesting ones are: lay/self refers to itself (hence lay/self == lay ) lay/type == face tells you this object is a face lay/style == none (boring this time, but tells you which vid style it is, see below) length? lay/pane == 1 tells you there is one subface in our layout. lay/pane/1/style == field It's a field! (as we defined at the beginning). And there are other interesting ones too. Layout's dialect also allows setting of words. It sees a set-word! notation, such as "IP-1:" and sets it to the face it is creating. This word "IP-1" is accessible outside the layout block. It basically points to the face object that has been created. Pane/1, in the containing face returned by layout, also points to that face. (lay/pane/1 == IP-1) So the layout block is a little bit special. You can't do normal rebol code in it. Well, you can, actually, but you have to do it the layout dialect way! :) layout [do [some code]] That can be quite useful sometimes. Anyway... I am not sure I am answering your questions.