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

a little help for a newbie?

 [1/19] from: editor::the-sports-page::com at: 16-Feb-2003 14:58


Dl'ed Rebol/View last night. I'd like to figure out how to click a button on one "layout" and trigger an event handler that fires up "new" layout in response. I can see that the easy-vid.r does this, but that script is a little beyond my abilities just yet. Could someone suggest a quick snippet I could play with? Also, how does one generate a complete list of "faces" automatically? Thanks, Dave Fobare

 [2/19] from: ammon:addept:ws at: 16-Feb-2003 16:46


Hi, You looking to do something like this? view layout [ banner "Welcome to REBOL, the heart of the internet" button "New Window" [view/new layout [banner "This is a new window"]] ] Notice that adding /NEW to VIEW made a new window to appear, if you simply used VIEW then the old window would be unviewed and the new one viewed. If you are looking for dialog to request information from the user, then you should be using REQUEST. As a new user, the first thing that I suggest you get aquainted with is the ? function and the ?? function. Both are very useful for exploring the language from the console. And for an automagical list of faces face-list: [] for i 1 10 1 [ append face-list compose [text (join "Face # " i)] ] view layout face-list There are many ways that you could do the above task, I chose to use FOR and a block of numbers but it could be does just as easily with FOREACH and a block of words. HTH Ammon Johnson CIO of Addept ---------- (www.addept.ws) 435.616.2322 ---------- (ammonATaddeptDOTws)

 [3/19] from: editor:the-sports-page at: 16-Feb-2003 19:35


Thanks! The /new modifier is just what I was looking for. For some reason I could not locate this info in the view-guide.html page in the docs section. I was likely looking in the wrong place. When I ran that code for the "face list" from the console, all I end up with is a view with a list of strings "Face #1", "Face #2", etc. I was hoping for a list along the lines of "h1", "h2", etc. I'll start on the "?" and "??" right up. Thanks, Dave Fobare Dave Fobare At 04:46 PM 2/16/03 -0700, you wrote:

 [4/19] from: carl:cybercraft at: 17-Feb-2003 12:47


On 17-Feb-03, Dave Fobare wrote:
> Dl'ed Rebol/View last night. I'd like to figure out how to click a > button on one "layout" and trigger an event handler that fires up > "new" layout in response. I can see that the easy-vid.r does this, > but that script is a little beyond my abilities just yet. Could > someone suggest a quick snippet I could play with?
Hi Dave, A very rushed respones... view layout [ button "Open Window" [ view/new layout [text "New Window"] ] ] The contents of the block after 'button is evaluated every time you click on the button. -- Carl Read

 [5/19] from: gchiu:compkarori at: 17-Feb-2003 12:36


On Sun, 16 Feb 2003 14:58:48 -0600 Dave Fobare <[editor--the-sports-page--com]> wrote:
>Dl'ed Rebol/View last night. I'd like to figure out how >to click a button on one "layout" and trigger an event >handler that fires up "new" layout in response. I can see
Do you mean like this? view center-face layout [ button "new" [ view/new layout [ banner "New layout" ]]] -- Graham Chiu http://www.compkarori.com/cerebrus

 [6/19] from: ljurado:bariloche:ar at: 17-Feb-2003 0:33


>.... I was > hoping for a list along the lines of "h1", "h2", etc. >
Perhaps this? face-list: copy [] for i 1 4 1 [ append face-list compose [(to-word join "H" i) (join "H" i)] ] unview view layout face-list Luis

 [7/19] from: editor:the-sports-page at: 16-Feb-2003 23:16


Well, that works for the first 4 -- what about the other 36? I just thought that there must be an easy way to generate a list of all 40 from the console. Dave Fobare

 [8/19] from: ammon:addept:ws at: 16-Feb-2003 22:45


Have you seen this? http://rebol.com/docs/view-guide.html HTH! Ammon Johnson CIO of Addept ---------- (www.addept.ws) 435.616.2322 ---------- (ammonATaddeptDOTws)

 [9/19] from: brett:codeconscious at: 17-Feb-2003 17:31


What do you mean by a list of faces? What is available or what you have created at runtime? If you want to see what is available, you could one of my programs: On the View Desktop - Click the GOTO menu item. Enter the URL http://www.codeconscious.com/rebsite/documentation.r Click Goto Click the "VID Ancestry" Icon. The display is of all the VID styles and the indentation relates to how they are derived (based on) each other. Brett.

 [10/19] from: editor:the-sports-page at: 17-Feb-2003 7:33


The VID docs say that there are a total of 40 faces available. I'd like to be able to generate a list of these at the console. Dave Fobare

 [11/19] from: g:santilli:tiscalinet:it at: 17-Feb-2003 14:05


Hi Dave, On Monday, February 17, 2003, 2:33:14 PM, you wrote: DF> The VID docs say that there are a total of 40 faces available. I'd like to DF> be able to generate a list of these at the console. I think you mean "styles", actually (not "faces"). foreach [name style] system/view/vid/vid-styles [print name] Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

 [12/19] from: greggirwin:mindspring at: 17-Feb-2003 10:21


