View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 3 - Samuel Young

Part 1

One problem I have experienced in Squeak was with the StandardFileMenu class. It is a simple file menu that may be invoked at will and allows the user to select a file from the local filesystem. I was using this to select image files for the Milestone 2 image widget, but I wanted to certain file extensions from the file list. Specifically, I only wanted GIFs, JPEGs, and PNGs to show up. After noticing that StandardFileMenu is supposed to support this functionality with the 'oldFileFrom:withPattern:' or 'newFileFrom:withPattern:' messages, I tried to take advantage of it. However, the messages used to created these menus are class methods that chain to appropriate instance methods, and the class version of the messages were absent.

It was pretty obvious that someone simply left made a silly mistake and forgot to add them, and furthurmore, the code is very simple. I turned to my good friend Google to see if anyone else has noticed this problem and found this link.

Sure enough, it's a small bug in the StandardFileMenu class and it was easy to fix. In fact, here's a link to a class that I created that extends StandardFileMenu and fixes these two class methods. They are easy enough to implement in the StandardFileMenu itself, but in the spirit of preserving the original Squeak image in some form, I made an extension:
StandardFileMenuFix.st

Part 2

Discussion 3 - Hai Phan (gtg394v)
This discussion page made me realize a number of mistakes that I have made when comparing strings or checking for string equality. I was surprised to see that Smalltalk handles the comparison in a way so similar to Java. I guess this shows a subtle similarity in the mechanics of object-oriented languages. Had I known this, I could have avoided a lot of silly debugging time and let Squeak do the comparison for me instead of writing my own more "specific" code.

Russell Myers' Discussion 3
This discussion page is extremely helpful regarding layout strategies in Morphic using AlignmentMorph. It allows for the very easy creation of HTML-like tables for placing and organizing morphs. You may create any number of rows/columns, edit colors and transparency, or even add padding between cells in the AlignmentMorph.

Links to this Page