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?
#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
I hope you understand what I am trying to do. Thanks so much in advance
----- --- Under the age of 15 so don't want to post my name :D -- View this message in context: http://forum.world.st/Help-with-pen-stuff-tp4633281.html Sent from the Squeak - Beginners mailing list archive at Nabble.com.
On Tuesday 05 Jun 2012 2:46:17 AM OrgmiGeek wrote:
In my spare time I decided to rite a simple paint program!
Welcome to Squeak! Have you read the blog:
http://billkerr2.blogspot.in/2007/09/morphic-etoys-is-superior-graphical.htm...
John Maloney's article in the reference listed therein is an excellent starting point for graphical programming.
I have encountered some problems: #1 does paint stuff work in the BorderedMorph category?
If you mean paint as in the PaintTool, then no. Painting is for sketches while BorderedMorph is a patch of single color (or gradient of two colors) with a border. You can change the color of a bordered morph with:
myMorph color: Color blue.
#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
The 'mouse' is known as ActiveHand, so you would program it thusly: myPen goto: ActiveHand x @ ActiveHand y.
This can be tricky to program. If you don't have a stop condition, myPen will keep following the mouse all the time and that can be really annoying :-(.
HTH .. Subbu
On Tuesday 05 Jun 2012 2:46:17 AM OrgmiGeek wrote:
In my spare time I decided to rite a simple paint program!
Welcome to Squeak! Have you read the blog:
http://billkerr2.blogspot.in/2007/09/morphic-etoys-is-superior-graphical.htm...
John Maloney's article in the reference listed therein is an excellent starting point for graphical programming.
I have encountered some problems: #1 does paint stuff work in the BorderedMorph category?
If you mean paint as in the PaintTool, then no. Painting is for sketches while BorderedMorph is a patch of single color (or gradient of two colors) with a border. You can change the color of a bordered morph with:
myMorph color: Color blue.
#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
The 'mouse' is known as ActiveHand, so you would program it thusly: myPen goto: ActiveHand x @ ActiveHand y.
This can be tricky to program. If you don't have a stop condition, myPen will keep following the mouse all the time and that can be really annoying :-(.
HTH .. Subbu
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 -
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. I will try this as soon as I have time!
It's really just a handful of lines, but see the attached example for a
working version. I just opened it in a text editor :O that is not many lions at all!
- Bert -
I just have one more question how do I actually file in some thing. my dad and I spent ages trying to find that out so we just exchanged Images thanks so much for your help!
----- --- Under the age of 15 so don't want to post my name :D -- View this message in context: http://forum.world.st/Help-with-pen-stuff-tp4633281p4633334.html Sent from the Squeak - Beginners mailing list archive at Nabble.com.
On 05.06.2012, at 15:24, OrgmiGeek wrote:
It's really just a handful of lines, but see the attached example for a working version.
I just opened it in a text editor :O that is not many lions at all!
Nor other cats, really.
- Bert -
I just have one more question how do I actually file in some thing. my dad and I spent ages trying to find that out so we just exchanged Images thanks so much for your help!
Well, on my system, I just drag the email attachment into the Squeak window. Squeak will ask what to do with it, I choose "fileIn entire file".
Given that your email client even has trouble quoting correctly, you may have to save the attachment to a file first. If drag-and-drop of the file should not work, then open a File List tool in Squeak and navigate to the file.
To create the file out I right-clicked on the class and chose "file out".
A better way is using a ChangeSorter (google for "squeak changesorter").
The professional way for Squeak source code management is using Monticello, but you can learn that later.
- Bert -
On Tue, Jun 5, 2012 at 5:38 PM, Bert Freudenberg bert@freudenbergs.dewrote:
On 05.06.2012, at 15:24, OrgmiGeek wrote:
It's really just a handful of lines, but see the attached example for a working version.
I just opened it in a text editor :O that is not many lions at all!
Nor other cats, really.
- Bert -
I just have one more question how do I actually file in some thing. my
dad
and I spent ages trying to find that out so we just exchanged Images thanks so much for your help!
Well, on my system, I just drag the email attachment into the Squeak window. Squeak will ask what to do with it, I choose "fileIn entire file".
Given that your email client even has trouble quoting correctly, you may have to save the attachment to a file first. If drag-and-drop of the file should not work, then open a File List tool in Squeak and navigate to the file.
WoW that was easy! thanks! it worked :D
To create the file out I right-clicked on the class and chose "file out".
A better way is using a ChangeSorter (google for "squeak changesorter").
The professional way for Squeak source code management is using Monticello, but you can learn that later.
- Bert -
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
beginners@lists.squeakfoundation.org