home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / hc / control.sit / Control / card_2818.txt < prev    next >
Encoding:
Text File  |  1988-11-25  |  2.4 KB  |  104 lines

  1. -- card: 2818 from stack: in
  2. -- bmap block id: 2276
  3. -- flags: 0000
  4. -- background id: 2722
  5. -- name: 
  6.  
  7.  
  8. -- part 2 (button)
  9. -- low flags: 00
  10. -- high flags: 0002
  11. -- rect: left=87 top=119 right=131 bottom=114
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Fader 1 Control
  20. ----- HyperTalk script -----
  21. on mouseStillDown
  22.   -- set constants
  23.   put 100 into vMin
  24.   put 200 into vMax
  25.   put 100 into hVal
  26.   put 10 into divisions
  27.   -- calculate jump values
  28.   put (vMax-vMin)/(divisions*2) into offset
  29.   get item 2 of the mouseLoc
  30.   if it > vMin and it < vMax then
  31.     set loc of button id 2 to hVal,offset+it-(it mod 10)
  32.     put vMax-(it-(it mod 10)) into card field "Fader value"
  33.   else if it > vMax then
  34.     set loc of button id 2 to hVal, offset+vMax
  35.     put 0 into card field "Fader value"
  36.   else if it < vMin then
  37.     set loc of button id 2 to hVal, offset+vMin
  38.     put 100 into card field "Fader value"
  39.   end if
  40. end mouseStillDown
  41.  
  42.  
  43.  
  44. -- part 10 (field)
  45. -- low flags: 01
  46. -- high flags: 0002
  47. -- rect: left=91 top=214 right=228 bottom=114
  48. -- title width / last selected line: 0
  49. -- icon id / first selected line: 0 / 0
  50. -- text alignment: 0
  51. -- font id: 3
  52. -- text size: 9
  53. -- style flags: 0
  54. -- line height: 12
  55. -- part name: Fader value
  56.  
  57.  
  58. -- part 11 (field)
  59. -- low flags: 00
  60. -- high flags: 0002
  61. -- rect: left=215 top=100 right=208 bottom=493
  62. -- title width / last selected line: 0
  63. -- icon id / first selected line: 0 / 0
  64. -- text alignment: 0
  65. -- font id: 3
  66. -- text size: 9
  67. -- style flags: 0
  68. -- line height: 12
  69. -- part name: 
  70.  
  71.  
  72. -- part 12 (button)
  73. -- low flags: 00
  74. -- high flags: A004
  75. -- rect: left=41 top=229 right=247 bottom=160
  76. -- title width / last selected line: 0
  77. -- icon id / first selected line: 0 / 0
  78. -- text alignment: 1
  79. -- font id: 0
  80. -- text size: 12
  81. -- style flags: 0
  82. -- line height: 16
  83. -- part name: Edit my script
  84. ----- HyperTalk script -----
  85. on mouseUp
  86.   edit script of button id 2
  87. end mouseUp
  88.  
  89.  
  90.  
  91. -- part contents for card part 10
  92. ----- text -----
  93. 80
  94.  
  95. -- part contents for card part 11
  96. ----- text -----
  97. This simple stack shows how to simulate a control similar to the volume control in the control panel.
  98.  
  99. The tracking is not fast enough.  Some optimization of my script would probably improve it a lot.
  100.  
  101. Please feel free to use any part of this stack in your own creations.
  102.  
  103.  
  104.