Welcome to REBOL Dave! DF> The VID docs say that there are a total of 40 faces available. I'd like to DF> be able to generate a list of these at the console. As Gabriele said, the term you are probably looking for is "style" rather than "face". As a visual metaphor, a STYLE is what you would find in the toolbox in tools like VB, where a FACE is the instance of a style you would find sited on a form. REBOL uses a number of unique terms that will take a little getting used to (particularly WORD instead of VARIABLE - which is important in REBOL because WORDs don't work exactly like variables in other languages). -- Gregg

 [13/19] from: editor:the-sports-page at: 17-Feb-2003 14:10


Gabriele- Sorry -- at times it seems like "faces" and "styles" are used interchangeably. Your snippet gives me exactly what I'm looking for. Now that I've got that down, how do I list all of the facets of a particular style? Based on your original snippet, I tried what I thought would be logical: foreach [name facet] system/view/vid/vid-styles/h1 [print name] which I hoped would give me all of the facets that style "h1" possesses. Didn't work. Dave Fobare

 [14/19] from: editor:the-sports-page at: 17-Feb-2003 14:49


Ack! I should have waited before posting the last message -- a little tinkering gave me the following snippet for listing the facets of a style: foreach [name facet] system/view/vid/vid-styles/button/facets [print name] Actually, I'm not entirely sure this is right -- the result was actually a lot more than I bargained for: 100x24 none align center valign middle style bold size 2x2 effect bevel color svvc/bevel ?object? none ed ge make edge font/color: first font/colors if all image not effect effect copy fit if color appen d effect reduce colorize color if all colors greater? length? colors 1 effects compose/deep fit co lorize first colors fit colorize second colors if not any color colors effect effects effects grad ient 0x1 66.120.192 44.80.132 gradient 0x-1 66.120.192 44.80.132 if not color color svvc/button It looks like a list of both facets AND their default values, no? Dave Fobare At 02:05 PM 2/17/2003 +0100, you wrote:

 [15/19] from: antonr:iinet:au at: 18-Feb-2003 12:56


Dave, You have (understandably) misunderstood how FOREACH is used. The first argument to foreach is a word or a block of words that *you* name, that will be set to successive values in the second argument. ie. It just so happens that Gabriele chose good words [name style] to refer to each pair of elements in system/view/vid/vid-styles. He could have used [cow dog] as long as the action block was [print cow]. Check out this console session:
>> foreach [a b c] [1 2 3 4 5 6 7] [print [a b c]]
1 2 3 4 5 6 7 none none You can see that, because I specified [a b c] (three words), that three numbers at a time are taken from the block. Now, if you examine system/view/vid/vid-styles:
>> probe system/view/vid/vid-styles
It gives you a really long block, that looks like this: [face make object! [ type: 'face offset: 0x0 size: none .... ] IMAGE make object! [ type: 'face offset: 0x0 size: none span: none pane: none ] .... .... .... ] (By the way, PROBE is really useful.) What is it, though?
>> type? system/view/vid/vid-styles
== block! What's inside it?
>> type? system/view/vid/vid-styles/1
== word!
>> type? system/view/vid/vid-styles/2
== object! So the first thing inside is a word, and the second thing is an object. If you continue, you see that the third thing is again a word, and the fourth thing is an object. So we have repeating pairs of elements. We could have rewritten Gabriele's line: foreach [word object] system/view/vid/vid-styles [print word] Here, 'object is being used only so that we skip over the objects. Nothing is being done with it in the action block [print word]. This reminds me of the relatively new function EXTRACT:
>> extract system/view/vid/vid-styles 2
== [face IMAGE BACKDROP BACKTILE BOX SENSOR KEY VTEXT ... How to see the facets of a face? A face is really just an object with some standard face elements in it. Do this to have a look at the standard face:
>> probe face
Now to get the list of facets:
>> print mold first face
So our example:
>> print mold first system/view/vid/vid-styles/button
Anton.

 [16/19] from: g:santilli:tiscalinet:it at: 18-Feb-2003 10:02


Hi Dave, On Monday, February 17, 2003, 8:49:42 PM, you wrote: DF> Actually, I'm not entirely sure this is right -- the result was actually a DF> lot more than I bargained for: When VID creates a face out of a style, it places the VID code used in the /FACETS "field" (or should I call it "facet" ;-) of the face. This happens when you create a new style out of an existing one too. So, what you saw was the code used to create the button style. Anton has already given you a good answer I think; feel free to ask more if you need. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

 [17/19] from: rotenca:telvia:it at: 18-Feb-2003 20:33


> When VID creates a face out of a style, it places the VID code > used in the /FACETS "field" (or should I call it "facet" ;-) of
Can you see some reason for this? --- Ciao Romano

 [18/19] from: ammon:addept:ws at: 18-Feb-2003 15:05


All he was saying is that it actually builds a new object (a new face) from the template (style) so that if you alter the object (face) later you don't alter the template (style). You can easily build a new template (style) if you have need of having multiple faces with similar properties (facets). HTH Ammon Johnson CIO of Addept ---------- (www.addept.ws) 435.616.2322 ---------- (ammonATaddeptDOTws)

 [19/19] from: g:santilli:tiscalinet:it at: 19-Feb-2003 11:14


Hi Romano, On Tuesday, February 18, 2003, 8:33:51 PM, you wrote:
>> When VID creates a face out of a style, it places the VID code >> used in the /FACETS "field" (or should I call it "facet" ;-) of
RPT> Can you see some reason for this? Debugging, I assume. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r