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.

 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


________________________________________________________________
Etudiant: Wanadoo t'offre le Pack eXtense Haut D�bit soit 150,92 euros d'�conomies !
Et pour 1 euro de plus, re�ois le CD-ROM du jeu Dark Age of Camelot
+ 1 mois de jeu en r�seau offert ! 
Clique ici : http://www.ifrance.com/_reloc/mail.etudiant 

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

Reply via email to