Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
2. (20) Morphic
(a) (12) When a window is enlarged by the user, the submorphs of that window should be adjusted; otherwise, the submorphs will be too small and there will be blank spaces in the window. Describe one way to ensure that your submorphs get resized and rearranged when the window changes size. In your description, name at least one specific method or class.
The same issue exists for morphs other than full-blown windows – if a non-window is enlarged by the user, then ideally its submorphs should be adjusted. What can you do in this case? This time, a specific class or method need not be named.
(b) (8) Choose one of the following. Give some Squeak code that will perform the operation.
1. adding an image to the screen so it can be dragged around like any morph. Assume that the image is held in a variable named "form".
2. asking a yes-no question.
3. requesting an item from a menu.
4. requesting a word or line of textual input from the user.
Partial credit for naming a specific class that will be useful.
(a) Part 1 (6 points):
Full credit if they name a correct class or method. Some possibilites are-
(AddMorph: frame: )
A description alone will only receive half credit.
(b) Part 2 (6 points):
Students have the option of describing the correct thing.
Some possible answers are:
(AlignmentMorph "use a morph that automatically lays out its
children with commands I can specify")
(implement layoutChanged "there is a method in morphic that gets
called after any size changes. Implement it to resize the submorphs)
(b) (8 points):
- 1.) form asMorph openInWorld OR (SketchMorph withForm: form) openInWorld OR form openAsMorph
- 2.) self confirm: 'What do you think?' Note: There are many additional ways to do this, so I looked at all answers. The one listed is just one way to do it.
- 3.) (SelectionMenu selections: #('one' 'two' 'three')) startUp
- 4.) FillInTheBlank request: 'Hi there!'
Link to this Page