views:

948

answers:

4

How can I write a GIU in Squeak? I'm a Smalltalk newbie and I'm using Cincom's VisualWorks at the moment but I'd like to give Squeak a try. I see that Squeak has Morphic for graphics but for the life of me I can't seem to find a package to write an MVC based GUI.

+6  A: 

Squeak includes all the classic MVC classes, but you can also create GUIs using Morphic, indeed much more interesting ones than you can (easily) with MVC - that is after all why Squeak was created!

Note that you may get a better response posting somewhere more specific - there don't seem to be many Smalltalk people on SO. Try http://news.gmane.org/gmane.comp.lang.smalltalk.squeak.beginners to start with.

anon
Thanks Neil, hopefully more Smalltalkers will gravitate to SO - it's not a bad site...
KHWP
+2  A: 

GUIs and Squeak are first and foremost very confusing. It is fairly easy to create a GUI using Squeak. Basically, you just draw a few rectangles, copy some text boxes, the haloes of very much every morph allow for cloning and then you can drop these morphs into your new UI. It is more difficult to add YOUR behaviour to the UI you just created since you somehow have to find your widget in the code browser.

This is the part where I would like to point out that I find the Morphic implementation in Squeak very annoying. So, maybe I've mistaken all of this, but this is how I see it. Morphic was DESIGNED to allow you to graphically construct your own UI with just a few clicks. And it was designed so in the Self programming environment, where there is no Browser-objects gap. Registering your clone into the ordinary code tree is a triviality in Self. (It is of course not trivial to export your program, but then again, in Smalltalk that is never easy anyway).

So, the real world morphic code that I come across usually treats morphs like any other UI framework objects: creating the UI from code, ignoring the graphical building. I have not seen a convenient way to "shock freeze" a morphic UI into a file the way Interface Builder does on Mac OS X. Or, more generally, if you click together a morphic UI, it is difficult to access it from the Code Browser.

The hint from Neil to leave the whole Morphic thing aside and turn to MVC might be understandable. Yet, the few times I have had to deal with user interfaces in Squeak, I examined UI generation code from around the image and tried to mimmick their style.

nes1983
+3  A: 

Depends on what you want to do, who your audience is. The original MVC is fast but is not really maintained anymore, and it looks very 1980ish. The original Morphic in Self might have been nice, but in Squeak it has evolved into a spaghetti mess. Have a look at a few classes at the top of Morph's inheritance hierarchy...

There is some effort in Pharo to bring a nicer look to the Morphic widgets, so it doesn't frighten newcomers away the second they open an image. Also there are promising GTK and Objective-C bindings under work that I'd love to see gain more use. Finally, we see more and more web apps... Seaside can be a nice alternative to native UIs, since it excels at web applications with complex flows.

Damien Pollet
+1  A: 

We have an off-the-shelf, Windows, application written in Squeak. Most of it is done with Morphic. Morphic provides alot of value for the main user experience. Software configuration though was 'weird' when you used dialog boxes, file selection, etc.

I was really happy to discover WxSqueak recently which gives a native experience from Windows. I'm using it in conjunction with Morphic.

pgadzinski