How to create an arrow morph in smalltalk80 (squeak) programmatically?

600 views Asked by At

I need to draw an arrow morph from center of one given morph to center of another given morph.

Any help would be appreciated.

1

There are 1 answers

0
codefrau On BEST ANSWER

Assuming a and b are your morphs:

arrow := (LineMorph from: a center to: b center color: Color red width: 2) makeForwardArrow.
arrow openInWorld.

If you want to update the position after the morphs move, do this:

arrow setVertices: {a center. b center}