home *** CD-ROM | disk | FTP | other *** search
/ Digitální fotografie a video / Digitalni-fotografie-a-video-covermount.bin / Aplikace / Servis / Rejstrik.dxr / 00081_Pokus.ls < prev    next >
Encoding:
Text File  |  1998-05-19  |  3.3 KB  |  101 lines

  1. property extentSprite, thumbheight, travelrange, position, offset, tracking, dynamic, proportional, fieldNum, totalHeight, fieldHeight, fieldMem
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   addProp(description, #dynamic, [#default: 1, #format: #boolean, #comment: "Dynamic:"])
  6.   addProp(description, #fieldNum, [#default: the currentSpriteNum - 3, #format: #integer, #comment: "Scroll which sprite:"])
  7.   addProp(description, #extentSprite, [#default: the currentSpriteNum - 2, #format: #integer, #comment: "Slider Constraint Sprite:"])
  8.   return description
  9. end
  10.  
  11. on getBehaviorDescription
  12.   return "Vertical Multiline Textfield Scrollbar"
  13. end
  14.  
  15. on beginSprite me
  16.   set fnum to the fieldNum of me
  17.   set fmember to the memberNum of sprite the fieldNum of me
  18.   set the fieldMem of me to fmember
  19.   set viewable to 1.0
  20.   set the totalHeight of me to float(the bottom of the rect of member fmember)
  21.   set the fieldHeight of me to float(the bottom of sprite fnum - the top of sprite fnum)
  22.   set viewable to the fieldHeight of me / the totalHeight of me
  23.   puppetSprite(the spriteNum of me, 1)
  24.   set barheight to the bottom of sprite the extentSprite of me - the top of sprite the extentSprite of me
  25.   set the thumbheight of me to the height of sprite the spriteNum of me
  26.   set the travelrange of me to barheight - thumbheight
  27.   set the tracking of me to 0
  28.   set the position of me to 0.0
  29.   positionThumb(me)
  30. end
  31.  
  32. on getAssocMembers
  33.   set myPropList to []
  34.   return myPropList
  35. end
  36.  
  37. on mouseEnter me
  38.   set the cursor of sprite the spriteNum of me to [member "ruka_1", member "ruka_2"]
  39. end
  40.  
  41. on endSprite me
  42.   puppetSprite(the spriteNum of me, 0)
  43. end
  44.  
  45. on positionThumb me
  46.   set topT to (the position of me * the travelrange of me) + the top of sprite the extentSprite of me
  47.   set snum to the spriteNum of me
  48.   set Trect to rect(the left of sprite snum, topT, the right of sprite snum, topT + the thumbheight of me)
  49.   set the rect of sprite snum to Trect
  50. end
  51.  
  52. on scrollText me
  53.   set the scrollTop of member the fieldMem of me to the position of me * (the totalHeight of me - the fieldHeight of me)
  54. end
  55.  
  56. on prepareFrame me
  57.   if the tracking of me then
  58.     set thumb to the spriteNum of me
  59.     set extent to the extentSprite of me
  60.     set V to the mouseV - the offset of me
  61.     if V < the top of sprite extent then
  62.       set V to the top of sprite extent
  63.     end if
  64.     if V > (the bottom of sprite extent - the thumbheight of me) then
  65.       set V to the bottom of sprite extent - the thumbheight of me
  66.     end if
  67.     set the position of me to float(V - the top of sprite extent) / float(the travelrange of me)
  68.     positionThumb(me)
  69.     if the dynamic of me then
  70.       scrollText(me)
  71.     end if
  72.   end if
  73. end
  74.  
  75. on mouseDown me
  76.   set the tracking of me to 1
  77. end
  78.  
  79. on mouseUp me
  80.   if the dynamic of me = 0 then
  81.     scrollText(me)
  82.   end if
  83.   set the tracking of me to 0
  84. end
  85.  
  86. on mouseUpOutSide me
  87. end
  88.  
  89. on scroll_a_line me, amount
  90.   set the scrollTop of member the fieldMem of me to the position of me * (the totalHeight of me - the fieldHeight of me)
  91.   set change_amount to float(amount) * (float(the textHeight of member the fieldMem of me) / float(the totalHeight of me - the fieldHeight of me))
  92.   set the position of me to the position of me + change_amount
  93.   if the position of me < 0.0 then
  94.     set the position of me to 0.0
  95.   end if
  96.   if the position of me > 1.0 then
  97.     set the position of me to 1.0
  98.   end if
  99.   positionThumb(me)
  100. end
  101.