I'm new to smalltalk and squeak - and I must say, it seems capable of doing some pretty amazing stuff.
I started playing with morphs today. I created a Stack (which I called BlogStack), which has a TextBody (actually a scrolling text morph) and a button.
The button activates the following script when I mouseUp on the button:
printBody | | TextBody setCharacters: 'Enter text here' .
^ self
OK, printBody is a bad name, but let's not worry about that. The basic idea is that you press the button, and it replaces the TextBody text with 'Enter text here'. So far, everything works as I expect.
Now, I saved my stack morph from one image, and I wanted to see if I could load it in another. It loaded OK, but when I pressed my button, it complained:
'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 18 January 2009 at 4:19:06 pm'! !Object methodsFor: 'error handling' stamp: 'md 2/22/2006 21:21'! doesNotUnderstand: aMessage "Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector)." "Testing: (3 activeProcess)" MessageNotUnderstood new message: aMessage; receiver: self; signal. ^ aMessage sentTo: self. ! !
I am using Squeak 3.9 update #7067 for both the imported and exported morph.
Curiously, if I open up the viewer on TextBody, I can toggle through most of its categories (basic, scripts, and so on), but it throws an exception if I try to go to 'colour & border' or 'text'. What's going on? Is it a bug?
Should I expect morphs to work across images? What about if I upgrade squeak - what's the chance that I'll still be able to load my morphs?
Also, is there any way that I can create a class, or gain access to, BlogStack, say by doing something like: b := BlogStack . Would you advocate actually creating GUIs programmatically? It seems a safer bet, although rather more tedious.
Hello Mark,
welcome here!
I never used scripting, so maybe you'll repeat what I don't reply to in a new thread. Others might think I replied to everything.
MC> I am using Squeak 3.9 update #7067 for both the imported and exported morph.
Exporting projects has an option to include code, in my Image exporting a Morph doesn't ask me to export code, so I guess it doesn't.
MC> Should I expect morphs to work across images? What about if I MC> upgrade squeak - what's the chance that I'll still be able to load MC> my morphs?
Projects should work across images of the *same* version of Squeak but you can be quite sure they won't work across different versions of Squeak. Dunno about Morphs.
MC> Would you advocate actually creating GUIs programmatically? MC> It seems a safer bet, although rather more tedious.
Yes, because you can version them with Monticello. Personally I start drawing UI's with simple Morphs but without any function and step by step replace them with real UI Morphs.
If you care about more standard UI's and UI behaviour you should definitely take a look at Polymorph.
Cheers,
Herbert
I don't use Morphic scripting, but I've played around with it. That section of Squeak is eToys and the Squeakland distribution is the primary team supporting eToys. Not that your question isn't OK here, but you may find more experts there.
I don't know if loading/saving morphs is supported by anyone in the base distribution.
On Sun, Jan 18, 2009 at 10:34 AM, Mark Carter mcturra2000@yahoo.co.ukwrote:
I'm new to smalltalk and squeak - and I must say, it seems capable of doing some pretty amazing stuff.
I started playing with morphs today. I created a Stack (which I called BlogStack), which has a TextBody (actually a scrolling text morph) and a button.
The button activates the following script when I mouseUp on the button:
printBody | | TextBody setCharacters: 'Enter text here' .
^ self
OK, printBody is a bad name, but let's not worry about that. The basic idea is that you press the button, and it replaces the TextBody text with 'Enter text here'. So far, everything works as I expect.
Now, I saved my stack morph from one image, and I wanted to see if I could load it in another. It loaded OK, but when I pressed my button, it complained:
'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 18 January 2009 at 4:19:06 pm'! !Object methodsFor: 'error handling' stamp: 'md 2/22/2006 21:21'! doesNotUnderstand: aMessage "Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector)." "Testing: (3 activeProcess)" MessageNotUnderstood new message: aMessage; receiver: self; signal. ^ aMessage sentTo: self. ! !
I am using Squeak 3.9 update #7067 for both the imported and exported morph.
Curiously, if I open up the viewer on TextBody, I can toggle through most of its categories (basic, scripts, and so on), but it throws an exception if I try to go to 'colour & border' or 'text'. What's going on? Is it a bug?
Should I expect morphs to work across images? What about if I upgrade squeak - what's the chance that I'll still be able to load my morphs?
Also, is there any way that I can create a class, or gain access to, BlogStack, say by doing something like: b := BlogStack . Would you advocate actually creating GUIs programmatically? It seems a safer bet, although rather more tedious.
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
On 19.01.2009, at 01:34, Mark Carter wrote:
I'm new to smalltalk and squeak - and I must say, it seems capable of doing some pretty amazing stuff.
It is. Welcome :)
I started playing with morphs today.
It seems as if you played with Etoys, which is an authoring environment aimed at elementary-school children written on top of Smalltalk. The boundaries between Etoys and the underlying system are not rigid, but typically one works either in the one or the other.
I created a Stack (which I called BlogStack), which has a TextBody (actually a scrolling text morph) and a button.
The Stack-related Morphs are experimental (and the experiment is long over). In the proper Etoys image they are not even shown.
I just redid your example in that image using a Playfield as holder for two buttons and a string. Storing the playfield as morph and loading it back worked fine (although the "save in file" menu is considered advanced usage and hence hidden by default). See attachment.
- Bert -
----- Original Message ----
From: Bert Freudenberg bert@freudenbergs.de
I'm new to smalltalk and squeak - and I must say, it seems capable of doing some pretty amazing stuff.
It is. Welcome :)
Whilst scanning through the web, I saw a screenshot where some guy was playing with sound waves, and stuff was hooked up together ... in Squeak. I was impressed. One can imagine that smalltalk has potential to exceed much of what has been accomplished using current windowing environments. And yet, and yet.
It seems as if you played with Etoys, which is an authoring environment aimed at elementary-school children written on top of Smalltalk.
Oh! Did I? OK. I'd rather stay away from the kid stuff, and do things the bigboy way.
I just redid your example in that image using a Playfield as holder for two buttons and a string.
Thanks ... but alas, I couldn't successfully load it into my image :( Then some "other things happened", and now Squeak is acting all peculiar.
Is it rare for people to create morphs anyway, or is it something that people like doing all the time?
One thing that's puzzling me somewhat is that if I take something like a RectangleMorph, it has both a class definition, and a widget that I can drag onto my desktop. If I create my own morph graphically, then it has no class definition associated with it. I'm confused: if I set out to define a class, then how comes I don't have to specify the sub-components programmatically, and conversely, if I create my own morph visually, then how does it get a class?
I have looked around for tutorials on creating morphs, but I don't seem to find any simple examples where it says "look, this is the proper way you design UI elements".
Most of the cool tools in Squeak weren't built interactively, but with code.
I'm no morphic expert, but I'd start with Squeak By Example. The first example builds a game in morphic. Chapter 11 gives more detail on composing morphs with code.
Chris Muller just published a new version of is naked-objects framework Maui and that is built on Morphic. He included a 50-page PDF linked off the project page on the wiki: http://wiki.squeak.org/squeak/3836.
For building windows and tools (like the built-in tools), take a look at ToolBuilder and OmniBrowser.
For building sound waves and stuff, look at SpectrumAnalyzerMorph.
On Mon, Jan 19, 2009 at 6:57 AM, Mark Carter mcturra2000@yahoo.co.ukwrote:
----- Original Message ----
From: Bert Freudenberg bert@freudenbergs.de
I'm new to smalltalk and squeak - and I must say, it seems capable of
doing some pretty amazing stuff.
It is. Welcome :)
Whilst scanning through the web, I saw a screenshot where some guy was playing with sound waves, and stuff was hooked up together ... in Squeak. I was impressed. One can imagine that smalltalk has potential to exceed much of what has been accomplished using current windowing environments. And yet, and yet.
It seems as if you played with Etoys, which is an authoring environment
aimed at
elementary-school children written on top of Smalltalk.
Oh! Did I? OK. I'd rather stay away from the kid stuff, and do things the bigboy way.
I just redid your example in that image using a Playfield as holder for
two
buttons and a string.
Thanks ... but alas, I couldn't successfully load it into my image :( Then some "other things happened", and now Squeak is acting all peculiar.
Is it rare for people to create morphs anyway, or is it something that people like doing all the time?
One thing that's puzzling me somewhat is that if I take something like a RectangleMorph, it has both a class definition, and a widget that I can drag onto my desktop. If I create my own morph graphically, then it has no class definition associated with it. I'm confused: if I set out to define a class, then how comes I don't have to specify the sub-components programmatically, and conversely, if I create my own morph visually, then how does it get a class?
I have looked around for tutorials on creating morphs, but I don't seem to find any simple examples where it says "look, this is the proper way you design UI elements".
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
On Monday 19 Jan 2009 6:27:55 pm Mark Carter wrote:
Is it rare for people to create morphs anyway, or is it something that people like doing all the time?
It depends on how lazy a programmer is :-). The existing collection of Morph is quite extensive, so you could get by most of the time by making small extensions to an existing morph class.
One thing that's puzzling me somewhat is that if I take something like a RectangleMorph, it has both a class definition, and a widget that I can drag onto my desktop. If I create my own morph graphically, then it has no class definition associated with it. I'm confused: if I set out to define a class, then how comes I don't have to specify the sub-components programmatically, and conversely, if I create my own morph visually, then how does it get a class?
It has to do with Morph and Etoys. Etoy is a "Player" associated with a morph that handles a vocabulary of visual protocols (e.g. tiles for attributes and commands) for programming. The widget that you dragged is an instance of RectangleMorph with a nil player. If you attempt to open its viewer (eye icon), it is automatically associated with an instance of Player class and is called an Etoy. You can now program its behavior visually in addition to textual code. This is all a gross simplification of what happens under the hood.
I have looked around for tutorials on creating morphs, but I don't seem to find any simple examples where it says "look, this is the proper way you design UI elements".
A good starter article for Morphic is http://stephane.ducasse.free.fr/FreeBooks/CollectiveNBlueBook/morphic.final....
HTH .. Subbu
beginners@lists.squeakfoundation.org