Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Questions on Summer 2003 M1 Milestone
I was working on M1 in the workspace and I can get it to pull up the pictures.
However, it displays them in the main Squeak window and it doesn't delete the previous
image when progessing through.
I've looked for a while and have tried a lot of other stuff, but am having trouble displaying
the images in their own "area." Could you help point me in the right direction?
When you send an instance of a Form class the message display it displays on the Squeak window (the global variable Display). Each new Form object you display will overwrite the screen pixels. See pages 72-75 and 202-205 in the book. Barbara Ericson
If you do it with Morphic (using ImageMorph or SketchMorph) instead of with the "display" methods, you will need to pause in a different way. The problem is that Delay will suspend the Morphic interaction loop and cause the display not to be updated.
To get you through M1, the following code implements a relatively Morphic-friendly delay for 5 seconds:
targetTime := Time now addSeconds: 5.
[ Time now < targetTime ]
whileTrue: [ World doOneCycle ].
(some people say they must tweak this to use addTime: instead of addSeconds:. Maybe it's a matter of whether the ANSI patches are loaded.)
In later milestones, you shouldideally do this a little differently, because calling the interaction cycle from inside itself is still a little funny. Instead, use step methods: if you make a method called step, then Morphic will call it several times per second and you can check whether anything on the screen needs updating. -Lex Spoon
It is fine to use form display and delay for this milestone but as Lex says you will probably want to change this later. Barbara Ericson
Hi. I am a little confused as to how to start working on this project. I was wondering if anyone can help exlain where to start. Thank you very much. ~Sabina Karkin
One thing you can do is to create a directory of images, and then try all the basic commands you will need one by one. Try loading a single image. Try listing the contents of a directory. Try displaying an image that you have loaded. -Lex Spoon
What time on Thursday is M1 due?
You need to turn in your code before 10:00 am using the coweb turn-in page. Turn in the hardcopy in class of your code. Remember the quiz is from 10:00am to 10:20am. Barbara Ericson
I've had two students ask me about their slides being different sizes.
Some slides are too big even to display it all on the page. Do students
need to resize their slides so they all fit on the page/all are the same
No, they don't need to all be the same size or even all fit in the window for milestone 1. They should clear or reset the display after each picture so they don't have a bigger image with a smaller image over it. When the slide show is over they should restore the display.
Squeak doesn't seem to want to display bitmap files for me. I get an "Error: image format not recognized". Is this a problem with Squeak, ImageMorph, or just me?
I just tried it on a .bmp file that I have and it worked fine. Check your .bmp is really a bitmap file. Also check what you are doing with ImageMorph (it doesn't take a bitmap file directly, it takes a Form object).
Does the class method "create" need to return a SlideShow instance?
yes. think of the create method as just a "new" method with a different name. to test your code, we'll run something like:
myShow := SlideShow create: 'D:\Pictures\summer02\'.
myShow show: 5.
I'm having some trouble clearing the screen after an image is displayed. Is there a form function I am missing or do we have to draw a line around the entire screen and fill it?
You can use Display restore after the slide show is over to reset the screen to what it looked like before the slide show. During the slide show you can either first capture the screen as a form and show it between slides or show a form filled with white (or black) as shown in the Joe the Box lecture clearWorld class method on Box. Barbara Ericson
Link to this Page