How to send messages to an object.

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

How to send messages to an object.

nacho
Hi,
Suppose I do:
Morph new openInWorld

and then:
EllipseMorph new openInWorld

without referencing them to a variable.
How do I access those objects?
Since the only thing I know is that is a "a Morph(428605440)" and a "an EllipseMorph(448004096)"
If I want to Morph(428605440) addMorph: EllipseMorph(448004096)
How do I achieve this?
Because they are both object living in the system but I can not reference them.....
Thanks in advance
Nacho

Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

hernanmd


2015-02-07 17:46 GMT-03:00 nacho <[hidden email]>:
Hi,
Suppose I do:
Morph new openInWorld

and then:
EllipseMorph new openInWorld

without referencing them to a variable.
How do I access those objects?

Morph new openInWorld inspect.
Morph new openInWorld explore.

or

Morph new openInWorld
right-click inspect, explore or debug

in the opened window, you can use the lower text pane to send messages to the object.


 
Since the only thing I know is that is a "a Morph(428605440)" and a "an
EllipseMorph(448004096)"
If I want to Morph(428605440) addMorph: EllipseMorph(448004096)
How do I achieve this?
Because they are both object living in the system but I can not reference
them.....
Thanks in advance
Nacho





-----
Nacho
Smalltalker apprentice.
Buenos Aires, Argentina.
--
View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Sean P. DeNigris
Administrator
In reply to this post by nacho
nacho wrote
How do I achieve this?
Two options:
1. (Unscalable hack) Identify them by a unique feature of their description e.g. "(World submorphs detect: [ :e | e color = Color blue ]) addMorph: (World submorphs detect: [ :e | e isKindOf: EllipseMorph ])"
2. Bring back a feature like that of MathMorphs [1, pg. 9], which had a revolutionary interface where, for each argument to a message, you drag an object token (a Morph) onto the message receiver, and then select the message via a context menu.

I've been playing around with this and other ideas in my LivingCode project. In the screencast at https://www.youtube.com/watch?v=ejQh6wkII2Y, you can see a rough proof of concept - creating two tokens for your two Morphs, and then supplying the ellipse's token as an argument for the other Morph.

[1] http://coweb.cc.gatech.edu:8888/squeakbook/uploads/tex-mathmorphs.pdf
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

nacho
@Hernan
Sending a message to an object using the inspector allows me to do:
self addMoprh: EllipseMorph new.

But what I want is to add a morph to another morph that is already instantiated.
I want to reference the object that is somewhere in the memory an be able to manipulated even if I have not assigned it a reference | aMorph |.

@Sean
As I told you, your Self World is impressive. I see how easy is to do what I want in that Self World.
I will take a look at MathMorphs, I think I've tried to make it work in Pharo but had no success.

Thanks both of your for your answers
Best
Nacho
Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

hernanmd


2015-02-07 19:28 GMT-03:00 nacho <[hidden email]>:
@Hernan
Sending a message to an object using the inspector allows me to do:
self addMoprh: EllipseMorph new.

But what I want is to add a morph to another morph that is already
instantiated.

Use the halos.
In Windows is Alt+Shift+Left click over your morph.
Then select the Menu halo (red) -> debug... -> explore morph

Hernán


Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Sean P. DeNigris
Administrator
hernanmd wrote
Use the halos... select the Menu halo (red) -> debug... -> explore morph
Yes, you can bring up an inspector/explorer on each morph, but the hiccup is how do you connect them i.e. send one as an argument to the other?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

hernanmd
I see! something like?

self addMorphCentered: (EllipseMorph allInstances detect: [ : i | i name = 'an EllipseMorph(485752832)' ])


2015-02-07 19:39 GMT-03:00 Sean P. DeNigris <[hidden email]>:
hernanmd wrote
> Use the halos... select the Menu halo (red) -> debug... -> explore morph

Yes, you can bring up an inspector/explorer on each morph, but the hiccup is
how do you connect them i.e. send one as an argument to the other?



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394p4804413.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Damien Pollet-2
What if inspectors and workspaces were able to copy-paste object references?
When pasting, a new binding would be made with some automatic name.

I always wondered why this was not part of Morphic…

On 7 February 2015 at 23:52, Hernán Morales Durand <[hidden email]> wrote:
I see! something like?

self addMorphCentered: (EllipseMorph allInstances detect: [ : i | i name = 'an EllipseMorph(485752832)' ])


2015-02-07 19:39 GMT-03:00 Sean P. DeNigris <[hidden email]>:

hernanmd wrote
> Use the halos... select the Menu halo (red) -> debug... -> explore morph

