home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ICONMN.ZIP / ICONMEU1.DOC < prev    next >
Encoding:
Text File  |  1989-04-11  |  10.1 KB  |  178 lines

  1. ICONMEU1.DOC
  2.  
  3. Instruction file for Turbo Pascal Icon Menu Maker  -  by  Bill Tavolga
  4.                            Version 1.0
  5.  
  6. Files in this group:
  7.      ICON-MK.EXE   Program for constructing up to 32 icons per file
  8.      ICONTST1.EXE  Program to demonstrate use of constructed icons in menu
  9.      ICONTST1.PAS  Source code for above
  10.      ICON-DEM.DAT  Sample file of icons
  11.      ICON.1        Sample file of menu parameters (use with ICONTST1)
  12.      ICONMEU1.TPU  Unit to be used with ICONTST1 or your own program
  13.      IMOUSE.PAS    Unit of basic mouse functions used here
  14.      IMOUSE.TPU    Compiled mouse unit
  15.  
  16. Requirements:
  17.      Turbo Pascal 5.0
  18.      PC-type hardware with EGA or VGA graphics
  19.      Mouse and mouse driver (loaded)
  20.      (and patience to experiment)
  21.  
  22. General purpose:
  23.      This is for the programmer who is looking for a shortcut to making MAC-
  24. like mouse-controlled icon-menus for his programs.
  25.      The procedure is first to create a file of icons. The menu in your own
  26. program will use two procedures. The DISPLAY_ICONS procedure permits you
  27. to select several icons from your file and paint them on the screen.  The
  28. USE_ICON_MENU procedure waits until a mouse button is pressed. At this
  29. point four values are returned to the program: the x and y coordinates of
  30. the mouse cursor, the button status (1 for left, 2 for right, etc.), and the
  31. icon number that was selected (0 if none).  The most frequent use of this
  32. procedure would be in a loop that would continue until a particular icon is
  33. selected.  Within the loop the returned values can be used for any other
  34. programming tasks, except something that interferes with the display of the
  35. icons or mouse operation. See ICONTST1.PAS for a sample.
  36.  
  37. Getting started
  38.    (read this especially if you are an inexperienced programmer):
  39.      As a first step, just run program ICONTST1.EXE.  Choose the internally
  40. programmed option (C).  Be sure that your mouse driver has been loaded. 
  41. Pressing any mouse button anywhere on the screen gives you an output of:
  42. icon selected (0 if none), x-y coordinates, and button status. This option is
  43. programmed so that clicking the left mouse button over icon "EXIT" will quit
  44. the program, otherwise the loop continues. Your icon is selected only when
  45. the left mouse button is pressed, but the button must be released before any
  46. action takes place.
  47.      Exit the program, and run it again, but this time choose the B option:
  48. text-file of menu parameters. (If you have any problems, it may be that the
  49. data files are not in the default directory.) The demonstration textfile is
  50. ICON.1 .  The menu display will be a bit different.  If you examine ICON.1,
  51. you will see it is an ASCII file with the following:
  52.                         icon-dem.dat
  53.                         7 10 21 13 8
  54.                         5
  55. The first line is a demonstration file of icon data; next is an array of five
  56. numbers that represent the ordinal position of the icons in the file, i.e., you
  57. will use the seventh, tenth, twenty-first, etc., in that order; lastly is the
  58. position of the icon you will use to exit the program. Within limits, you can
  59. change this file to use any of the available icons in any order. In Version 1.0
  60. of this program, a maximum of five icons can be used in a menu. If the
  61. number of icons you choose is less than the maximum of five, then a zero
  62. must be added to the array. The number in line 3 cannot be greater than the
  63. number of icons used.  The unit ICONMEU1.TPU will catch some of these
  64. errors, but the programmer has the responsibility to stay within proper
  65. limits.
  66.      Finally, run the program again and try the A option.  You may find new
  67. and wonderful ways of crashing your system, but if you use the Turbo
  68. Pascal 5.0 environment, it will catch most of your errors. Make sure that the
  69. icon file, e.g., ICON-DEM.DAT, is in the path.  Enter the array with spaces
  70. between the numbers, thus: 2 5 7. The last number must be a zero if the
  71. array contains fewer than five numbers, and each number may not be less
  72. than 1 or more than 32. The last item can only be equal to or less than the
  73. number of array members, and not zero.
  74.  
  75. Icon constructor (ICON-MK.EXE):
  76.      This program creates the icons that you use in your menu. Each icon
  77. consists of a rectangle 24 pixels across and 20 pixels high, and a file of 32
  78. such icons is generated and saved in a format that can be used by
  79. ICONMEU1.TPU. The program permits you to use a previously saved file of
  80. icons or create a new file. The file ICON-DEM.DAT is supplied with a few
  81. samples for you to start with.
  82.      After the file is selected, the screen displays all the component icons
  83. (including blanks), and a drawing area. The mouse is used for all operations.
  84. Clicking the mouse over an existing icon (or blank area over an icon
  85. number), brings up that icon: left button for editing; right button to blank
  86. out and begin drawing. Draw the icon within the squares area: left button
  87. to fill a square; right button to clear. By holding down a button, you can
  88. create or clear a line of squares.  Each square represents a pixel in the icon,
  89. and as you draw within the squares area, the icon is created over its
  90. number. A red dot marks the currently active icon. 
  91.      In this way, you can create your new icons or redraw old ones.  When
  92. finished, click the mouse left button over either SAVE or EXIT.  The latter
  93. will quit the program without saving your work, so be careful.
  94.  
  95. Icon testing program (ICONTST1.PAS):
  96.      The source code of this program is supplied to show you how the
  97. ICONMENU system works, and to give you a model of how you can create your
  98. own MAC-like mouse menus. 
  99.      There are some absolute requirements: you must be in EGA or VGA
  100. graphics, and the mouse driver must be loaded.  
  101.  
  102.      The DISPLAY_ICONS procedure must be given the following parameters:
  103.      ICON_FILE_NAME : This is a string type variable which can be defined
  104. as a file name with or without a complete path.  Anything goes, as long as
  105. the program can find the file. The program will halt if the file cannot be
  106. found or the file is not the right format or size. This file must have been
  107. created by the ICON-MK.EXE program.
  108.      ICS : This is an array of bytes of the type ICON_ARRAY (defined in
  109. ICONMEU1.TPU). It contains a maximum of 5 bytes, each with a value of from
  110. 1 to 32, representing the icon number in the above file. If the array has
  111. fewer than 5 members, then a final zero must be added so that the program
  112. will know when to stop loading icons.
  113.      Finally, you must enter the foreground and background colors for the
  114. icons. Numbers can be used, but it is convenient to enter the names of the
  115. 16 standard colors as defined in Turbo Pascal.
  116.      This procedure also checks for the presence of a mouse driver, and sets
  117. the screen size to 650x350.
  118.  
  119.      The USE_ICON_MENU procedure receives the necessary values from the
  120. above procedure. Although mouse movement is still possible, the program is
  121. otherwise suspended until any mouse button is pressed.  To use this
  122. procedure repetitively, you must place it in a loop (as shown in
  123. ICONTST1.PAS).  At each button press, four values are passed:
  124.      icon_selected : Returns byte representing the ordinal value of the icon
  125. selected. If the mouse was not clicked over an icon, the returned value is
  126. zero. When the mouse cursor is over an icon and the left button pressed, the
  127. icon is selected, but no action takes place until the button is released.  This
  128. is to prevent "dragging" the cursor over the icons.  When selecting an icon,
  129. the left button should be "clicked."  Note that the mouse cursor shape
  130. changes when it moves over the icon area.
  131.       x and y : These are of type word and represent the coordinates of the
  132. mouse cursor at the time of button press.  The x values range 0 to 649, and
  133. y values range 0 to 349.
  134.       button : This is also of type word, and remains zero if no button
  135. pressed. Left button generates 1; right button - 2; both buttons - 3.  If you
  136. have a 3-button mouse, the middle button generates 4.
  137.       The programmer is free to use the mouse and virtually all other screen
  138. functions in conjunction with this icon menu.  Obviously if the program
  139. erases the display, then it is necessary to use the DISPLAY_ICONS procedure
  140. again.
  141.  
  142.      IMOUSE.PAS : This file is included here for the convenience of the
  143. programmer.  The file consists of several basic mouse functions, and should
  144. work with most mouse drivers (I have tested them with Microsoft Mouse and
  145. Logitech Mouse). The file IMOUSE.TPU is the compiled unit used in the icon
  146. menu programs.  
  147.  
  148.      These programs have all been generated by Turbo Pascal 5.0 from
  149. Borland International.
  150.  
  151. =======================================================================
  152.  
  153.      These files and programs are provided for the convenience and
  154. enjoyment of any Turbo Pascal programmers.  You are welcome to use,
  155. misuse, copy, and distribute this material in any way. 
  156.  
  157.      However, I do have a version 2.0 of this material with a few additional
  158. features. The DISPLAY_ICONS in version 2.0 has the following additional input
  159. parameters:
  160.         An option of placing the icon menu anywhere on the screen.
  161.         An option of displaying the icons horizontally as well as vertically.
  162.         As many icons as will fit across or down the screen can be displayed.
  163.      For a registration fee of $15, I shall send a copy of version 2.0 and you
  164. will be notified of any further improvements or modifications. The files will
  165. be sent on a 5.25" (360K) disk, unless a 3.5" (720K) disk is requested.   
  166.      Comments and suggestions from users would be appreciated and, if
  167. feasible, could be added to subsequent versions. I know there are other
  168. similar programs available, but this one has the virtue of being cheap and
  169. may have some features appropriate to your particular application.
  170.      Please send comments, checks, etc., to:
  171.                  William N. Tavolga
  172.                  5151 Windward Ave.
  173.                  Sarasota, FL  34242
  174.                     Phone: (813) 349-6221
  175.                     CIS: 76360,45
  176.      
  177.      The author is not responsible for any damage to your computer, loss of
  178. time, or loss of hair resulting from the use of any of this software.