On 05.06.2012, at 11:46, OrgmiGeek wrote: > In my spare time I decided to rite a simple paint program! I have encountered > some problems: > #1 does paint stuff work in the BorderedMorph category?
With a Pen you paint on a Form (which is an picture object holding pixels). To display a Form in Morphic you can use an ImageMorph. > #2 how would you make the program draw where your mouse pointer is? I think > you do it like: > myPen goto: 200@200. but more like: myPen goto: mouseX@mouseY Your morph can receive mouse events. You need to implement the handlesMouseDown: method to return true. This will send mouse event messages to your morph. It will receive a mouseDown: message when the mouse button is pressed, and a mouseMove: message when the mouse is moved subsequently, and finally a mouseUp: message. The argument to these messages is a MouseEvent. It has a position, but that is in world coordinates. You need to subtract the morph's topLeft coordinate from the event's position. It's really just a handful of lines, but see the attached example for a working version. - Bert -
BertsPaintMorph.st
Description: Binary data
_______________________________________________ Beginners mailing list [email protected] http://lists.squeakfoundation.org/mailman/listinfo/beginners
