[Pharo-project] simulating morphic events
Hi, I would like to simulate Morphic events, like mouseUp, but I cannot figure out the complete setup. Here is the code I have so far: | mouseUp morph | morph := self scroller submorphs first. mouseUp := MouseButtonEvent basicNew setType: #mouseUp position: (morph bounds origin + (1@1)) which: 4 buttons: 7 hand: (HandMorph new mouseFocus: morph; yourself) stamp: Time millisecondClockValue. morph handleMouseUp: mouseUp. At this moment it looks like the problem is that the eventHandler in the morph is nil. Can anyone point me into the right direction? Cheers, Doru -- www.tudorgirba.com "Yesterday is a fact. Tomorrow is a possibility. Today is a challenge."
At this moment it looks like the problem is that the eventHandler in the morph is nil. Can anyone point me into the right direction?
Have a look at OBKeyBindingsTest>>modifier:keycode: in OB-Morphic-Tests. Lukas -- Lukas Renggli http://www.lukas-renggli.ch
Interesting, but I am also looking for a mouse event. Anyone has other examples? Doru On 16 Nov 2009, at 13:57, Lukas Renggli wrote:
At this moment it looks like the problem is that the eventHandler in the morph is nil. Can anyone point me into the right direction?
Have a look at OBKeyBindingsTest>>modifier:keycode: in OB-Morphic- Tests.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com "Some battles are better lost than fought."
Your original code seems ok. Try the following via inspecting the PluggableTextMorph of a Workspace, for example (changed to do mouse down...) | mouseDown morph | morph := self scroller submorphs first. mouseDown := MouseButtonEvent basicNew setType: #mouseDown position: (morph bounds origin + (1@1)) which: 4 buttons: 7 hand: (HandMorph new mouseFocus: morph; yourself) stamp: Time millisecondClockValue. morph handleMouseDown: mouseDown. Regards, Gary ----- Original Message ----- From: "Tudor Girba" <tudor.girba@gmail.com> To: <Pharo-project@lists.gforge.inria.fr> Sent: Monday, November 16, 2009 1:21 PM Subject: Re: [Pharo-project] simulating morphic events
Interesting, but I am also looking for a mouse event. Anyone has other examples?
Doru
On 16 Nov 2009, at 13:57, Lukas Renggli wrote:
At this moment it looks like the problem is that the eventHandler in the morph is nil. Can anyone point me into the right direction?
Have a look at OBKeyBindingsTest>>modifier:keycode: in OB-Morphic- Tests.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com
"Some battles are better lost than fought."
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Thanks Gary, Indeed, this raises the local menu. So maybe the morph I am testing has some problems. But, if we are at it, I have a question regarding the mouse buttons. I thought that "which: 4" will raise a left click event (which is what I would like to target), but by running your code I get a menu popping out. What am I missing? Cheers, Doru On 16 Nov 2009, at 14:57, Gary Chambers wrote:
Your original code seems ok.
Try the following via inspecting the PluggableTextMorph of a Workspace, for example (changed to do mouse down...)
| mouseDown morph | morph := self scroller submorphs first. mouseDown := MouseButtonEvent basicNew setType: #mouseDown position: (morph bounds origin + (1@1)) which: 4 buttons: 7 hand: (HandMorph new mouseFocus: morph; yourself) stamp: Time millisecondClockValue. morph handleMouseDown: mouseDown.
Regards, Gary
----- Original Message ----- From: "Tudor Girba" <tudor.girba@gmail.com> To: <Pharo-project@lists.gforge.inria.fr> Sent: Monday, November 16, 2009 1:21 PM Subject: Re: [Pharo-project] simulating morphic events
Interesting, but I am also looking for a mouse event. Anyone has other examples?
Doru
On 16 Nov 2009, at 13:57, Lukas Renggli wrote:
At this moment it looks like the problem is that the eventHandler in the morph is nil. Can anyone point me into the right direction?
Have a look at OBKeyBindingsTest>>modifier:keycode: in OB-Morphic- Tests.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com
"Some battles are better lost than fought."
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com "Problem solving efficiency grows with the abstractness level of problem understanding."
participants (3)
-
Gary Chambers -
Lukas Renggli -
Tudor Girba