Yes, you can bring up an inspector/explorer on each morph, but the hiccup is
how do you connect them i.e. send one as an argument to the other?



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394p4804413.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Tudor Girba-2
Indeed, this is a little feature a proper object-oriented environment should not miss :)

Doru

On Sun, Feb 8, 2015 at 12:02 AM, Damien Pollet <[hidden email]> wrote:
What if inspectors and workspaces were able to copy-paste object references?
When pasting, a new binding would be made with some automatic name.

I always wondered why this was not part of Morphic…

On 7 February 2015 at 23:52, Hernán Morales Durand <[hidden email]> wrote:
I see! something like?

self addMorphCentered: (EllipseMorph allInstances detect: [ : i | i name = 'an EllipseMorph(485752832)' ])


2015-02-07 19:39 GMT-03:00 Sean P. DeNigris <[hidden email]>:

hernanmd wrote
> Use the halos... select the Menu halo (red) -> debug... -> explore morph

Yes, you can bring up an inspector/explorer on each morph, but the hiccup is
how do you connect them i.e. send one as an argument to the other?



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394p4804413.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.






--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Sven Van Caekenberghe-2
Yes, but please don't just limit it to UI things.

I want to be able to 'Copy an object' to an 'Object Clipboard' when I am on 'self' in an Inspector. And I want to be able to 'Paste an object' in a slot of an Inspector, or wherever that makes sense.

I always emulate this with a global, like XXX or ObjectClipboard, but it should be possible to do this without typing.

> On 08 Feb 2015, at 00:13, Tudor Girba <[hidden email]> wrote:
>
> Indeed, this is a little feature a proper object-oriented environment should not miss :)
>
> Doru
>
> On Sun, Feb 8, 2015 at 12:02 AM, Damien Pollet <[hidden email]> wrote:
> What if inspectors and workspaces were able to copy-paste object references?
> When pasting, a new binding would be made with some automatic name.
>
> I always wondered why this was not part of Morphic…
>
> On 7 February 2015 at 23:52, Hernán Morales Durand <[hidden email]> wrote:
> I see! something like?
>
> self addMorphCentered: (EllipseMorph allInstances detect: [ : i | i name = 'an EllipseMorph(485752832)' ])
>
>
> 2015-02-07 19:39 GMT-03:00 Sean P. DeNigris <[hidden email]>:
>
> hernanmd wrote
> > Use the halos... select the Menu halo (red) -> debug... -> explore morph
>
> Yes, you can bring up an inspector/explorer on each morph, but the hiccup is
> how do you connect them i.e. send one as an argument to the other?
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394p4804413.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"


Reply | Threaded
Open this post in threaded view
|

Re: How to send messages to an object.

Ben Coman
If you want to do it as part of your application, maybe** look into sender and implementers of #acceptDroppingMorph:event:
cheers -ben

** I have no great experience with this. Just had a poke around for an answer.

On Sun, Feb 8, 2015 at 7:21 AM, Sven Van Caekenberghe <[hidden email]> wrote:
Yes, but please don't just limit it to UI things.

I want to be able to 'Copy an object' to an 'Object Clipboard' when I am on 'self' in an Inspector. And I want to be able to 'Paste an object' in a slot of an Inspector, or wherever that makes sense.

I always emulate this with a global, like XXX or ObjectClipboard, but it should be possible to do this without typing.

> On 08 Feb 2015, at 00:13, Tudor Girba <[hidden email]> wrote:
>
> Indeed, this is a little feature a proper object-oriented environment should not miss :)
>
> Doru
>
> On Sun, Feb 8, 2015 at 12:02 AM, Damien Pollet <[hidden email]> wrote:
> What if inspectors and workspaces were able to copy-paste object references?
> When pasting, a new binding would be made with some automatic name.
>
> I always wondered why this was not part of Morphic…
>
> On 7 February 2015 at 23:52, Hernán Morales Durand <[hidden email]> wrote:
> I see! something like?
>
> self addMorphCentered: (EllipseMorph allInstances detect: [ : i | i name = 'an EllipseMorph(485752832)' ])
>
>
> 2015-02-07 19:39 GMT-03:00 Sean P. DeNigris <[hidden email]>:
>
> hernanmd wrote
> > Use the halos... select the Menu halo (red) -> debug... -> explore morph
>
> Yes, you can bring up an inspector/explorer on each morph, but the hiccup is
> how do you connect them i.e. send one as an argument to the other?
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/How-to-send-messages-to-an-object-tp4804394p4804413.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"