[Newbies] Morphs that never gain mouse focus?

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Sep 8 18:17:25 UTC 2019

For the case someone else was wondering about this, I found a solution:

rejectsEvent: evt
^ (super rejectsEvent: evt) or: [evt isMouseOver]

Works for me.

Von: Beginners <beginners-bounces at lists.squeakfoundation.org> im Auftrag von Thiede, Christoph
Gesendet: Samstag, 3. August 2019 19:32:22
An: beginners at lists.squeakfoundation.org
Betreff: [Newbies] Morphs that never gain mouse focus?


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
Beginners mailing list
Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190908/9f8dd2f7/attachment.html>

More information about the Beginners mailing list