Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How do I move a morph from one project to another?
Last updated at 5:16 am UTC on 29 December 2021
Bob Arning
Mon, Apr 30, 2018 at 7:37 PM
To: squeak-dev@lists.squeakfoundation.org

1. Use shared flaps

Drop the morph into a shared flap and take it out on the other project

2. Add the morph to the world of another project with code

Open an explorer on the morph and then
 (Project named: 'whatever') world addMorph: self


3. Move a SystemWindow object


Tony Garnock-Jones
Mon, Apr 30, 2018 at 8:14 PM
Reply-To: The general-purpose Squeak developers list

How to add a menu entry to send a SystemWindow to another project

4 "Send to project ..." implementation in the muO project


Stéphane Rollandin
Tue, May 1, 2018 at 3:10 PM
To: squeak-dev@lists.squeakfoundation.org

Is there a magic menu item somewhere that I can send a morph to a specific project?


I have that in my muO images (such as the available at http://www.zogotounga.net/comp/squeak/muo/muO335.zip), it is an item from the red halo handle, "send to project..."

The implementation is

Morph>>sendToAnotherProject

        | target |
       
        target := Project queryProject ifNil: [^ self].
        target world addMorph: self



Project class>>queryProject

        | selection nBack prev |
       
        selection := (Project buildJumpToMenu: CustomMenu new) startUpLeftFlush.

        selection ifNil: [^ nil].
        (selection beginsWith: '%back') ifTrue:
                [nBack := (selection copyFrom: 6 to: selection size) asNumber.
                prev := CurrentProject previousProject.
                1 to: nBack-1 do:
                        [:i | prev ifNotNil: [prev := prev previousProject]].
                prev ifNotNil: [^ prev]].
        selection = #parent ifTrue:
                [^ CurrentProject parent].
        ^ Project namedWithDepth: selection.



Project class>>buildJumpToMenu: menu

        | listed i  toAdd |
        listed := OrderedCollection with: CurrentProject.
        i := 0.

        CurrentProject isTopProject ifFalse:
                [self   addItem: CurrentProject parent name , ' (parent)'
                                toMenu: menu
                                selection: #parent
                                project: CurrentProject parent.
                  menu addLine].

        (Preferences alphabeticalProjectMenu
                        ifTrue:
                                [Project allNamesAndProjects]
                        ifFalse:
                                [Project hierarchyOfNamesAndProjects]) do:

                [:aPair |
                        toAdd := aPair last isCurrentProject
                                ifTrue:
                                  [aPair first, ' (current)']
                                ifFalse:
                                  [aPair first].
                        self    addItem: toAdd
                                toMenu: menu
                                selection: aPair first
                                project: aPair last].
        ^ menu





5 Use a specialized morph

DropZoneMorph allows to send a morph to another project.

See also EToyProjectHistoryMorph.

6 Summary / Outlook

Bob Arning
Wed, May 2, 2018 at 10:25 AM
Reply-To: The general-purpose Squeak developers list
To: squeak-dev@lists.squeakfoundation.org


(...) So far we have:
  • sending morphs from one project to another
  • perhaps selecting the destination based on some morph property
  • perhaps the receiving project could refuse to accept the morph
  • make the morph frontmost in the receiving project's world, unless that project doesn't even have a world

And other questions occur:

  • why limit this to morphs? Why not send arbitrary data from project to project?
  • is a morph a ui representation of some separate domain object? Where does the domain object live?
  • what if the sending project is in "grid-view mode" and the receiving project is in "list-view mode"? Does sending a specific morph make any sense?
  • why assume the morph would be installed in the world at the other end?
  • do we assume the morph must be deleted from the sending world? Dropping a morph on a ProjectViewMorph will send a copy to the other project.

This all started with a simple problem that had a simple answer. (...)
DTSTTCPW!