2014-12-14 23:52 GMT+01:00 Tommaso Dal Sasso <tommaso.dalsasso@gmail.com>:

On 14/12/14 22:59, Nicolai Hess wrote:
2014-12-14 22:14 GMT+01:00 Tommaso Dal Sasso <tommaso.dalsasso@gmail.com <mailto:tommaso.dalsasso@gmail.com>>:


�� �� On 14/12/14 21:44, stepharo wrote:

�� �� �� �� I got the same problem when I put an Halt pressing on any
�� �� �� �� button leads to the opening of the same UI.
�� �� �� �� I wonder if there is not an interaction between spec and the
�� �� �� �� UI modal opening.
�� �� �� �� I read the code of ImageModel and I did not find anything special.

�� �� Yes, I thought as well that could be something regarding modal UI,
�� �� but I have so little knowledge of Spec and the way it interacts
�� �� with Morphic that I could not tell more.
�� �� OK, it works correctly if I put the dialog code inside a block and
�� �� i fork it, so probably the modal window blocks the way the action
�� �� of the icon is triggered.



No, it is not related to spec, just the way the imagemodel adapter uses morphics click event for the action dispatching.
You can simulate the same (buggy) behavior on pure morphic:

|m|
m:= Morph new.
m on:#click send:#value to:[m confirm:'Really?'].
m openInWorld.


MouseClickEvent processing and modal dialogs don't work.

Sorry, I wrote it badly. Of course it is an issue of Morphic, thanks for your clarification.
So, is it a bug or it just works that way and it is supposed to do so by architectural design?

I think it is a bug on morphics mouse click handling.

The UI-element for a ButtonModel is a PluggableButtonMorph, it already has support for handling
"clicks", but it only acts on mouse up /(or mouse down)

An ImageMorph don't have this by default, so the ImageModel adapter installs a eventhandler with
on:event do:action and the creator of Spec choosed #mouseUp for the mouse event to act on.


Nicolai
��

The interesting thing is that with a button it works.

Tommaso





�� �� I'll try to investigate more.
�� �� Thanks for the feedback,

�� �� Tommaso


�� �� �� �� Stef.
�� �� �� �� Le 14/12/14 20:26, Tommaso Dal Sasso a ��crit :

�� �� �� �� �� �� I have a weird behavior building an interface with Spec.

�� �� �� �� �� �� I have a window built with Spec, and I want to add a
�� �� �� �� �� �� button that shows a dialog with some text.
�� �� �� �� �� �� To display the dialog I use the following line:

�� �� �� �� �� �� UIManager default longMessage: 'a text message' title:
�� �� �� �� �� �� 'some title'.

�� �� �� �� �� �� And I hooked this code to a widget through the #action:
�� �� �� �� �� �� method.
�� �� �� �� �� �� The problem is: If I use a ButtonModel, the code behaves
�� �� �� �� �� �� correctly showing the dialog.
�� �� �� �� �� �� If I use an instance of the class ImageModel to display an
�� �� �� �� �� �� icon, the dialog is displayed but the interface "hangs",
�� �� �� �� �� �� in the sense that the "ok" button won't close the dialog
�� �� �� �� �� �� and every click would spawn a new dialog.

�� �� �� �� �� �� I would like to use an icon because it integrates better
�� �� �� �� �� �� with the interface.
�� �� �� �� �� �� Do you know if it is a bug or if I am doing something wrong?

�� �� �� �� �� �� Thanks,
�� �� �� �� �� �� Tommaso


�� �� �� �� �� �� P.s.: Steps to reproduce

�� �� �� �� �� �� If you need a working example you can inspect the code on
�� �� �� �� �� �� the bleeding edge version of ShoreLine Reporter by
�� �� �� �� �� �� following these instructions:
�� �� �� �� �� �� 1. download a recent Pharo 4 image;
�� �� �� �� �� �� 2. open a workspace and run:
�� �� �� �� �� �� ConfigurationOfShoreLineReporter loadBleedingEdge
�� �� �� �� �� �� 3. trigger an exception (for example by running 3/0 in a
�� �� �� �� �� �� workspace).
�� �� �� �� �� �� 4. click 'Report'
�� �� �� �� �� �� 5. click the '?' button on the right side of the window.