Who sends what?

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

Who sends what?

Jerome Chan
How do I find out which messages are sent from which presenters/view?
Is there something detailing this?

For example, #selectionChanged is sent when the selection is changed in
a presenter.

What message gets sent from the view to the presenter when a key is
pressed within a view?


Reply | Threaded
Open this post in threaded view
|

Re: Who sends what?

Ian Bartholomew-17
Jerome,

> How do I find out which messages are sent from which presenters/view?
> Is there something detailing this?

In a Class or System browser you select a class and then the menu option
"Class/Browse/Published events".  You can also search for definitions of the
#publishedEventsOfInstances method in the image.  There is no specific
documentation for what the events do but, in most cases, the name used it
reasonably explanatory.

The confusing thing is that events are often shown as being triggered by the
View class and it's subclasses but are actually triggered through the
associated Presenter.

> What message gets sent from the view to the presenter when a key is
> pressed within a view?

You can use

#onKeyTyped:
#onKeyPressed:
#onKeyReleased:

The first is originated by the Windows wmChar event and only occurs for
certain Views. The others are generated by the matching Windows wm* messages
and are, I think, available in all Views.  The event evaluation arrives at
the View>>wm* method, are passed to an Interactor, to a Presenter and then
back to a View (all via #on*  methods). View then triggers the appropriate
event off of the Presenter.

To clarify the above point. If you open a Shell and look for #keyPressed:
(note the colon) events you would think you would need

s := Shell show.
s view when: #keyPressed: send: #halt to: nil

If you try it then nothing happens. You have to look for events triggered by
the View but directed off of the Shell (Presenter)

s := Shell show.
s when: #keyPressed: send: #halt to: nil

Now, whenever the Shell has focus and a key is pressed you should get a
walkback.

Any help?

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: Who sends what?

Jerome Chan
It does help! Thanks again!