Morphs that never gain mouse focus?

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

Morphs that never gain mouse focus?

Christoph Thiede
Hi,

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
<https://github.com/hpi-swa-teaching/SpreadSheetTool/tree/master/packages/SpreadSheetTool-Core.package/SSHybridTextMorph.class>  
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!

Best,
Christoph



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Morphs that never gain mouse focus?

Christoph Thiede

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 <[hidden email]> im Auftrag von Thiede, Christoph
Gesendet: Samstag, 3. August 2019 19:32:22
An: [hidden email]
Betreff: [Newbies] Morphs that never gain mouse focus?
 
Hi,

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
<https://github.com/hpi-swa-teaching/SpreadSheetTool/tree/master/packages/SpreadSheetTool-Core.package/SSHybridTextMorph.class
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!

Best,
Christoph



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Carpe Squeak!