简体   繁体   中英

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

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

Any help would be appreciated.

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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM