[Q] Learning Event
Markus Gaelli
gaelli at emergent.de
Sat Mar 30 17:33:47 UTC 2002
>
>
> 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
More information about the Squeak-dev
mailing list
|