[Newbies] Morphs that never gain mouse focus?

Christoph Thiede christoph.thiede at student.hpi.uni-potsdam.de
Sat Aug 3 17:32:22 UTC 2019


I'm wondering whether Morphic currently supports any way to hinder a morph
from being ever given mouse focus. There are multiple scenarios where I
could need something like this.

For example. an  Autocompletion menu morph should never gain mouse focus
<https://github.com/MrModder/Autocompletion/issues/31#issue-472835222>  ,
but currently it overrides #handleMouseEnter: and transfers the focus to its
containing morph. The problem with this approach seems to me to be that,
when hovering the menu morph, the MouseOverHandler first sends #mouseLeave:
to the containing text morph -- before the menu morph can decide to forward
the focus event. Ultimately, the focus is consistent, but I do not want
#mouseLeave: to be sent at all, as  some text morphs
may show undesirable behavior when loosing focus.

I am also running another project where I never want a morph to gain mouse
focus from a similar reason. The only Morph in Squeak I remember to never
gain focus is the HaloMorph, what is apparently achieved by an extra-check
in PasteUpMorph>>#filterEvent:for: where the event is ignored in
#tryInvokeHaloFor: before passing it to MouseOverHandler. Manipulating a
PasteUpMorph method does not seem appropriate for a small tool.

tl;dr: Is it possible to forbid a morph to gain focus at the expense of the
current focused morph? If not, would you know any better approach? Or would
this even be a possible feature proposal for squeak/dev? Thanks in advance!


Sent from: http://forum.world.st/Squeak-Beginners-f107673.html

More information about the Beginners mailing list