CSCI 1300 Computer Science 1: Programming
Spring 2004
Karl Winklmann

 
 

Programming exercises about clicking and dragging and pushing buttons

February 11, 2004

 
 
 


Project description form | Contents | Schedule and syllabus | Grading policy | People | Programs | MSDOS | Emacs | News archive | Dora (Assignment submission) | www.cplusplus.com | ~main/cs1300/doc/bgi

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.

  1. 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.)
  2. 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).
  3. Change the program that had an array of icons so that the one that is being dragged is always visible, not behind any other icon.
  4. Have an array of ten icons all looking different.
  5. Change the 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.
Not quite as basic ...
  1. Make it so that the screentip only shows up after a few seconds.
 


© 2004 Karl Winklmann 5:53 PM, Thursday, April 29, 2004