Recently, Jim Hurley wrote:

 I've discovered I don't understand the templateGraphic. In the docs it says:

 Use the templateGraphic keyword to set up default properties to be
 used for any new graphics you create.....The properties of the
 templateGraphic are reset to their defaults when all running handlers
 finish executing.

However the following handler give me a circle whose foregroundcolor is white.

 local x0,y0

 on circle radius
  reset templateGraphic
  if there is no graphic "myCircle" then create graphic "myCircle"
  set the style of graphic  "myCircle" to  oval
  set the  rect of graphic "myCircle" to
 x0-radius,y0-radius,x0+radius,y0+radius
> end circle

This implies that the default value of the foregroundcolor of the templateGraphic is white. At least for this particular stack. I can, of course, set the foregroundcolor to black--but only after the "reset templategraphic." (I did have an earlier problem with this stack--it did appeared that all the foregroundcolors were set to white throughout the stack. Maybe the stack is corrupted.)

 If I create a new stack, the same handler gives me a black
 foregroundcolor for the circle.

 Are there default values for the templateGraphic that apply to the
 *stack*? How would one get the default values of the templateGraphic?

The templateGraphic is used to set properties of any graphic you create *before* you create it. In the above example, you should be able to set your properties before calling "create graphic". "resetGraphic" is usually called after changing the template to restore the template object to "normal".

Try this:

 on circle radius
  if not there is a graphic "myCircle" then
    set the style of the templateGraphic to oval
    set the  rect of the templateGraphic to \
       x0-radius,y0-radius,x0+radius,y0+radius
    set the name of the templateGraphic to "myCircle"
    create graphic
    reset the templateGraphic
  end if
 end circle


Regards,

Scott Rossi
Creative Director
Tactile Media, Development & Design
-----


Scott,

Thanks for your response.

However, when I use your "circle" above I get an opaque circle filled with the color yellow. That was why I inserted the reset the templateGraphic *before* creating the circle graphic--but only with this stack. I suspect there is something corrupted in my stack--how many times has this easy assumption turned out to be wrong?

I can, as I said, set the foregoundcolor to black, but I should have thought that that would be the default value--the value you would get after one "reset the templateGraphic".

The only way I can think of testing this issue is to examine the default values of the templategraphic, and this I don't see how to do.

Jim
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to