Hi
I want to do a small game based on the FlasherMorph. I change its location via the step method so that it crosses the screen
I redefined the methods handleMouseDown: to return true
mouseDown: to toggle the direction
Now I tried to increase the speed when the user lets the mouse on the morph. There is a handleMouseOver: but no method mouseOver:. What is the idiom to get the mouseOver behavior?
I also tried to handle keystroke evt so I redefined handlesKeyboard: return true and keystroke: to analyse the hit key
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
Thanks
ducasse wrote:
Hi
I want to do a small game based on the FlasherMorph. I change its location via the step method so that it crosses the screen
I redefined the methods handleMouseDown: to return true
mouseDown: to toggle the direction
Now I tried to increase the speed when the user lets the mouse on the morph. There is a handleMouseOver: but no method mouseOver:. What is the idiom to get the mouseOver behavior?
Look at mouseEnter and mouseLeave Karl
I also tried to handle keystroke evt so I redefined handlesKeyboard: return true and keystroke: to analyse the hit key
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
Thanks
ducasse wrote:
Hi
I want to do a small game based on the FlasherMorph. I change its location via the step method so that it crosses the screen
I redefined the methods handleMouseDown: to return true
Also, I think you wanted to overwrite
Morph >> handlesMouseDown: anEvt instead of Morph >> handleMouseDown: anEvt
mouseDown: to toggle the direction
Now I tried to increase the speed when the user lets the mouse on the morph. There is a handleMouseOver: but no method mouseOver:. What is the idiom to get the mouseOver behavior?
Look at mouseEnter and mouseLeave Karl
I also tried to handle keystroke evt so I redefined handlesKeyboard: return true and keystroke: to analyse the hit key
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
You should embed the FlasherMorph in some other playfield-morph, (put it in an instance-variable myFlasherMorph for easy referencing) and overwrite in that embedding PlaygroundMorph also following:
PlaygroundMorph >> handlesMouseDown: anEvt ^true
and
PlaygroundMorph >> mouseEnter: anEvt anEvt hand newKeyboardFocus: myFlasherMorph
Best,
Markus
on 3/30/02 6:19 PM, Karl Ramberg at karl.ramberg@chello.se wrote:
ducasse wrote:
Hi
I want to do a small game based on the FlasherMorph. I change its location via the step method so that it crosses the screen
I redefined the methods handleMouseDown: to return true
mouseDown: to toggle the direction
Now I tried to increase the speed when the user lets the mouse on the morph. There is a handleMouseOver: but no method mouseOver:. What is the idiom to get the mouseOver behavior?
Look at mouseEnter and mouseLeave
I found that and realize I need to use them. For keystroke I'm still stuck Thanks
On Saturday 30 March 2002 09:08 am, ducasse wrote:
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
You need to tell the Hand to set keyboard focus to you in your mouseEnter: method (and release it in your mouseLeave: method).
on 3/30/02 6:39 PM, Ned Konz at ned@bike-nomad.com wrote:
On Saturday 30 March 2002 09:08 am, ducasse wrote:
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
You need to tell the Hand to set keyboard focus to you in your mouseEnter: method (and release it in your mouseLeave: method).
Thanks Ned without you.....
So that other people learn it I put an how in the wiki: minnow.cc.gatech.edu/squeak/2415/
How to set up event handling so that a morph gets the keyboard event Simple do the following:
handlesKeyboard: evt ^ true
mouseEnter: evt
evt hand keyboardFocus: self
mouseLeave: evt
evt hand releaseKeuboardFocus: self
keyDown: evt
evt keyCharacter ....doSomething
So far this is a nice simple project in etoys ...
Cheers,
Alan
------
At 9:39 AM -0800 3/30/02, Ned Konz wrote:
On Saturday 30 March 2002 09:08 am, ducasse wrote:
But the morph to not get the key event. The browser still gets the event
I'm sure I missed something. Any hint?
You need to tell the Hand to set keyboard focus to you in your mouseEnter: method (and release it in your mouseLeave: method).
-- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com
--
On Saturday 30 March 2002 01:24 pm, Alan Kay wrote:
So far this is a nice simple project in etoys ...
How do you respond to mouse events in etoys?
On Saturday 30 March 2002 09:05 pm, I wrote:
On Saturday 30 March 2002 01:24 pm, Alan Kay wrote:
So far this is a nice simple project in etoys ...
How do you respond to mouse events in etoys?
I'm sorry, I meant keyboard events. He wanted to change speed when a key was hit.
Ned Konz wrote:
On Saturday 30 March 2002 09:05 pm, I wrote:
On Saturday 30 March 2002 01:24 pm, Alan Kay wrote:
So far this is a nice simple project in etoys ...
How do you respond to mouse events in etoys?
I'm sorry, I meant keyboard events. He wanted to change speed when a key was hit.
I made a change set that gave etoys keyboard events, it should be in the bugs-and-fixes-archive.
Karl
squeak-dev@lists.squeakfoundation.org