Page 1 of 1

Understanding the templateGraphic

Posted: Wed Jun 11, 2008 2:15 pm
by bjb007
I want to have a bar chart on part of a form/stack
but I'm having trouble grasping the "templateGraphic"
concept.

Would be handy if I could just "draw line L1 from x1,y1 to x2,y2"
but seems not.

Can I have a lot of "templateGraphic" objects on a graphic
area?

How can I access a particlar one? Do they get unique names
when created? How do I know what the name is, since it
seems I don't provide it?

Can I use co-ordinates of the graphic area or does it
have to be co-ords of the form/stack/card or whatever?

Re: Understanding the templateGraphic

Posted: Wed Jun 11, 2008 7:54 pm
by FourthWorld
bjb007 wrote:Would be handy if I could just "draw line L1 from x1,y1 to x2,y2" but seems not.
Use the points property.
Can I have a lot of "templateGraphic" objects on a graphic
area?
There is only one template object for each object type in Rev's object model. It's a virtual object, with no physical representation. It's used to allow you to set properties before object creation, which is generally more efficient than setting them afterward if you're making a lot of objects with the same settings.

But of course you can have any number of graphic objects you like.
How can I access a particlar one? Do they get unique names
when created? How do I know what the name is, since it
seems I don't provide it?
Objects can be referenced by name, ID, or ordinal number. The last object created will have the highest ordinal number, so you could ask for "last graphic".

But it may be helpful to use the value if the variable "it" after creation, which will contain the long ID of the newly created object:

set the rect of the templateGraphic to 50,50,100,100
create graphic
set the name of it to "MyGraphic"
Can I use co-ordinates of the graphic area or does it
have to be co-ords of the form/stack/card or whatever?
Polygon and line style graphics have a points property, which is in the coordinates of the card. If it's helpful you can use coordinates relative to the topleft of the object with the relativePoints property.

Understanding the templateGraphic

Posted: Wed Jun 11, 2008 10:46 pm
by bjb007
Richard.

Thank you so much for taking the time to
educate me on this.

Since posting I've managed to draw a line
or two on my graphic area!

Still a couple of questions...

If I use "line" the ends seem to be rounded.
Is there a property to make them square or
should I use a rectangle?

Re "relative" the 2.8.2 Dictionary says:
"If the style property of the graphic is not polygon
or curve, the setting of its relativePoints property
has no effect". Is this the one you referred to as
"relative".

Can't figure out the color property for a line.
Took a guess and used 'pencolor' which works.
Is it the best one to use?

Searched the docs for 'templateGraphic" and
didn't find anything about properties. Any
clues would be appreciated.

Had a couple if incidents when positioning
the graphic rectangle on the property
inspector. A couple of times when I used
the up/own arrows a gremlin took control
and sent it uncontrollably on its way off the
form area. Is this a known bug?

Once again thank you for helping.