CSCI 1300 Computer Science 1: Programming
Programming exercises about clicking and dragging and pushing buttons
February 11, 2004
Here are programming exercises you should be able to do at
this point. As always, I suggest you do
the ones you are not sure about.
Not quite as basic ...
Change the demo program
that had two icons so that
when an icon is clicked it does not “snap” to the
position of the mouse. (Click and drag the icons on your computer's
“desktop” to see an example.)
Change the same program so that
when an icon is released by the mouse it snaps to the nearest
point (x, y) that is divisible by 100. E.g., if the mouse releases
the icon at (388, 505) the icon should end up at (400, 500).
the program that had an array of icons
so that the one that
is being dragged is always visible, not behind any other icon.
Have an array of ten icons all looking different.
button example so
that when the mouse is on a button (but not dragging it)
a “screentip” appears: a small box with a few words explaining
something about that button.
Make it so that the screentip only shows up after a few seconds.
© 2004 Karl Winklmann
Thursday, April 29, 2004