Morph import corrupted

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Morph import corrupted

Mark Carter-3
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

Herbert König
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  

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

David Mitchell-10
In reply to this post by Mark Carter-3
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 <[hidden email]> wrote:
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

Jerome Peace
In reply to this post by Mark Carter-3
[Newbies] Morph import corrupted


Hi Mark, Hi David,

This doesn't look like a squeak bug.

Mark, squeak and morphic can do some pretty remarkable things. You need to approach this as a foreigner in a new country. The best way to get the natives to do what you want is to learn the language they use to do it. (By natives I am talking about the objects in squeak, morphs included and in particular.)
The alternative is to invent new language as you go along. Which is the fun part. What you ran into is that saving a morph does not  save the extra language you made. So squeak was noisily trying to tell you it no longer understood what you thought you were saying.
The cure can be twofold. When I am developing in squeak I end my sessions by saving the project to disk and when asked say yes to saving the change set associated with the project. This will save all the morphs I have in the project and all the new and modified language that I created.
This will load into any image that is close to what you started with.
The other ways to save the language is to go to the class, or method you want to save, get a menu for it and request 'file out'. That will save as little as one method. By selecting the category the method is in you can save a bunch of methods. By selecting the class all of the methods connected with that class.
The other thing you can do is save all of the methods associated with your project. The tool to do that is the dual change sorter. There is a single change sorter but the dual sorter has the very useful feature of allowing you to copy or move the methods of interest in and out of any change set.
Again the file out menu command will save everything in the change set. This is usually what you want to bring to a new image. It is exactly what code you saved when you saved the project. The advantage of saving the change set separately is that it will travel better into foreign lands than the whole project.
The other thing the change set allows you to do is to write a preamble. I use this all the time to comment the code. So the forgetful me who reads it a month from now will remember.
The second fold of the cure is to be humble and to learn the native language from the natives. This is not as easy as going of and making your own. It is very important. Squeak will do thing in ways that will surprise you. And if you go about finding the reusable code first you will build up a useful set of ideas. You will be able to talk to the natives (objects) like one of their own. :-)

A good place to start is the World menu Objects tool. These contain different morphic widgets.
Grab one out. Halo click on it and select the monkey wrench handle. This gives a list of interesting ways to explore the morph. The object explorer is one of the most useful for looking at the morph itself. An object inspector gives a better ability to modify the object on the fly.
The other useful thing to do is ask to browse the morph class. This gets a code browser that allows you to see all the methods defined in the class.

I could go on but I'd better stop before I write a small book in the email.

>From your note I suggest you look in the collection classes. In particular, OrderedCollection can act as a stack for most purposes #addLast and #removeLast replacing push and pop. The other thing to look at is any morph that looks like it already does something close to what you want. That's usually a good starting point for discovering how to do things in the native tongue.

Hth,

Yours in curiosity and service, --Jerome Peace

======Previously:
Dave and Mark wrote:

David Mitchell david.mitchell at gmail.com
Sun Jan 18 18:42:24 UTC 2009
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 at yahoo.co.uk>wrote:

> 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
>
Where did you define #printBody? In what class is it known. What specifically did you do to set up the mouse up action?

I may not be getting something. Right now I do not know how to recreate what you did.

> 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:

>
> 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?
>
Ok. That seems odd. It isn't possible to say whats happening w/o more informaitin.
You need to explain in detail how to recreate the problem. My guess is that it is because TextBody is not a normal morph and is using language you have not taught the current image. Of course it could always be a bug for another reason. Hard to know.


> 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?

Reasonable. Assuming you load the special language for your morph into the image. See above.

Sometimes it will be necessary to update or modify things. Making things in squeak is a little like making sandcastles on a beach.

You can always choose to selectively upgrade the image you have to remain compatible.

The release process for this branch of squeak is not steady or too predictably. We rely on willing members of the community. It is a lot of work. The releasers catch all the flax of those who wish things had been done differently. The result is a high turn over amoung release teams and sharp shifts in goals and focus.

The excitement is that squeak is a good place to innovate. The Seaside folks know that. And if you are willing to roll up you sleaves squeak can be made to do amazing things in short periods of time. What is is not good at is giving highly polished results.

> Also, is there any way that I can create a class, or gain access to,
> BlogStack, say by doing something like:
> b := BlogStack .

If you do that in a workspace it should work. If BlogStock is the name of a class you probably need to do something like
b := BlogStock new. That creates and instance of the class Blogstock.
then sending messages to b are the same as sending them to the instance.
Browse BlogStock and look at the creation method on its class side.
Look also at the methods it inherits from its superclasses.

> Would you advocate actually creating GUIs programmatically? It seems a
> safer bet, although rather more tedious.
>
Depends on what you need to do. I have found the Etoys and scripting can only go so far. When you get to that wall its time to look at the smalltalk programming environment. Which is what we have been discussing here.

>
>




     
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

Bert Freudenberg
In reply to this post by Mark Carter-3
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 -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Playfield.morph (34K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

Mark Carter-3




----- Original Message ----
> From: Bert Freudenberg <[hidden email]>

>> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

David Mitchell-10
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 <[hidden email]> wrote:




----- Original Message ----
> From: Bert Freudenberg <[hidden email]>

>> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Morph import corrupted

K. K. Subramaniam
In reply to this post by Mark Carter-3
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.pdf

HTH .. Subbu
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners