[Cuis-dev] Scroll event and focus

Phil B pbpublist at gmail.com
Tue Apr 28 06:58:05 PDT 2020


Hilaire,

You want to make sure that your morph returns true both to #handlesKeyboard
and #handlesMouseScroll:.  You will also probably want to implement
#mouseEnter: and do something like this inside it:

Preferences focusFollowsMouse ifTrue: [
    event hand newKeyboardFocus: self.
    self redrawNeeded ].

It's a bit hacky because mouse scroll events are pseudo mouse events (they
actually come from the VM as keyboard events currently) which will follow
mouse focus... but only if you have keyboard focus!  When the VM
consistently (i.e. across all platforms) provides them as raw mouse events
we'll be able to clean this up.

Thanks,
Phil

On Tue, Apr 28, 2020 at 7:16 AM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hello,
>
> I have this strange situation in the DrGeo window where scroll events are
> not always caught by the underneath canvas.
>
> The drgeo windows is composed with several submorphs: wheels and a sort of
> PasteUpMorph as the canvas.
>
> In this canvas I can handle events as mouse down, hover, over and scroll.
> They are handled just fine. However when the mouse cursor moves away from
> the window then  comes back, the scroll events are not caught anymore by
> the canvas. Somehow if I click on the window title, scroll event handling
> may come back, or not, it is a bit random.
>
> The issue seems to be related to mouse focus, not sure.
>
> Any idea?
>
> Hilaire
>
> --
> GNU Dr. Geohttp://drgeo.eu
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200428/4ef81853/attachment.htm>


More information about the Cuis-dev mailing list