something read but can not find it....

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
chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

something read but can not find it....

Post by chris25 » Sat Nov 16, 2013 6:32 pm

A couple of weeks ago I read a tutorial where you could draw a line or a shape with the tool from the toolbar, then place an "object" on top and code the object to follow the contours of the shape. A little search just now but I can not find it, does anyone know this tutorial?
thankyou
chris

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

Re: something read but can not find it....

Post by dunbarx » Sat Nov 16, 2013 7:08 pm

Chris.

I see you are now a mentor. Terrific, Really.

Look up the "move" command. Consider that graphics, even freehand ones, have defining "points", to which an object can be moved. So:

move yourObject to the points of yourGraphic

Points are a return delimited list of locs, these being either explicitly defined or derived from the property of a graphic.

Craig

EDIT. Note that the graphic need not be visible for another object to follow its points.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: something read but can not find it....

Post by jmburnod » Sat Nov 16, 2013 7:09 pm

Hi chris,

I don't know this tutorial but you need probably something like that:

Code: Select all

move control "myControl" to the points of grc "myPath"
Best regards
Jean-Marc
https://alternatic.ch

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: something read but can not find it....

Post by chris25 » Sat Nov 16, 2013 8:19 pm

Thankyou Jean-marc, and Craig, I am sure you are aware of adobe illustrator, and these type of points I thought you were referring to but I notice that LC does not construct its freehand lines in this manner (being the first time that I have even looked at this part of the tool box), these are rather objects, expectantly. So the points you refer to are the x-y co-ordinates which I am familiar with already, when you say "Points are a return delimited list of locs" I presume you mean the loc (left and top) and the rect (left top right bottom) whereby the points are the positions relative to the size of the stack window. Although Ido not quite understand what is meant by "return...delimited" (delimited meaning space, but 'return' meaning..?
regards
chris

edit: ok I see that it only works with a freehand polygon and not with any other freehand line.EDIT, yes it does, I must have missed something, so anyway this works, somewhat diggery, but it goes. Deleted the rest.
I used:
on mouseUp
move grc "ball" to the points of grc "path" in 3 seconds
end mouseUp

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

Re: something read but can not find it....

Post by dunbarx » Sat Nov 16, 2013 8:46 pm

Chris.

The "loc" is not the topleft. That is the topleft. The loc is the center of an object.

Freehand polygon? Freehand graphic, And these do indeed have points. Try this again. Make a freehand graphic, and in msg, write:

answer the points of grc "yourGraphic"

As for delimited, this is a powerful word in LC that simply defines a parsing character in a string of text:

"1,2,3,4" is a string of four numbers delimited by commas. By default, comma is the itemDelimiter. This string has four items. You can change this as follows:

set the itemdelimiter to "x"

now "1x2x3x4" is again a string of four numbers, delimited as items by "x", and has four items. This feature has enormous power. So a return delimited list would look like the results of your "answer' experiment above. Of course, by default, return is the delimiter for lines. You might say a space is the delimiter for words.

Craig

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: something read but can not find it....

Post by chris25 » Sat Nov 16, 2013 8:54 pm

Whoops - I should not have drawn such a long line, that list of points is interesting, thanks Craig. By LOC I meant when you set the loc of an object I set it by how far the centre is from the top and the left, should have been more clear.

Post Reply