home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / hobby / tapemeas / tapemeas.EXE / tapemeasure.txt < prev    next >
Encoding:
Text File  |  2000-07-07  |  3.6 KB  |  188 lines

  1. This is about as simple as an application can get. It is just a 2 inch
  2. tape measure that I wanted to have with me at all times. It is good
  3. for measuring short bolts. I also use it for measuring detail work on
  4. things like deck railings or picket fences that I see when I'm
  5. traveling. I rough out a sketch with Diddle use TapeMeasure to rough
  6. in the detail measurements.
  7.  
  8. There is a flaw in the tape measure itself because of the positioning
  9. of the pixels on the Palm screen. The distance between 0 and 2" is
  10. correct. The problem is between 7/8" and 1-1/8". The 1" mark could not
  11. be exact by using the constant that I built into the program for
  12. spacing so I opted build the scale from 0 to 7/8" accurately and then
  13. from 2" back to 1-1/8" accurately. I chose these accuracy areas purely
  14. from my own experiences in the things I typically measure. The 64th of
  15. an inch or so that the 1" mark is off doesn't really matter to me, but
  16. it might to some.
  17.  
  18. Again, thanks to Neal, Edwin, and Ron for Quartus Forth, doc
  19. interface, and string constants. I used Resource Edit to create the
  20. form. SmartDoc is my editor.
  21.  
  22. Here is the entire source in text format. I guess the only thing of
  23. note here are the two buttons which are masquerading as the program
  24. title and my email address.
  25.  
  26.  
  27. \ TapeMeasure 4/7/00 4:45 pm DMB
  28.  
  29. \ A 2" tape measure.
  30.  
  31. needs condthens
  32. needs events
  33. needs fields
  34. needs graphics
  35. needs ids
  36. needs resources
  37.  
  38. needs rdwin
  39. needs string-constants
  40.  
  41. \ resource stuff
  42. (ID) DMBD (ID) rsrc use-resources
  43.  
  44. 1005 constant tmFID
  45. 1020 constant tmTID
  46. 1021 constant tmMID
  47. 1030 constant tmTForm
  48. 1031 constant tmMForm
  49.  
  50. \ program constants
  51. 150 constant ePos
  52. 50 constant wM       \ whole inch measure in pixels
  53. 35 constant hM            \ half inch measure in pixels
  54. 20 constant qM            \ quarter inch measure in pixels
  55. 10 constant eM            \ eighth inch measure in pixels
  56.  
  57. 5 constant sRow
  58. 75 constant iLen
  59.  
  60. s" 0" sconstant in0
  61. s" 1" sconstant in1
  62. s" 2" sconstant in2
  63. s" 1/8" sconstant eTxt
  64. s" 3/8" sconstant e3Txt
  65. s" 5/8" sconstant e5Txt
  66. s" 7/8" sconstant e7Txt
  67. s" 1/4" sconstant q1Txt
  68. s" 3/4" sconstant q3Txt
  69. s" 1/2" sconstant hTxt
  70.  
  71. : dspTM ( -- )
  72.     iLen 2 * sRow + 1 + sRow DO
  73.  
  74.     \ 0"
  75.     i ePos wM -
  76.     i ePos
  77.     line
  78.     \ 0" text
  79.     sRow  5 -
  80.     ePos wM - 10 -
  81.     in0 string>win
  82.  
  83.     \ 1/8" line
  84.     iLen 8 / i +
  85.     ePos eM -
  86.     iLen 8 / i + ePos
  87.     line
  88.     \ 1/8" text
  89.     iLen 8 / i + 5 -
  90.     ePos eM - 20 -
  91.     eTxt string>win
  92.  
  93.     \ 1/4"
  94.     iLen 4 / i +
  95.     ePos qM -
  96.     iLen 4 / i + ePos
  97.     line
  98.     \ 1/4" text
  99.     iLen 4 / i + 5 -
  100.     ePos qM - 28 -
  101.     q1Txt string>win
  102.  
  103.     \ 3/8"
  104.     iLen 8 / 3 * i +
  105.     ePos eM -
  106.     iLen 8 / 3 * i + ePos
  107.     line
  108.     \ 3/8" text
  109.     iLen 8 / 3 * i + 5 -
  110.     ePos eM - 20 -
  111.     e3Txt string>win
  112.  
  113.     \ 1/2"
  114.     iLen 2 / i +
  115.     ePos hM -
  116.     iLen 2 / i + ePos
  117.     line
  118.     \ 1/2" text
  119.     iLen 2 / i + 5 -
  120.     ePos hM - 25 -
  121.     hTxt string>win
  122.  
  123.     \ 5/8"
  124.     iLen dup 8 / 3 * - i +
  125.     ePos eM -
  126.     iLen dup 8 / 3 * - i + ePos
  127.     line
  128.     \ 5/8" text
  129.     iLen dup 8 / 3 * - i + 5 -
  130.     ePos eM - 20 -
  131.     e5Txt string>win
  132.  
  133.     \ 3/4"
  134.     iLen dup 4 / - i +
  135.     ePos qM -
  136.     iLen dup 4 / - i + ePos
  137.     line
  138.     \ 3/4" text
  139.     iLen dup 4 / - i + 5 -
  140.     ePos qM - 28 -
  141.     q3Txt string>win
  142.  
  143.     \ 7/8"
  144.     iLen dup 8 / - i +
  145.     ePos eM -
  146.     iLen dup 8 / - i + ePos
  147.     line
  148.     \ 7/8" text
  149.     iLen dup 8 / - i + 5 -
  150.     ePos eM - 20 -
  151.     e7Txt string>win
  152.  
  153.     \ 1"
  154.     i iLen +
  155.     ePos wM - 
  156.     i iLen + ePos
  157.     line
  158.  
  159.     iLen +LOOP
  160.  
  161.     sRow iLen + 5 -
  162.     ePos wM - 10 -
  163.     in1 string>win
  164.  
  165.     iLen 2 * sRow + 5 -
  166.     ePos wM - 10 -
  167.     in2 string>win
  168. ;
  169.  
  170. : proc-event ( ekey -- )
  171. cond DUP ctlSelectEvent = IF
  172.     event >abs itemid 
  173. \ this is if they click on the title
  174. cond DUP tmTID = IF
  175.     tmTForm FrmAlert DROP
  176. \ this is if they click on my email address
  177. ELSE DUP tmMID = IF
  178.      tmMForm FrmAlert DROP 
  179. thens DROP 
  180. thens DROP  ;
  181.  
  182.  
  183. : go ( -- )
  184.     tmFID ShowForm
  185.     dspTM
  186.     BEGIN ekey proc-event AGAIN
  187. ;
  188.