Morph Window -> Class? (was: [Newbies] error loading .pr file)

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Sun Apr 1 20:04:28 UTC 2007




El 4/1/07 3:16 PM, "Andrew Dabrowski" <dabrowsa at indiana.edu> escribió:

> Thanks for your reply to my last message.  Now I have a follow-up
> question.
> 
> If I want to save my project as a .cs file, then I will have to convert
> my gui window (just a systemWindow with some buttons and textMorphs)
> into a proper class that shows up in the browser, correct?  That is, my
> window was not coded, but put together interactively by dragging
> supplies out and using the viewer to attach scripts.  Is there a way to
> convert the final product into a code format that can be exported in the
> .cs file?
> 
> In VisualWorks (which I am also looking at but have not worked with at
> all) there seems to be a way to do this: the InstallOnClass utility.  Is
> there something comparable in Squeak?

Exist a kind of Morph to code, what sometimes lets you export code only.

Drag and drop the attached morph into your Squeak.

Open a Transcript whit World menu or via flaps.

Via halo, open a Inspector of the morph.
In lower pane type :
Transcript show: self constructorString  "for seeing what is the code of the
morph."

You should give:
(((AlignmentMorph newBounds: (0 at 822 corner: 597 at 848) color: Color
transparent) setBorderWidth: 1 borderColor: Color black)
    addAllMorphs: ((Array new: 7)
    at: 1 put: (((SimpleButtonMorph newBounds: (2 at 824 corner: 76 at 846) color:
Color green) setBorderWidth: 1 borderColor: (Color r: 0.36 g: 0.719 b:
0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (6 at 828 corner: 73 at 843) color: Color
black) contents: 'workspace')));
    at: 2 put: (((SimpleButtonMorph newBounds: (76 at 824 corner: 146 at 846)
color: Color yellow) setBorderWidth: 1 borderColor: (Color r: 0.36 g: 0.719
b: 0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (80 at 828 corner: 143 at 843) color: Color
black) contents: 'transcript')));
    at: 3 put: (((SimpleButtonMorph newBounds: (146 at 824 corner: 205 at 846)
color: Color orange) setBorderWidth: 1 borderColor: (Color r: 0.36 g: 0.719
b: 0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (149 at 828 corner: 201 at 843) color:
Color black) contents: 'browser')));
    at: 4 put: (((SimpleButtonMorph newBounds: (205 at 824 corner: 332 at 846)
color: Color red) setBorderWidth: 1 borderColor: (Color r: 0.36 g: 0.719 b:
0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (208 at 828 corner: 328 at 843) color:
Color black) contents: 'dual change sorter')));
    at: 5 put: (((SimpleButtonMorph newBounds: (332 at 824 corner: 385 at 846)
color: (Color r: 0.645 g: 0.0 b: 0.968)) setBorderWidth: 1 borderColor:
(Color r: 0.36 g: 0.719 b: 0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (335 at 828 corner: 381 at 843) color:
Color black) contents: 'file list')));
    at: 6 put: (((SimpleButtonMorph newBounds: (385 at 824 corner: 490 at 846)
color: (Color r: 0.323 g: 1.0 b: 0.613)) setBorderWidth: 1 borderColor:
(Color r: 0.36 g: 0.719 b: 0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (388 at 828 corner: 486 at 843) color:
Color black) contents: 'message names')));
    at: 7 put: (((SimpleButtonMorph newBounds: (490 at 824 corner: 595 at 846)
color: (Color r: 0.323 g: 1.0 b: 0.613)) setBorderWidth: 1 borderColor:
(Color r: 0.36 g: 0.719 b: 0.541))
        addAllMorphs: (Array
        with: ((StringMorph newBounds: (493 at 828 corner: 591 at 843) color:
Color black) contents: 'archive viewer')));
    yourself))

Before you ask, the transcript button need be "reinitialized" when go to new
image.
For doing that, via halo select the button (you need two clicks, one for the
AlignmentMorph  and the second for the button, this way you could see Morphs
inside Morphs and act via Inspector)
In the code pane of Inspector type select target as you see in pict.
Type again Transcript and do alt s or command s (for aceppting the change).
Presto, now you have the button working .

I hope you know now what could export only a morph and not a complete .pr
....

Next question ? :=)

Cheers

Edgar



-------------- next part --------------
A non-text attachment was scrubbed...
Name: Comandos.morph
Type: application/octet-stream
Size: 7678 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070401/d37f3068/Comandos-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 1.png
Type: application/octet-stream
Size: 13134 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070401/d37f3068/Picture1-0001.obj


More information about the Beginners mailing list