0

I'm stuck with a simple thing i cant understand please help me out I'm really stuck

i need to create a LineMorph that will change dynamically start from point 100@100 To mouse location how can i achieve it ?

2Big2BeSmall
  • 1,348
  • 3
  • 20
  • 40

1 Answers1

4

You should create your own morph subclass to handle mouse events. Or you can use a ready-made HandleMorph:

| line handle |
line := (LineMorph from: 100@100 to: 100@100 color: Color red width: 2) openInWorld.
handle := HandleMorph new forEachPointDo:
    [:newPoint | line setVertices: {100@100. newPoint}].
self currentHand attachMorph: handle.
codefrau
  • 4,583
  • 17
  • 17
  • 1
    Tnx man - i have one more question if you could help me i would be very happy - i would like to activate a method after mouse click - what should i do ? – 2Big2BeSmall Jun 16 '15 at 15:53
  • 1
    As I wrote, create your own morph. Do a tutorial, e.g. http://static.squeak.org/tutorials/morphic-tutorial-1.html And if you get stuck again, post a proper question. – codefrau Jun 17 '15 at 10:55