home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Snippets / WatchCursor / WatchCursor.README < prev   
Encoding:
Internet Message Format  |  1994-05-03  |  2.4 KB  |  [TEXT/R*ch]

  1. From: kurisuto@BACH.UDEL.EDU ("Sean J. Crist")
  2. Subject: Free Code:  Watch Cursors
  3. Date: 18 Sep 92 02:30:01 GMT
  4.  
  5.  
  6.      The following free code is nothing particularly complicated or
  7. unusual; it simply handles the work involved in showing watch cursors,
  8. either with spinning or non-spinning hands.  I'm posting it here because
  9. it may be helpful to new programmers, or
  10. because it might save someone else the time of writing it over again.
  11.      This code was written in Think Pascal 4.0.
  12.  
  13. How to use this code:
  14. 1.  Use ResEdit to copy the seven CURS resources from the Finder into your
  15. application's resource file.  I lifted mine from 6.1.5 where they were
  16. numbered beginning at 257.  I'm not sure whether or not these resource
  17. numbers are the same under all
  18. versions of the Finder; if yours are different, you will have to either
  19. change the resource numbers or the code below.
  20.      Also, I don't know how Apple feels about people stealing their
  21. cursors.  However, since these seven CURS resources are a standard part of
  22. the user interface, and since they are a minor part of the Finder, I doubt
  23. that Apple is going to sue you for
  24. using them.
  25.  
  26. 2.  Include the global variables in the code below in your program's
  27. global declarations.
  28.  
  29. 3.  When your program initializes itself on startup, it should call
  30. InitWatch once.  Alternately, you could eliminate this routine and paste
  31. its one line of code into your own initialize routine.
  32.  
  33. 4.  To show a simple still watch, call ShowWatch.  This routine is
  34. functionally equivalent to InitCursor.
  35.  
  36. 5.  To make the hands of the watch actually spin, don't call ShowWatch. 
  37. Instead, start the watch spinning by calling StartSpinningWatch.  While
  38. you are doing your time-consuming processing, call SpinWatch as often as
  39. possible (perhaps by including it in
  40. some inner processing loop).  SpinWatch takes care of the timing involved
  41. in spinning the watch hands; all you have to do is call it as often as
  42. possible.
  43.  
  44. 6.  When you are finished spinning the watch hands, be sure to call
  45. StopSpinningWatch.  This deallocates the memory associated with the watch
  46. cursors.
  47.  
  48. 7.  This code spins the watch handle every 30 ticks (once every half
  49. second).  To change this speed, edit the figure 30 in the SpinWatch
  50. routine.  (I don't know whether Apple has established any guideline for
  51. how often a cursor should spin.)
  52.  
  53. Please send bug reports, praise, etc. to kurisuto@bach.udel.edu.  I hope
  54. this code is useful to somebody.
  55.