home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / vista_1 / !Manual_manual_examples < prev    next >
Encoding:
Text File  |  1996-01-15  |  4.1 KB  |  110 lines

  1. <html>
  2. <h1>Example programs</h1>
  3.  
  4. I have found through experience that by far the best way to
  5. learn how to use someone else's library is to look at the
  6. example programs supplied and copy them.  I have supplied
  7. a set of 5 example programs which you should examine.  They
  8. are not very functional (apart from the program you are using
  9. now: !HyperView), but show how to use some of the major features
  10. of the library.
  11. <p>
  12. Please feel free to use and copy the programs, and incorporate
  13. the structure of them into your own efforts.  They are 
  14. probably not bug free (none of my software is), but they
  15. seem to work OK.
  16.  
  17. <p>
  18.  
  19. <h2>!HyperView</h2>
  20.  
  21. This is the application you are currently running.  It is an HTML
  22. viewer application which is not particularly well written and
  23. is not very functional.  When run, an icon appears on the
  24. icon bar.  You can drag text files to this icon in order to
  25. display them in a window.  If the file starts with the HTML
  26. tag <html> then it is displayed in a proportional outline
  27. font and formatted.  Otherwise, it will be assumed to be
  28. preformatted text <pre> and will be displayed in the
  29. system font and not formatted.
  30. <p>
  31. The program has a few major problems, not least of which is that
  32. is seems to leak memory like the proverbial sieve.  The main
  33. use of the program is to do what you are doing now - read
  34. the Vista user manual.  I may improve it in future, but I hope
  35. it suits its purpose for the time being.
  36.  
  37. <p>
  38. <h2>!Dbox</h2>
  39.  
  40. This application shows how to use the DialogueBox class in Vista.
  41. If you look at the source file Vista:h.wins, you will see that
  42. the DialogueBox class is derived from both the Window and
  43. Thread classes.  This is multiple inheritance and is very
  44. powerful.  It means that the DialogueBox behaves like
  45. both a Window (ie it displays a window on the screen) and a
  46. Thread (ie it runs independently).
  47. <p>
  48. The fact that the DialogueBox is a thread allows the main program
  49. to sleep until it has terminated - a very powerful construct.
  50. <p>
  51. The example also shows how to use the various tools supplied with
  52. Vista in the file Vista:h.tools.
  53.  
  54. <p>
  55. <h2>!MyApps</h2>
  56.  
  57. This small application shows how to use the IconGrid class.
  58. This class is derived from the Window class and behaves like
  59. a Filer directory viewer.  The application places an
  60. icon on the left side of the iconbar which, when clicked,
  61. displays a directory viewer.  The idea is that you can
  62. drag directories, applications and files into this window
  63. and it will hold them in one accessible place until needed.
  64. <p>
  65. By double-clicking on one of the items in a window the
  66. application will do something with it.  What it does depends
  67. on what it is.  If you double-click an application, it will
  68. be run; a directory will be opened and a file will generate
  69. an error.  The file should really broadcast a DataOpen message
  70. but that is left as an exercise (no I can't be bothered doing
  71. it at present).
  72. <p>
  73. This sounds useful, but I haven't supplied a Save option (another
  74. exercise?).
  75. <p>
  76.  
  77. <p>
  78. <h2>!SaveEx</h2>
  79.  
  80. This application simply shows how to use the SaveAs class.  It displays
  81. a window with a FontObject object in it.  By clicking menu on the
  82. window you are presented with a single option 'Save'.  Drag the
  83. icon to a directory viewer to save a text file.  Exciting eh?
  84.  
  85. <p>
  86. <h2>!Threads</h2>
  87.  
  88. This application is probably quite a useful utility in its own right.
  89. Clicking on the needle and thread icon gives you a window which
  90. displays lots of details about the mouse.  Click a few more
  91. times and more windows appear displaying exactly the same thing.
  92. <p>
  93. This sounds easy, but if you look at the source code you will see that
  94. each window consists of a forever loop which reads the mouse
  95. position and performs some calculations.  The program shows the
  96. power of the Multi-threading aspects of Vista.  All of the
  97. forever loops run at the same time and are pre-empted
  98. by Vista when Wimp_Poll is needed.  
  99. <p>
  100. This, in my opinion, makes the programs much easier to write
  101. as there is no need to have complex state machines prompted by
  102. event reception.  Just write your program as you think about it
  103. and Vista will take care of the OS aspects.
  104. <p>
  105. <p>
  106. I hope that these programs are useful.
  107. <p>
  108. <p>
  109. <h3>Dave Allison</h3>.
  110.