home *** CD-ROM | disk | FTP | other *** search
- property extentSprite, thumbheight, travelrange, position, offset, tracking, dynamic, proportional, fieldNum, totalHeight, fieldHeight, fieldMem
- global Posledni_klik
-
- on getPropertyDescriptionList
- set description to [:]
- addProp(description, #dynamic, [#default: 1, #format: #boolean, #comment: "Dynamic:"])
- addProp(description, #fieldNum, [#default: the currentSpriteNum - 3, #format: #integer, #comment: "Scroll which sprite:"])
- addProp(description, #extentSprite, [#default: the currentSpriteNum - 2, #format: #integer, #comment: "Slider Constraint Sprite:"])
- return description
- end
-
- on getBehaviorDescription
- return "Vertical Multiline Textfield Scrollbar"
- end
-
- on beginSprite me
- set fnum to the fieldNum of me
- set fmember to the memberNum of sprite the fieldNum of me
- set the fieldMem of me to fmember
- set viewable to 1.0
- set the totalHeight of me to float(the bottom of the rect of member fmember)
- set the fieldHeight of me to float(the bottom of sprite fnum - the top of sprite fnum)
- set viewable to the fieldHeight of me / the totalHeight of me
- puppetSprite(the spriteNum of me, 1)
- set barheight to the bottom of sprite the extentSprite of me - the top of sprite the extentSprite of me
- set the thumbheight of me to the height of sprite the spriteNum of me
- set the travelrange of me to barheight - thumbheight
- set the tracking of me to 0
- set the position of me to 0.0
- positionThumb(me)
- scrollText(me)
- end
-
- on getAssocMembers
- set myPropList to []
- return myPropList
- end
-
- on mouseEnter me
- set the cursor of sprite the spriteNum of me to [member "ruka_1", member "ruka_2"]
- end
-
- on endSprite me
- puppetSprite(the spriteNum of me, 0)
- end
-
- on positionThumb me
- set topT to (the position of me * the travelrange of me) + the top of sprite the extentSprite of me
- set snum to the spriteNum of me
- set Trect to rect(the left of sprite snum, topT, the right of sprite snum, topT + the thumbheight of me)
- set the rect of sprite snum to Trect
- end
-
- on scrollText me
- set the scrollTop of member the fieldMem of me to the position of me * (the totalHeight of me - the fieldHeight of me)
- end
-
- on prepareFrame me
- if the tracking of me then
- set thumb to the spriteNum of me
- set extent to the extentSprite of me
- set V to the mouseV - the offset of me
- if V < the top of sprite extent then
- set V to the top of sprite extent
- end if
- if V > (the bottom of sprite extent - the thumbheight of me) then
- set V to the bottom of sprite extent - the thumbheight of me
- end if
- set the position of me to float(V - the top of sprite extent) / float(the travelrange of me)
- positionThumb(me)
- if the dynamic of me then
- scrollText(me)
- end if
- end if
- end
-
- on mouseDown me
- set the tracking of me to 1
- set the offset of me to the mouseV - the top of sprite the spriteNum of me
- end
-
- on mouseUp me
- if the dynamic of me = 0 then
- scrollText(me)
- end if
- set the tracking of me to 0
- end
-
- on mouseUpOutSide me
- if the dynamic of me = 0 then
- scrollText(me)
- end if
- set the tracking of me to 0
- end
-
- on scroll_a_line me, amount
- set the scrollTop of member the fieldMem of me to the position of me * (the totalHeight of me - the fieldHeight of me)
- set change_amount to float(amount) * (float(the textHeight of member the fieldMem of me) / float(the totalHeight of me - the fieldHeight of me))
- set the position of me to the position of me + change_amount
- if the position of me < 0.0 then
- set the position of me to 0.0
- end if
- if the position of me > 1.0 then
- set the position of me to 1.0
- end if
- positionThumb(me)
- end
-