Professional Documents
Culture Documents
Mouse Events
Mouse Events
Warm up!
Exercises
Q1) Raises an event when we press a key on the keyboard
A . Keyup
B. Keypress
C. keydown
Q2) Runs a sub named S2 when the key is released.
A. Graphicswindow.keyrelease=S2
B. Graphicswindow.Keyup=S2
C. Graphicswindow.Keydown=S3
Q3) find the errors in the following code
Q4) after correcting the errors. What is the result of the code?
Keyboard Events
KeyDown KeyUp
Raises an event When you press a Raises an event When you release
key on the keyboard, the key
Keyboard Events
1 KeyDown:
2 KeyUp:
Example on keyboard events
the program below will add a green
rectangle with a blue pen color in a
random place when we press a key on
the keyboard.
Mouse Events
Raises an event When you Raises an event When you Raises an event When you
click on the mouse button release the mouse button move your mouse
Can you guess the result of the
following code?
Lesson Task :
write a program that: adds
a yellow square in a
random location whenever
you click the mouse button
Lesson Task :
write a program that: adds
a red ellipse in a random
location whenever you
press any key on your
keyboard!
And
adds a yellow square in a
random location whenever
you click the mouse button