example custom mouse events

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

example custom mouse events

Ben Coman

It took a bit of hunting around to discover how to use the custom hooks
for mouse event, and I needed to make some examples to prove how it
worked.  I thought others might find this interesting.  It just outputs
to Transcript for each of the following events.  Check the class
comments for usage.

* handlesMouseDown - mouseDown, mouseUp, mouseMove, startDrag, click,
doubleClick, doubleClickTimeout.
* handlesMouseStillDown - mouseStillDown.
* handlesMouseOver - mouseEnter, mouseLeave.
* handlesMouseOverDragging - mouseEnterDragging, mouseLeaveDragging.

Anyone know anything more to add?

cheers -ben

ExampleMouseEvents-BenComan.1.mcz (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: example custom mouse events

wernerk
mouseOver, i think
werner

On 08/19/2014 10:17 AM, Ben Coman wrote:

>
> It took a bit of hunting around to discover how to use the custom hooks
> for mouse event, and I needed to make some examples to prove how it
> worked.  I thought others might find this interesting.  It just outputs
> to Transcript for each of the following events.  Check the class
> comments for usage.
>
> * handlesMouseDown - mouseDown, mouseUp, mouseMove, startDrag, click,
> doubleClick, doubleClickTimeout.
> * handlesMouseStillDown - mouseStillDown.
> * handlesMouseOver - mouseEnter, mouseLeave.
> * handlesMouseOverDragging - mouseEnterDragging, mouseLeaveDragging.
>
> Anyone know anything more to add?
>
> cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: example custom mouse events

Ben Coman
Werner Kassens wrote:

> mouseOver, i think
> werner
>
> On 08/19/2014 10:17 AM, Ben Coman wrote:
>>
>> It took a bit of hunting around to discover how to use the custom hooks
>> for mouse event, and I needed to make some examples to prove how it
>> worked.  I thought others might find this interesting.  It just outputs
>> to Transcript for each of the following events.  Check the class
>> comments for usage.
>>
>> * handlesMouseDown - mouseDown, mouseUp, mouseMove, startDrag, click,
>> doubleClick, doubleClickTimeout.
>> * handlesMouseStillDown - mouseStillDown.
>> * handlesMouseOver - mouseEnter, mouseLeave.
>> * handlesMouseOverDragging - mouseEnterDragging, mouseLeaveDragging.
>>
>> Anyone know anything more to add?
>>
>> cheers -ben
>
>

Thanks for your feedback Werner.  That prompted me to go looking for
something more to learn.  It seems mouseOver is generally used more low
level as part of the infrastructure rather than as a user handler.  
Morph does not define the method 'mouseOver'.  Its only defined on
PanelMorph.

The symbol #mouseOver is used in a few places:
* PanelMorph seems the only user of the class MouseOverEventHandler
which references #mouseOver in its 'mouseOver:fromMorph:' method
* MultistateLabelMorph (which has no references in the Pharo Image)
references #mouseOver as a Dictionary key for colours for its
'interactionState'
* MorphicEvent>>isMouseOver references #mouseOver. This has three senders
   * DockingBarMorph>>#handleFocusEvent:   checks isMouseOver to stop
processing the event.
   * MenuMorph>>handleFocusEvent:   checks isMouseOver to stop
processing the event.
   * HandMorph>>handleEvent:   checks isMOuseOver to 'sendMouseEvent'
* MouseEvent>>sentTo: for type==#mouseOver sends message
'handleMouseOver:'   , which is already covered in the previously
provided Examples.

I've added an additional example showing mouseOver usage for
PanelMorph.  Do you have any other usage examples for mouseOver?

cheers -ben



Reply | Threaded
Open this post in threaded view
|

Re: example custom mouse events

wernerk
Hi Ben,
yes, i was a bit too fast with my reply and sent it before thinking
<stupid grin>, its a lowlevel thing and i mentioned it because i was
thinking at that moment whether i can simplify some of my code that is
using mouseEnter & mouseLeave by using some lowlevel methods. thanks for
considering it anyway.
werner