Draw a line from point A to point B

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Draw a line from point A to point B

Post by xApple » Fri Jan 18, 2008 5:56 pm

Hello everyone,
I am currently programming a project where I need to draw an arrow from point A to point B. This is a process much more complicated than I thought it would be. I have done most of the scripting necessary, my only problem remains actually creating the lines.

The following script creates a graphic object with style "line" and an end arrow; unfortunately nothing appears on the card where it is drawn !
Any solutions ? Help greatly appreciated !

Code: Select all

on createArrows
  go to card "arrowCard"
  if exists(graphic "theArrow" of card "arrowCard") then delete graphic "theArrow" of card "arrowCard"
  create graphic "theArrow"
  set the style of graphic "theArrow" of card "arrowCard" to "line"
  set the endArrow of graphic "theArrow" of card "arrowCard" to true
  set the lineSize of graphic "theArrow" of card "arrowCard" to 2
  set the arrowSize of graphic "theArrow" of card "arrowCard" to 3
  set the height of graphic "theArrow" of card "arrowCard" to 100
  set the width of graphic "theArrow" of card "arrowCard" to 100
  send "choose browse tool" to me in 1 tick
end createArrows

BIX
Posts: 33
Joined: Fri Oct 27, 2006 2:54 pm

Post by BIX » Fri Jan 18, 2008 6:09 pm

I think that you need to set the starting and ending points of the line.

Try adding this to your script:

Code: Select all

set the points of graphic "theArrow" to "100,100" & cr & "200,200"
You can use points that you need.
BIX

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Fri Jan 18, 2008 6:20 pm

Hey thanks a lot !
Don't know why I didn't see that earlier ^^

Post Reply

Return to “Talking LiveCode”