Easy - need some help

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ChessGredon
Posts: 24
Joined: Thu May 15, 2014 4:40 pm

Easy - need some help

Post by ChessGredon » Tue Jun 03, 2014 11:52 am

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?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Easy - need some help

Post by Klaus » Tue Jun 03, 2014 12:48 pm

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)

ChessGredon
Posts: 24
Joined: Thu May 15, 2014 4:40 pm

Re: Easy - need some help

Post by ChessGredon » Tue Jun 03, 2014 1:07 pm

Thanks, yea the title is stupid :)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Easy - need some help

Post by dunbarx » Tue Jun 03, 2014 2:02 pm

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

Post Reply