Here's another way:

        view layout [
                style button button
                        effect [draw [pen black fill-pen 0.0.0 circle 12x12 10]]
                        with [
                                append init [
                                        effect/2/4: color
                                        color: 120.120.150
                                ]
                        ]
                button blue "blue"
                button green "green"
        ]

It takes the fill-color from face/color, which is handier to write
at the end than:

        with [user-data: blue]

but, as you can see, the button color behind the circle is
always going to be 120.120.150

Or perhaps a better way is to make your own little dialect,
using the words facet:

        view layout [
                style button button
                        effect [draw [pen black fill-pen 0.0.0 circle 12x12 10]]
                        with [
                                words: compose [
                                        fill (func [new args][
                                                new/effect/2/4: second args
                                                next args
                                        ])
                                ]
                        ]
                button blue fill red
                button green fill black
        ]

(Mmm, on REBOL/View 1.2.1.3.1 21-Jun-2001, the second button's
circle looks more like a square to me... a bug in draw? All is ok
in the newer betas.)

Anton.

> Hi List,
>
> A problem with the draw dialect used in an effect block. My goal is to
> display 4 buttons. My first attempt was to use a style.
>
> f draw-layout: [
>   h2 "Draw buttons"
>
>   style draw-button box 24x24 effect [draw [pen black fill-pen red circle
> 12x12 10]]
>
>   across
>   draw-button [ print "hey, I'm clicked!"]
>   draw-button [ print "hey, I'm clicked!"]
>   draw-button [ print "hey, I'm clicked!"]
>   draw-button [ print "hey, I'm clicked!"]
>  ]
>
>  view center-face layout draw-layout
>
> This works! However I want 4 different colors and possibly just one
> parameterizable style. The idea is to use a unique effect block
> as a model.
> The only thing I want to change is the fill-color of the circle.
> To help the
> changing, I have put a word in the effect block.
>
>  [pen black fill-pen x-color circle 12x12 10]
>
> The idea is to replace x-color with the desired color at runtime. Finally
> the desired color is stored in the face/user-data .
>
>  draw-layout: [
>   h2 "Draw buttons"
>
>   style draw-button box 24x24 effect [
>    draw [pen black fill-pen x-color circle 12x12 10]]
>    feel [
>     redraw: func [face act pos][
>      if act = 'draw [replace face/effect/2 'x-color face/user-data]
>     ]
>    ]
>    with [user-data: 'white]
>
>   across
>
>   r-btn: draw-button [ print "hey, I'm red"] with [user-data: 'red]
>   b-btn: draw-button [ print "hey, I'm blue"] with [user-data: 'blue]
>   y-btn: draw-button [ print "hey, I'm yellow!"] with [user-data: 'yellow]
>   g-btn: draw-button [ print "hey, I'm green!"] with [user-data: 'green]
>  ]
>
>  view center-face layout draw-layout
>
>
> This works too but there could be a simpler solution. I have
> tried to use a
> draw block like that:
>
>  [pen black fill-pen face/user-data circle 12x12 10]
>
> Unfortunately face/user-data is unknown in this block.
> Is there a way to access the face object here? That is my question !
>
> Patrick

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to