Page 1 of 1

Easy - need some help

Posted: Tue Jun 03, 2014 11:52 am
by ChessGredon
I want to create graphics, but when I write for example

Code: Select all

create graphic "Line"
it creates a rectangle. How to tell Livecode I want line, oval or other? In other words how to change the "Type" property in the Inspector?

Re: Easy - need some help

Posted: Tue Jun 03, 2014 12:48 pm
by Klaus
Hi Chess,

read up "templategrahic" (and other templateXXX) in the dictionary.
That is a "virtual" object from which all newly created objects are "derived".

So you can set all neccessray properties of "the templategraphic" before you create it.
Example:
...
# This is what you are missing:
set the STYLE of the templategraphic to "line"

set the linesize of the templategraphic to 6
set the points of the templategraphic to "0,0" & CR & "100,100"
## etc..

## Now create the new graphic and see how it looks :-)
CREATE graphic "line1"

## Important and good style:
RESET the templategraphic
...

You also my want to take a look at these stacks 8)
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

P.S.
Maybe you can find a more meaningful thread title the next time! 8)

Re: Easy - need some help

Posted: Tue Jun 03, 2014 1:07 pm
by ChessGredon
Thanks, yea the title is stupid :)

Re: Easy - need some help

Posted: Tue Jun 03, 2014 2:02 pm
by dunbarx
Klaus is the man.

Just an aside. There is only one type of graphic object class, just as there is only, say, one button class. And the only difference between, say, a default button and a pull-down is the properties of those two instances,

Same with graphics. Which is why the templateGraphic (or any of the other templates) is so powerful. But my point is you could have taken that rectangle and changed it by hand to a line, just by changing the appropriate properties. It is this fundamental aspect of LC I wanted to make sure you understood.

Craig Newman