[squeak-dev] Form asSomethingOrOther

Colin Putney cputney at wiresong.ca
Thu Aug 27 06:18:19 UTC 2009


On 26-Aug-09, at 10:22 PM, Ronald Spengler wrote:

> I have a Form (for use as a button) that I would like to serialize  
> in a way that allows me to keep it as text in a method. I would like  
> to do this the simplest way possible, optimizing for speed (not  
> space.) Ideally it would look as much like this as possible:
>
> Foo>>someIcon
>     ^ #( ... ) asForm
>
> What's the best way to do this?

Create your form, then send #storeString to it. It will answer a  
Smalltalk expression that recreates the form. Then just answer that  
expression from your #someIcon method. OmniBrowser has a few examples  
of this in the class OBMorphicIcons.

Colin



More information about the Squeak-dev mailing list